GEEN165 Vocabulary
Abstraction
separating implementation from use
One of the 4 pillars of Object Oriented Programming
separating the method use from the method implementation
Methods
a collection of statements that are grouped together to perform an operation
Method Signature
method name + parameter list formal parameter used at the method declaration pass by value
Method Overloading
two or more methods with the same name but different signatures
Method Abstraction
separating the method use from the method implementation
Array
a sequence of variables of the same data type
Class
a class is a blueprint for building an object
Constructor
special method used to construct an object
- no return type
- default constructor default created by Java Virtual Machine
-no dry contractor w/o parameter
2nd Pillar of OOP Encapsulation
making peripheral (private + public) providing mutator + accessor methods
accessor methods - getMethod
mutator - setMethod
Instance Variable
is a variable defined in a class for which each instantiated object of the class has a separate copy, or instance.
Class Variable (static)
share all instances of a variable
Static Method
can be called w/o instantiating a object of the enclosing class type
Variable Scope
area where a variable should be accessed
Class Contract
public methods + constants defined in the class
Local Variable(scope)
from where it is defined to the end of the enclosing block
Static Methods
can not access instance variables
cohesion
a class should describe a single entity
Consistency
follow standard varying conventions & programming style
Clarity
achieved through cohesion
constructor & encapsulation
impose no restrictions on what or when a user can do with a class
Completeness
provide a variety of way for customization through properties and methods
Consistancy
follow standard programming style and naming conventions
Polymorphism Requirements
-classes are in the same heirarchy
-all subclasses override the same method
-subclass object reference is assigned to a superclass object reference
-superclass object refeered is used to call the overridden method
Benefits of polymorphism
use the same method call for any object in the hierarchy using the superclass reference object
4th Pillar of OOP: Polymorphism
-Inheritance object at a sublclass is also an object of any of its superclass
-concept is the basis for an important OOP feature
-simplifies the processing of various objects in the same class hierarchy because we can use the same method call for any object in the hierarchy using the super class reference object
Super
- calls the overwritten or superclass
Subclass of abstract class
-can implement all, some, or not of the abstract methods
-it doesn't implement all abstract methods, it must be declared as abstract
Superclass
pass down information to the subclass
Protected
accessed directly to the subclass from the superclass
breaks encapsulation
faster by accessing directly
Abstract Method
-pattern by a method the subclass shows implement
-can only be declared w/in a abstract ckass
-must consist at a method header by "j"
-cannot be called
Super()
call the immediate superclass constructor
toString Method
method is in the object class
sublclass
get info from the superclass
abstract class
-class not completely implemented
-specifies API but doesn't provide implementation
-cannot initiate objects, but can be declared
Ex: Figure C = new Circle();
Rules for Abstract
-Abstract can be extended subclass complete implementation
-to declare a class a abstract include keyword abstract
-to declare method as abstract include abstract in the method header
Ex: accessModifer abstract ReturnType methodName (something) list);
OOD
Object Oriented Design
OOP
Object Oriented Programming
Actual Parameters
call the method
Ex: int x = sumValues (100,200);
AP is................................^
ArrayList
ArrayList <variableName> typeofclass
Ex ArrayList<Engine> engine;
Class variables
defined in the class of which a single copy exists
3rd Pillar of OOP: Inheritance
-organize classes into hierarchies of functionality
-class at the top of hierarchy(super class) defined instances variables + methods common to all classes
-derive subclass, which inherit behavior + from the super class(Passing down)
ODD Cohesion
a class should describe a single entity
Java Virtual Machine(JVM)
designed to be portable
Formal Parameters
-declared at the beginning
Ex: Public static int sumValues(int startVal, int endVal)
2nd Pillar of OOP Encapsulation
-making properties private
hides detail
UML Diagram
A class diagram
Modifiers to code
-method signature
-parameter list
-method name
-return value style
Index
-numeric association to an element in a collection of data
dot operator(.)
-used to call method of an object of that class
Instance Method
defined in a class which is only accessible through the object of the class
Immutable class
Make all properties private
Provide no mutators/setter methods
no accessor methods for reference types
class abstraction
separating implementation of the class from the uh of the class(Sorry)
Arrays
-static
ex autoMobiles = new Auto[100];
value = list[I];
Ambiguous invocation
sumValues(int b, int c)