Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Falcon (programming language) wikipedia , lookup
Java performance wikipedia , lookup
Design Patterns wikipedia , lookup
Class (computer programming) wikipedia , lookup
Java (programming language) wikipedia , lookup
Abstraction (computer science) wikipedia , lookup
Java ConcurrentMap wikipedia , lookup
Go (programming language) wikipedia , lookup
Name mangling wikipedia , lookup
C Sharp syntax wikipedia , lookup
CHAPTER 2 THEORETICAL FOUNDATION 2.1 Software Development Life Cycle (SDLC) 2.1.1 Scrum Pressman (2010:82) says that Scrum, “is an agile software development method that was conceived by Jeff Sutherland and his development team in the early 1990s.” The principles in Scrum are influenced by the agile manifesto and are used as a guide in development activities inside a process which includes framework activities: requirements, analysis, design, evolution, and delivery. There are process patterns which are sprints within these activities. The product complexity and size decides how many sprints are required, and they get modified by the Scrum team in real time. Scrum is effective for projects whose requirements are always changing with tight schedules. This is the set of development actions within Scrum: 1. Backlog Backlog is a list of requirements or features for the project which is prioritized and is meant to provide business value for the client. Since the backlog can be added at any time, changes are possible. 2. Sprints A sprint has work units required for the purpose of achieving a requirement in the backlog within the time-box or defined period of time. In sprint, the team members work in a shortterm yet stable environment. 9 10 3. Scrum Meetings The Scrum team holds daily short meetings to discuss what they have done since the last meeting, what challenges they are facing, and what they want to accomplish for the next meeting. The meetings are led by a Scrum master, the team leader. 4. Demos Demos are for giving the software increment to the client in order for the client to see a demonstration of an implemented functionality and evaluate. The demo consists of functions that are successfully accomplished within the time-box. 2.2 Unified Modelling Language According to Whitten and Bentley’s book (2007:371), Unified Modelling Language (UML) is applied for explaining a system using objects with a set of modelling conventions. 2.2.1 Use-case Diagram 2.2.1.1 Definition A use-case diagram is a drawing which describes a system with use-cases, actors (users), and their relations with each other (Whitten & Bentley, 2007:246). 11 Figure 2.1 Use-case Diagram (Source: System Analysis & Design Methods, Seventh Edition – Whitten and Bentley, 2007) 2.2.1.2 Components 1. Use-cases Use-cases are used as a tool to describe the system functions in a manner and terminology the external users understand. A use-case illustrates the system’s single objective along with explaining the activities and user interactions when accomplishing the objective. 2. Actors Actors can trigger use-cases or system functions to do a business task. They illustrate the role of a user communicating with the system and do not represent a single individual or job title, plus they do not always 12 represent humans. Actors may be external devices, organizations, other information systems, or time. Figure 2.2 Symbol for Actors (Source: System Analysis & Design Methods, Seventh Edition – Whitten and Bentley, 2007) 3. Relationships Relationships are represented using lines between two symbols. How the lines are drawn and types of symbols they connect make a difference to the meaning of the relationships. There are five relationships to be discussed: a. Association An association depicts a relationship describing an interaction between an actor and a use-case. When an association includes an arrowhead on the end that touches the use-case, it means that the actor initiates the use-case. When an association does not include an arrowhead, it depicts an interaction between a receiver actor and the use-case. It can be either bidirectional or unidirectional. 13 Figure 2.3 Association Relationship Drawing (Source: System Analysis & Design Methods, Seventh Edition – Whitten and Bentley, 2007) b. Extends Sometimes a use-case has a complicated process. To simplify things, an extension is applied to extract the complicated process into its own use-case in order to extend the original use-case functionality. This relationship between the extension and the original use-case is called an extends. The extending use-case is the only one which can invoke the extensions. Figure 2.4 Extends Relationship Drawing (Source: System Analysis & Design Methods, Seventh Edition – Whitten and Bentley, 2007) 14 c. Uses (or Includes) Not only complex use-cases exist, but also use-cases with same functionalities. To explain these identical functionalities, a separate use-case is needed. It is called an abstract use-case. The abstract use-case depicts reusable use-cases and functions in decreasing redundancy between the use-cases. Uses, or sometimes referred to includes, explains the relationship between the abstract use-case and another use-case. Figure 2.5 Uses Relationship Drawing (Source: System Analysis & Design Methods, Seventh Edition – Whitten and Bentley, 2007) d. Depends On The depends on relationship explains use-cases that depend on other use-cases. With this relationship, the sequence of use-cases can be determined, and it is ideal for planning and scheduling. 15 Figure 2.6 Depends On Relationship Drawing (Source: System Analysis & Design Methods, Seventh Edition – Whitten and Bentley, 2007) e. Inheritance Two or more actors may have common behaviors, which mean they initiate the same use-case. An abstract actor can infer these common behaviors for the purpose of decreasing redundancy. The inheritance relationship shows two or more actors inheriting this abstract actor. Figure 2.7 Inheritance Relationship Diagram (Source: System Analysis & Design Methods, Seventh Edition – Whitten and Bentley, 2007) 16 2.2.2 Class Diagram 2.2.2.1 Definition According to Whitten and Bentley (2007:400), a class diagram has a purpose to explain objects and relationships among object classes with an illustration. The diagram involves relationships such as multiplicity, generalization/specialization, and aggregation. 2.2.2.2 Components 1. Class A class is a blueprint from which object instances with similar attributes and behaviors can be created. Classes may also have subclasses, for instance, a few people in a room are categorized as students and others as teachers. Therefore, STUDENT and TEACHER are subclasses of the same superclass, PERSON. This is called inheritance. Figure 2.8 Class and Object Instances (Source: System Analysis & Design Methods, Seventh Edition – Whitten and Bentley, 2007) 17 2. Attribute Attribute is data that describes properties of a class. It can also describe the properties of an instance of a class i.e. an object. 3. Method Method is an action that can be done by a class. It specifies behaviors that the class can take. 4. Access Modifier Access modifiers are keywords that are available in objectoriented languages which control the accessibility of classes, attributes, methods, etc. Different programming languages have different numbers of access modifiers. The four access modifiers in Java are: a. Private Items that are specified with a private access modifier are only accessible within the same class. b. Protected Protected items are accessible from within the same class, classes derived from the same class, and within the same Java package. c. Default The default access modifier is provided by Java when no access modifier is given. Items with this access modifier are accessible from within the same package. 18 d. Public Anyone can access items that are given a public access modifier. 5. Generalization/Specialization Generalization/Specialization is a method used to find and make use of the similarities between classes. Figure 2.9 Generalization and Specialization (Source: System Analysis & Design Methods, Seventh Edition – Whitten and Bentley, 2007) The classes Student and Teacher both have attributes and behaviors that are particular to them (thus, meaning they are more specialized), and they also have attributes and 19 behaviors that are common between them, inherited from the Person class. Figure 2.10 Generalization and Specialization in UML (Source: System Analysis & Design Methods, Seventh Edition – Whitten and Bentley, 2007) 6. Multiplicity Multiplicity is a property of an association between two classes that describes how many instances of a class can be associated to one instance of the associated class. As an 20 example, if there are two classes, Customer and Order, a customer can place any number of orders from 0 to a large number. The relationship is called multiplicity. Figure 2.11 Multiplicity in UML (Source: System Analysis & Design Methods, Seventh Edition – Whitten and Bentley, 2007) 7. Aggregation Aggregation is a relationship where an object is made from other objects. For example, a Course object which is made from several Student objects and a Teacher object. In this type of relationship, the contained objects are not necessarily only associated with one containing object. Figure 2.12 Aggregation in UML (Source: System Analysis & Design Methods, Seventh Edition – Whitten and Bentley, 2007) 21 8. Composition Composition is a stronger version of aggregation, where an object is made up of other objects, and the objects that are contained are only associated with one container object. In a composition, the container object is responsible for the construction and destruction of its contained objects. If the container object is destroyed, so are its parts. Figure 2.13 Composition in UML (Source: System Analysis & Design Methods, Seventh Edition – Whitten and Bentley, 2007) 2.2.3 Activity Diagram 2.2.3.1 Definition Based on Whitten and Bentley’s book (2007:390), activity diagram is a type of diagram in UML that is used to model the process steps or activities of the system. They graphically represent the flow of activities, including those that occur in 22 parallel. Activity diagrams are not always created for all use cases. Activity diagrams are usually used to better describe processes with complex logic. 2.2.3.2 Components Activity diagrams have many components that can be used to represent process steps. The basic components of an activity diagram are: 1. Initial node – a solid circle depicting the start of the process. 2. Actions – rounded rectangles representing steps in the process. 3. Flow – arrows representing the advancement through actions and direction of flow. 4. Decision – diamond shape with one flow coming in and two or more flows going out. 5. Merge – diamond shape with two or more flows coming in and one flow going out, this merges flows previously separated by a decision. 6. Fork – black bar with one flow coming in and two or more flows going out, actions on parallel can run in any order or simultaneously. 7. Join – black bar with two or more flows coming in and one flow going out, representing the end of concurrent processing. All actions coming in must be completed before processing goes on. 23 8. Activity final – a solid circle inside a hollow circle representing the end of the process. Figure 2.14 Activity Diagram (Source: System Analysis & Design Methods, Seventh Edition – Whitten and Bentley, 2007) 24 2.2.4 Sequence Diagram 2.2.4.1 Definition Whitten and Bentley (2007:394) say that, “A sequence diagram depicts how objects interact with each other via messages in the execution of a use-case or operation.” There are no alternative courses of the use-case in a sequence diagram, because it illustrates a single scenario, thus a single use-case can have several sequence diagrams. 2.2.4.2 Components Some basic components in a sequence diagram are discussed below. 1. Actor – the use-case actor is used to show the initiating actor. 2. System – the box depicts the system as a whole, abstracting away the internal workings. The colon (:) is a sequence diagram notation which illustrates a running “instance” of the system. 3. Lifelines – dashed vertical lines extending downward from the actor and system that displays the life of the sequence. 4. Activation bars – these bars are set over the lifelines to demonstrate the time period when the participant is active in the interaction. 5. Input messages – horizontal arrows drawn from the actor to the system indicating message inputs. The UML convention for messages is to use a lowercase letter as the first word, then concatenate the words with an initial uppercase for each subsequent word, without spaces. 25 6. Output messages – dashed horizontal arrows drawn from the system to the actor. The messages do not require the standard notation, though it is allowed. Figure 2.15 Sequence Diagram (Source: System Analysis & Design Methods, Seventh Edition – Whitten and Bentley, 2007) 26 2.3 Flowcharts 2.3.1 Definition Deitel (2010:57) explains on his book that, “A flowchart is a graphical representation of an algorithm or of a portion of an algorithm.” It is drawn with symbols where each of them has its own special function. Moreover, it uses flowlines – arrows in flowcharts – to connect the symbols. 2.3.2 Symbols 1. Rectangle Rectangle symbol is the action symbol which displays an action that can involve a calculation. Figure 2.16 Actions in Sequence (Source: C How to Program, Sixth Edition – Deitel, 2010) 2. Parallelogram Parallelogram symbol is the I/O symbol which shows the input the process receives and the output it gives (Hebb, 2015). 27 3. Oval Oval symbol with the word “Begin” or “Start” in it is the first symbol to be used in the flowchart. On the other hand, an oval symbol with the word “End” or “Stop” in it indicates the last symbol to be used. The small circle symbols in figure 2.16 are called connector symbols, used to omit oval symbols when the algorithm is partially drawn. Figure 2.17 Example of a Flowchart (Source: C Programming & Data Structures, First Edition – Godse, 2007) 28 4. Diamond Diamond symbol is the decision symbol showing a decision to be made. It is used for the following statements. a. if selection statement It performs an action if the condition is true. Otherwise, it skips the action. Figure 2.18 Flowchart of if Statement (Source: C How to Program, Sixth Edition – Deitel, 2010) b. if…else selection statement It performs an action if the condition true. A different action is performed if the condition is false. Figure 2.19 Flowchart of if…else Statement (Source: C How to Program, Sixth Edition – Deitel, 2010) 29 c. while repetition statement It performs an action repetitively while the condition stays true. Figure 2.20 Flowchart of while Statement (Source: C How to Program, Sixth Edition – Deitel, 2010) d. for repetition statement The statement contains initialization, loop-continuation condition, and increment. Figure 2.21 Flowchart of for Statement 30 e. do…while repetition statement This statement is similar to while statement. The difference is that in the while statement, the condition is tested at the beginning of the loop before the loop body, while in the do…while statement the condition is tested after the loop of the body. Thus, the body of the loop will be executed at least once. Figure 2.22 Flowchart of do…while Statement (Source: C How to Program, Sixth Edition – Deitel, 2010) f. switch multiple-selection statement The switch statement is used when there is a series of decisions to be tested separately and each decision takes a different action. It consists of case labels, an optional default case, and statements for each case. 31 Figure 2.23 Flowchart of switch Statement (Source: C How to Program, Sixth Edition – Deitel, 2010) 2.4 Human-Computer Interaction 2.4.1 Eight Golden Rules Shneiderman and Plaisant (2010) write eight golden rules to create a good interface. 1. Strive for Consistency Similar situations demand consistent series of actions, for example: help screens, menus, and prompts. Not only the actions have to be consistent, but the design also has to be – the capitalization, color, fonts, layout, etc. 2. Cater to Universal Usability User interface designers are required to identify different users’ needs to make a flexible design, such as age ranges, disabilities, technological diversity, and users’ skill level from novice to 32 expert. Tutorials are obligated to help novices understand, while shortcuts and faster teaching pace are much more convenient for experts. If this is accomplished, a rich interface design will be achieved and more improved system quality. 3. Offer Informative Feedback Every time a user does an action, a feedback should be provided. Limited responses are to be given for recurrent and trivial actions, whereas for uncommon and important actions, more responses are to be given. 4. Design Dialogs to Yield Closure Series of actions have to be organized into groups involving a beginning, middle, and end. After a group of actions is completed, informative feedback is to be given for a sense of relief, contentment of accomplishment, an indication to abandon contingency plans from their minds, and a signal to prepare for the next group of actions. 5. Prevent Errors When a user makes an error, give the interface the ability to detect the error. Then provide simple and explicit instructions for recovery. A user should not be allowed to make serious errors, for example: alphabetic characters allowed in a numeric entry field. Incorrect actions must not change the system state, or at least some instructions should be given by the interface on how to restore the state. 33 6. Permit Easy Reversal of Actions Users feel relieved if they know the errors that they make can be undone, and they will get to know more about unfamiliar options. The reversibility units can be a finished group of actions, a dataentry job, or a single action. 7. Support Internal Locus of Control Users like it whenever they feel that they are in charge of the interface and that their actions are given a response. They do not like monotonous data-entry series, problems in obtaining essential information, surprises in common actions, and inability to get the desired result they want. 8. Reduce Short-Term Memory Load Keep the interface simple to allow users remember information from one screen easily and use that information on another, because humans have a limit for processing information in shortterm memory. Not to mention that multiple-page displays are required to be consolidated, and enough training time should be given for complicated series of actions. 2.5 Generations of Programming Languages According to Zelkowitz (2008:6), “Programming languages are defined as ‘any of various languages for expressing a set of detailed instructions for a digital computer’.” There are four generations of programming languages: 1. First Generation The first generation was vacuum tube computers which only had a machine language as their programming language from 1940 – 1950. 34 These computers include Electronic Numerical Integrator and Calculator (ENIAC), Electronic Discrete Variable Computer (EDVAC), Universal Automatic Computer (UNIVAC), and Mark I, II, and III. 2. Second Generation The second generation was transistorized computers that had an assembly language as their programming language from 1950 – 1964. During this time, programming languages started to appear, such as Flowchart Automatic Translator (FLOWMATIC), Algorithmic Language (ALGOL), Jules Own Version of the International Algorithmic Language (JOVIAL), and List Processing Language (LISP). 3. Third Generation Language (3GL) Based on Morley’s book (2014:533), the third generation is high-level languages which are closer to natural languages and are machine independent. The examples are Visual Basic, C++, C#, Java, Python, and Ruby. Some of the languages are regarded as visual programming languages, meaning that visual elements can be used to make a program instead of textual code. Scratch is an example of a visual programming language. 4. Fourth Generation Language (4GL) The fourth generation is at an even higher level than 3GLs. The languages are declarative, not procedural like 3GLs. The computer is told what to do in place of how to do it. 4GLs are usually used to access databases, for instance, Structured Query Language (SQL). 35 2.6 Mobile Application 2.6.1 Definition According to Fling (2009:3), a mobile application is an application that lets users look for information that they can access anywhere and anytime. Mobile applications are specifically designed for mobile devices, for instance a smartphone. 2.6.2 Mobile Operating System Here are some common operating systems that are discussed in the book (Fling, 2009:22). 1. Android Android is an open source operating system from Google that is able to be customized by operators and manufactures. 2. Linux Linux is another open source operating system increasingly used to power smartphones. 3. Mac OS X Mac OS X is specialized into iOS which is used by Apple’s iPhone and iPhone touch. 4. Palm OS Palm operating system that runs in Palm’s lower-end Centro line mobile phones. 5. Symbian Symbian is also an open source operating system and designed for mobile devices. 6. Windows Mobile Windows Mobile is a mobile operating system that utilizes the Windows Mobile platform. 36 2.7 Particular Theories 2.7.1 Android 2.7.1.1 Definition Based on Burnette’s book (2010:10), “Android is an open source software toolkit for mobile phones that was created by Google and the Open Handset Alliance. It’s inside millions of cell phones and other mobile devices, making Android a major platform for application developers.” Ars Technica (Amadeo, 2014) wrote an article that explains the history of Android, from the very first version to KitKat. 1. Android 0.5 Milestone 3 Android was announced in November 2007. Generally, Milestone 3 was controlled with a five-way d-pad. Animations could be done and remarkably multitasking and background applications already worked in this version. The application could already save state instead of closing it when a user leaves the application. 2. Android 0.5 Milestone 5 Milestone 5 was released in February 2008. Google redesigned the interface and renewed the artwork. This version was the first build with a dialer, but was not so different from Android’s first release. 3. Android 0.9 Beta Android 0.9 was released in August 2008. Google redid the artwork again in full-color. This was the first version to have a fully customizable home screen and OS-level copy/paste 37 support, plus it had a very basic lock screen. Not to mention that it had a horizontal support. 4. Android 1.0 Android 1.0 launched in October 2008 and debuted on the TMobile G1. It was the first time for Android to run on hardware, not emulators. Google’s store made its debut here, called “Android Market”. A settings screen and pattern lock screen were brought to this version. 5. Android 1.1 Android did its first public update in Android 1.1 in February 2009. The operating system did not change much. Android made its first attempt of voice search with Google Voice Search. Just speak and Google Search would show some results, but the application is not able to communicate with Google’s servers anymore. 6. Android 1.5 Cupcake Google released the first Android version with a public marketed code name: Cupcake in April 2009. On-screen keyboard is added and one of Android’s distinguishing features debuted here, which is third-party widgets. In addition, video recording and auto-rotate were brought to this version. 7. Android 1.6 Donut Android 1.6 launched in September 2009. In this version, different screen sizes are supported, along with Code Division Multiple Access (CDMA) and a text-to-speech engine. Other than that, 38 Android Market included application screenshots, and Donut was the first version to control battery usage. 8. Android 2.0 – 2.1 Éclair Android 2.0 launched in October 2009. There was a new lock screen and Google invented an arc unlock gesture which allows users to unlock by putting their finger on the lock icon then slide right. The artwork was redesigned and Google Maps Navigation was updated. 9. Android 2.2 Froyo Froyo was released in May 2010. There was a major improvement with the speed performance in Froyo. A just-in-time (JIT) compilation is added that functions to convert java bytecode into native code automatically at runtime. 10. Android 2.3 – 2.3.7 Gingerbread Android 2.3 was released in December 2010. Every screen in the operating system was changed. Gingerbread launched in Nexus S. It was the first flagship without MicroSD slot for Google and the first phone with Near Field Communication (NFC), a chip that has the ability to transfer information when touched to another NFC chip. 11. Android 3.0 – 3.2 Honeycomb Honeycomb was the first version to get a cohesive and full redesign. It got released in February 2011. The design theme they used was sci-fi, inspired by the movie “Tron”. A system bar is added and the unlock screen got changed to a rotary unlock. Users can swipe from the center outward in any direction to unlock the 39 screen. In here, “Fragments” API got introduced. Fragments gave developers the ability to create just a single app for tablets and phones. 12. Android 4.0 – 4.0.4 Ice Cream Sandwich Ice Cream Sandwich got released in October 2011. The design became less sci-fi. Data Usage is provided to let the users keep track of their data usage efficiently. Ice Cream Sandwich fully supports NFC. 13. Android 4.1 – 4.3 Jelly Bean Jelly Bean got released in July 2012. An addition of the new Google Search application happened here. “Google Now” was introduced as the predictive search feature. The lock screen became paginated and customizable with widgets. A new “Quick Settings” panel was another big addition to this version. Multiple users support was available here, plus a keyboard that has swiping abilities which allows users to keep a finger on the screen and slide from letter to letter to type. 14. Android 4.4 KitKat KitKat launched in October 31, 2013. Google started “Project Svelte” attempting to lower memory usage. The design theme they used was brighter and more transparent. Configurable home screen was added along with Google Drive that lets users create and edit Google Docs. There was also “OK Google” that could activate voice commands just by saying “OK Google” on the home screen. 40 Ars Technica (Amadeo, 2014) wrote another article about the latest Android version. 15. Android 5.0 Lollipop Lollipop implements a new design called “Material Design”. More animations can be seen, and notifications are visible on the lock screen, plus Recent Apps functionality got changed which makes multitasking easier. Another feature added is the voice recognition that can work while the screen is off. They also did another project named “Project Volta” that aims to improve battery life. 2.7.1.2 Android Architecture Figure 2.24 Android Software Stack (Source: Hello, Android – Introducing Google’s Mobile Development Platform, 3rd Edition – Burnette, 2010) Burnette (2010:31) explains on his book that the Android software stack is made up of architecture that has key layers and components. 41 The services provided by the bottom layer are used by the layer above it. The layers will be discussed starting from the bottom. 1. Linux Kernel Android has a solid foundation referred to as the Linux kernel. The hardware abstraction layer for Android is provided by Linux, which gives Android the ability to be ported to various platforms. Linux is used to manage memory and process, including networking and security restrictions, plus other operating system services. Linux is not visible and programs do not call it directly, but developers should know that it exists since they need to interact with it for some utilities. 2. Native Libraries The layer above Linux consists of Android native libraries. They are written in C or C++, compiled according to the appropriate hardware architecture the phone has, and the phone vendor is the one that preinstalled them. Here are some of the most essential native libraries: a. Surface manager Android has a more uncomplicated compositing window manager that is very much alike Vista or Compiz. It does not draw directly to the screen buffer, but the drawing commands advance into bitmaps which are off the screen and afterwards they are combined with other bitmaps to create the display for the user to see. The system can make kinds of interesting effects through this. b. 2D and 3D graphics (OpenGL) In a single user interface, 2D and 3D elements are able to be combined with Android. 3D hardware is to be used if the device has it. If not, a fast software renderer will be used instead. 42 c. Media codecs (Media Framework) Various formats of audio and video, AAC, AVC (H.264), MP3, MPEG-4 and many more are able to be played, recorded and played back by Android. d. SQL database Android contains SQLite database engine that is used for persistent storage in an application. e. Browser engine Android has the WebKit library which functions to display HTML content. The libraries are not stand-alone applications and will be used by higher-level programs. 3. Android Runtime The Android runtime layer is also above Linux. It involves Dalvik virtual machine and core Java libraries. Google implemented Java through the Dalvik VM which is optimized on mobile devices. The codes written in Android are in Java and run within the VM. There are two things that make Dalvik different from traditional Java: a. The Dalvik VM runs .dex files which are more compact and efficient than the standard .class and .jar files. b. The core Java libraries in Android differ from the Java Standard Edition (Java SE) and the Java Mobile Edition (Java ME) libraries. 43 4. Application Framework The layer above the native libraries and runtime is the application framework. The high-level building blocks for building applications are provided by the framework. It is preinstalled with Android but also extendable with custom components. The important components of the framework are: a. Activity manager The application life cycle is controlled by the activity manager. b. Content providers These encapsulate data to be shared from one application to another. For example: contacts. c. Resource manager Resources are information that is not code needed by a program. d. Location manager Android devices know their location at all times if location services are not turned off. e. Notification manager Android can display events, for instance, alerts, appointments, and incoming messages in an unobtrusive way. 5. Applications and Widgets This is the highest layer that the users will only see. They do not know what is happening on the bottom layers. Applications 44 control the whole screen to interact with them, while widgets operate in a small area of the Home screen. 2.7.1.3 Android Lifecycle Figure 2.25 Android Activity Lifecycle (Source: Introduction to Android™ Application Development, Fourth Edition – Annuzzi, 2014) 45 According to Annuzzi’s theory (2014:101), Android activity lifecycle involves these six points: 1. Initializing Static Activity Data in onCreate() This method is called when an activity starts for the first time. It has a single parameter, a bundle containing null if it is a brand new started activity. When the activity gets killed and restarted, the bundle will now contain information about the previous state to allow the activity to reinitiate. Setup like layout and data binding should be performed in this method, which includes calling the setContentView() method. 2. Initializing and Retrieving Activity Data in onResume() This method is called when the activity becomes the foreground process after reaching the top of the activity stack. It is the best moment to get back the resources instances required for the activity to run even though the activity may not be visible yet. 3. Stopping, Saving, and Releasing Activity Data in onPause() If another activity goes to the top of the activity stack, the onPause() method tells the current activity that another activity has taken its place. Resources such as audio, video, and animations which started in the onResume() method are to be stopped. However, if the current activity gets terminated, there may be resources that need cleaning up so they can be released. It is also required to save uncommitted data in case the application does not resume. The new foreground activity does not start before the onPause() method of the old activity returns. 4. Avoid Activities Being Killed Android may kill an activity process that has been paused, stopped, or destroyed in case the memory condition is low. In 46 other words, activities which are not the foreground are possible to be shut down. The onStop() and onDestroy() methods are not called provided that the activity is killed after onPause() method. 5. Saving Activity State Into a Bundle with onSaveInstanceState() A vulnerable activity that is possible to be killed assuming that the memory is low may have its state information saved to a bundle with the onSaveInstanceState() method, but for important data commits, make sure to use the onPause() method. Therefore, onSaveInstanceState() is able to restore the current screen to its previous state. 6. Destroying Static Activity Data in onDestroy() The onDestroy() method is needed to destroy an activity during a normal course of operation. This method may be called for two reasons: either the activity is finished with its lifecycle voluntarily or Android is killing the activity to get more resources. 2.7.2 Java 2.7.2.1 Definition According to Gosling (2015:1), Java is a programming language that is general-purpose, concurrent, class-based, and object-oriented. It is designed to be easily learnable so that programmers can achieve fluency when using the language. 2.7.2.2 Java in Android Based on Burnette’s book (2010:278), the regular Java and Java in Android are different in a certain way. A standard Java compiler is used by Android, but the difference is that Android does not support all Java SE libraries. In fact, some of them 47 were excluded and the Android SDK provides useful third-party libraries, for instance, org.apache.http which is useful for HTTP authentication, cookies, methods, and protocol. 2.7.3 Android Studio Android Studio is the official integrated development environment (IDE) by Google, used to develop Android applications based on IntelliJ IDEA (Google Team, 2015). Android Studio provides an intelligent code editor that is able to complete, refactor, and analyze advanced code. Starting a new project gets easier because template code for patterns is provided, for example, navigation drawer and view pagers. It is also possible to import Google code samples from GitHub. In addition, Android Studio enables a multi-screen application development with the new Android Project View and module support, along with the updated and streamlined Virtual Device Manager which provides pre-defined device profiles for popular Android devices. Other than that, it is feasible to create various APKs for an Android application with different features using the same project. 48