Commit 73c9016b authored by michael lundquist's avatar michael lundquist
Browse files

Some spell checking and dense notes.

parent 31e68cf5
......@@ -671,7 +671,7 @@ public class InputExample{
### 1.9.2 Pseudocode
- Before writing code, programmers often write __pseudocode__ to explain the algorithm in a simple, code like, terms that they can folllow as they implement their code.
- Before writing code, programmers often write __pseudocode__ to explain the algorithm in a simple, code like, terms that they can follow as they implement their code.
- Pseudocode should include:
- __Expressions__ (like ==)
......@@ -691,11 +691,11 @@ public class InputExample{
- *IDEs* are a thing
- you have to compile .java files into .class files (or a .jar package)
- the commandline command for this is `javac`, or use an IDE's run buttons
- the command line command for this is `javac`, or use an IDE's run buttons
- compiling can identify syntax errors.
- use the `java` commandline command to run a .class file, or use an IDE's run buttons
- When running `java`, java searches the __CLASSPATH__ envoronment variable to find the class's name you passed as an argument. Generally starting the search with the current directory.
- use the `java` command line command to run a .class file, or use an IDE's run buttons
- When running `java`, java searches the __CLASSPATH__ environment variable to find the class's name you passed as an argument. Generally starting the search with the current directory.
### 1.9.4 Documentation and Style
......@@ -743,7 +743,7 @@ public class InputExample{
- __bottom-up__: starts at lower level classes and methods before testing higher levels.
- aka *unit testing* as the functionality of a specific component is tested in isolation of the larger software project.
- We [discussed how the main method can be used for testing](#Unit-Testing), but testing with the main method is crude. These days, we use frameworks like [junit](www.junit.org) to test. Junit sopports grouping individual tests into larger test suites, and provides support for executing those suites, and reporting or analyzing the results of those tests.
- We [discussed how the main method can be used for testing](#Unit-Testing), but testing with the main method is crude. These days, we use frameworks like [junit](www.junit.org) to test. Junit supports grouping individual tests into larger test suites, and provides support for executing those suites, and reporting or analyzing the results of those tests.
- As software is maintained, *regression testing* should be performed to ensure new changes don't break previously tested components.
#### Debugging
......
# Object-Oriented Design
## 2.1 Goals, Principles, and Patterns
- In object-oriented programming, *objects* are *instances* of *classes*.
- These classes typically specify:
- *data fields*, which become *instance variables* in the object.
- *methods* that the object can execute.
### 2.1.1 Object-Oriented Design Goals
- goals:
- robustness
- adaptability
- reusability
#### Robustness
- __Robustness__: the ability to handle unexpected inputs
- this is especially important in *life-critical applications* that can result in injury or death if they fail.
#### Adaptability
- __portability__: the ability to run with minimal change on different hardware and OSs. Java inherently provides portability.
- __adaptability__: the ability to adapt to changing conditions in the environment.
- aka __evolvability__
- adaptability is often a byproduct of portability
#### Reusability
- __reusability__: the ability to use a component across different systems in various applications.
- reusable code is an asset to a company.
- reusable code in inherently portable and adaptable.
### 2.1.2 Object-Oriented Design Principles
- To achieve the above stated goals, OOP uses:
- Abstraction
- Encapsulation
- Modularity
#### Abstraction
- __abstraction__: distilling a complicated system down to its most fundamental parts.
- __interface__: A java type that contains a list of method declarations, where each method has an empty body.
- interfaces are parallelled in math by *abstract data types* (ADTs). ADTs, like interfaces, specify a data structure that specifies the type of data stored, the operations supported on them, and the types of parameters of the operations. The ADT specifies *what* each operation does, but not *how* it does it.
- To implement an interface, you must use a *class* that follows some specific syntax (section 2.3.1) and declares all the methods in the interface (possibly while adding its own methods), providing a body for them.
#### Encapsulation
- __Encapsulation__: classes should hide their inner workings, and only provide the expected functionality.
- Achieved with access modifiers.
- Encapsulation allows a programmer to change the inner workings of a class without affecting users so long as the public interface remains the same.
- encapsulation yields robustness and adaptability, for it allows the implementation details of parts of a program to change without adversely affecting other parts, thereby making it easier to fix bugs or add new functionality with relatively local changes to a component.
#### Modularity
- __Modularity__: A way of organizing code so components of a system each perform their own, separate function and work together to perform a larger function.
- modularity makes testing easier because tests are smaller and hence makes your code more robust.
### 2.1.3 Design Patterns
- __Object-oriented design patterns__ provide a general template solutions for many problems that are concise, correct, and reusable.
- These design patterns consist of:
- a *name*
- a *context* in which to apply the pattern
- a *template* to show how the algorithm is applied.
- a *result* to show what the algorithm produces
- This book presents 2 groups of design patterns:
1. patterns for solving algorithm design problems including:
- Recursion (Ch 5)
- Amortization (Sections 7.2.3, 11.4.4, and 14.7.3)
- Divide-and-conqure (Section 12.1.1)
- Prune-and-search, aka decrease-and-conqure (Section 12.5.1)
- Brute force (Section 13.2.1)
- The greedy method (Sections 13.4.2, 14.6.2, and 14.7)
- Dynamic programming
2. patterns for solving engineering problems:
- Template method (2.3.3, 10.5.1, and 11.2.1)
- Composition (Sections 2.5.2, 2.6, and 9.2.1)
- Adapter (Section 6.1.3)
- Position (Sections 7.3, 8.1.2, and 14.7.3)
- Iterator (Section 7.4)
- Factory Method (Sections 8.3.1 and 11.2.1)
- Comparator (Sections 9.2.2, 10.3, and Chapter 12)
- Locator (Section 9.5)
## 2.2 Inheritance
-
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment