Joyce Farell development cycle: 1) Understand the problem; 2) Plan the logic; 3) Write the code; 4) Translate the code; 7) Test the program; 8) Put the program into production; 7)
Maintain the program.
Cay Horstmann development process: 1) Understand the problem; 2) Develop and describe an algorithm; 3) Test
algorithm with simple inputs; 4) Translate algorithm; 5) Compile and test the program.
Algorithm: A solution to a problem, as a sequence of steps initiated with one starting point, and finishing at one exit
point. Computer programs are algorithms, and each step is referred to as a statement.
Pseudocode and Flowcharts: Use to plan an algorithm. UML class diagrams: blueprints for objects which are used by
programmers who are using an OOP language.
Imperative programmers: OPP and PP are imperative because they are required to detail how the program will
process data to get to the result. Declarative programmers: SQL is declarative because it requests the software to
provide a result and the software determines how to get the result.
API documentation (Modules and Packages): Modules are ways to organize packages, and packages are a way to organize classes. Java. Lang
(imported automatically) classes are used in all Java programs like String. Java. Util (imported explicitly) classes that provide miscellaneous
utilities like Scanner.
Methods: a way to break large sequences of processing steps, into smaller, re-usable units (functional decomposition). Unlike variables, which are
a named place (named as a thing [noun]) in the computer’s memory that stores a value, a method is a named place (named as an action [verb]) in
the computer’s memory that contains processing steps. Calling methods can be documented like an external method call. Method overloading:
occurs when two methods have the same name, but different signatures (type and the number of parameters). The compiler uses the parameters
to determine which method to use. Work methods: Methods inside a class that perform calculations or provide a service. Modularization: allows
abstraction (a method name represents processing, making it easier to program at a higher level), the ability of multiple programmers to work on different parts of a program at the
same time, and code reuse. Its only drawback is overhead: modules use more resources (memory, processing) than just coding steps.
Parameters: The data types and variable names are defined as part of the method definition (where data can be provided to the method). Arguments: Data passed to a parameter
within the parameters list.
Class: a class is a blueprint for an Object. We use a class to construct objects in the computer’s memory. Object: An object is an allocation of memory that contains properties (data
stored in attributes) and behaviors (methods that perform processing on the data inside the object). Through objects, we can break a problem’s solution into many smaller parts.
The public methods of a class are collectively referred to as its public interface. Constructors: a method used to instantiate an object based on the class definition. They require the
“new” operator to work. The “new” operator does not return the object, it returns a reference to the object in memory. Typically, constructors are overloaded. The public methods
of a class are collectively referred to as the public interface of the class.
Accessors: A method that returns a value held in an object and that does not change the state of the object. Mutator: A method that does not return a value but modifies the state
of the object.
Variables: [modifiers][data type][identifier][assignment operator(=)][initial value]. A variable identifier must start with a letter or underscore character. Special characters or the
$ symbol are not allowed. The assignment operator is right-associative. Before we can use a variable, we must initialize it. This can be done on the same line or on different lines.
Constant: A constant is a variable that has been constrained so that once a value is set, it cannot be changed. Constants in Java are declared by adding the keyword ‘final’ in front of
the data type.
Static class: Static members belong to a class and they are used at the class level, not at the object level. The keyword static is used
to indicate that a variable is part of the class. Utility methods that do not use any of the instance variables can also be labeled as
static (like the main method). Statics variables are allocated into memory once and each object instantiated from the class shares a
copy of the static member in memory. The Java Virtual Machine performs a lot of work when we use a static class member. We can
use a static member in an instance member, but we cannot use an instance member inside a static member.
Reference types VS primitive types: A Primitive type stores the value directly in the memory the variable represents. Primitive
types are stored in separate memory locations, independent of each other. Reference type stores a reference-to-an-object in
memory, but it does not store the object itself. The memory location assigned to a reference type doesn’t store its actual value, it
stores a reference to the position (address) in memory where the value of the object is located.
Scanner: private Scanner scanner = new Scanner (System.in); next() will read in text
data until it encounters any whitespace character, then it will return the next data up to
the whitespace. nextLine() will read in all the data until it encounters a line terminator
character (enter key). Use nextLine () when asking a user to enter the full name on one
line. nextLine () is not good when asking a user to enter numbers and text one after the
other. nextInt () and nextDouble ()stop, when they encounter an enter key character in
the input but don’t remove it. nextLine () reads in data and exits immediately when it
sees \n, if nextInt() or nextDouble() were used first, nextLine see’s the removes the
, and returns an empty String. The result is the program skips an entry and the user cannot type anything in. The fix is to call nextLine () immediately after any call to nextInt() or
nextDouble().
Unified Modeling Language: a UML Class diagram is a type of UML diagram that represents a design for a class and is not language specific. They can also include the data types
and go after each identifier: .
Instance variables: are declared at the class level, and exist in memory while the instance exists in memory.
Access modifiers: We cannot use the access modifiers inside a method, local scope variables, including parameters are implicitly private to that method.
This keyword: When the program is running, ‘this’ is made to reference an object from the inside. There are two uses for this: 1) To call another constructor internally. 2) To resolve
the scope, between instance variables at the class level, and local-scope variables at the method level that have the same name. Scope: The visibility of a variable, depends on