CS3500 Object Oriented Design
int
32-bit signed integer
Disk drive
Permanent Memory
Short
a 16-bit signed integer
Encapsulation
- Combining everything necessary for a cohesive entity (data + operations) into a class - Hiding all the (bitter) details within a capsule - Classes that represent self-complete entities = good encapsulation
The Object Model
- Each object has a STATE and BEHAVIOR - The STATE OF AN OBJECT: - Each object has some data associated with it -Values of that data together decide the "state" of the object - BEHAVIOR OF THE OBJECT: - Each object has capabilities to operate on its or other data -"Behavior" changes "state"
3 Main features of Object Oriented Programming
1. Encapsulation 2. Inheritance 3. Polymorphism
2 Types of Polymorphism
1.Static Polymorphism (compile time polymorphism/ Method overloading) 2.Dynamic Polymorphism (run time polymorphism/ Method Overriding)
long
64-bit signed integer
Component
A component is a logical grouping of objects. They have a well-define purpose and functionality. Completes a task by using its own functionality, or delegating to other components.
Information Hiding
Hiding all the details that are not necessary to use the object (Access Modifiers: private, protected, public default)
Polymorphism
In Core, Java Polymorphism is one of easy concept to understand. Polymorphism definition is that Poly means many and morphos means forms. It describes the feature of languages that allows the same word or symbol to be interpreted correctly in different situations based on the context. There are two types of Polymorphism available in Java. For example, in English, the verb "run" means different things if you use it with "a footrace," a "business," or "a computer." You understand the meaning of "run" based on the other words used with it. Object-oriented programs are written so that the methods having the same name works differently in different context. Java provides two ways to implement polymorphism.
Encapsulation
Means putting together all the variables (instance variables) and the methods into a single unit called Class. It also means hiding data and methods within an Object. Encapsulation provides the security that keeps data and methods safe from inadvertent changes. Programmers sometimes refer to encapsulation as using a "black box," or a device that you can use without regard to the internal mechanisms. A programmer can access and use the methods and data contained in the black box but cannot change them.
Decoupling
Objects should use each other only when needed. Bad/Low decoupling: State of one object being manipulated directly within several objects
Cohesion
Objects that represent an entity should contain all the functionality within it for that entity (and nothing else)
RAM
Temporary memory RAM doesn't cool system (well defined boundary)
Byte
an 8-bit signed integer
Static Polymorphism
(compile time polymorphism/ Method overloading) The ability to execute different method implementations by altering the argument used with the method name is known as method overloading. When you properly overload a method, you can call it providing different argument lists, and the appropriate version of the method executes.
Dynamic Polymorphism
(run time polymorphism/ Method Overriding) When you create a subclass by extending an existing class, the new subclass contains data and methods that were defined in the original superclass. In other words, any child class object has all the attributes of its parent. Sometimes, however, the superclass data fields and methods are not entirely appropriate for the subclass objects; in these cases, you want to override the parent class members.
The Object Model (outside software)
- We think of computers as "one unit" - Set of components working together - A well defined purpose (e.g. RAM: temp memory) -A well-defined boundary (e.g RAM doesn't process)
Notes?
An object is an instance of a class. Encapsulation provides the security that keeps data and methods safe from inadvertent changes. Inheritance is a parent-child relationship of a class which is mainly used for code reusability. Polymorphism definition is that Poly means many and morphos means forms. Using abstraction one can simulate real world objects. Abstraction provides advantage of code reuse Abstraction enables program open for extension
Object
An object is the basic "functional unit" in the object model. It has a singular, well-defined purpose. Communicates with other objects by passing messages (i.e. calling methods)
Inheritance
the ability to create classes that share the attributes and methods of existing classes, but with more specific features. Inheritance is mainly used for code reusability. So you are making use of already written the classes and further extending on that.