OO101 Part 2 - Key Concepts

Comments

Blue Nile Reviews & ratings to help you decide before purchasing Blue Nile diamonds. Write your own Blue Nile feedback here.

Posted By: Blue Nile Reviews On: 03/12/11 12:58 PM

Find objective James Allen Reviews, compare James Allen vs Blue Nile, and write your own James Allen review right here.

Posted By: James Allen Reviews On: 03/12/11 12:59 PM

thanks ..Thence, you could buy essay t..o be successful.

Posted By: منتديات On: 06/03/11 9:15 PM

Add Comment

Comments have been closed.

Transcript

no image

Slide Text

Slide Notes


Slide 1


OOP 101
John Whish
25.03.2009

no notes exist for this slide

Slide 2


Beans Means...
The term bean simply refers to an object that holds data which is available via getters and setters.
A Value Object (aka Data Transfer Object) is a bean
A object with behaviour is a bean
A static class is not a bean (doesn't hold data)

no notes exist for this slide

Slide 3


UML
UML stands for Unified Modeling Language
It is a visual way of designing applications without writing code.
There are multiple types of diagram, we will be using the class diagram in this presentation.
So what does it look like?

no notes exist for this slide

Slide 4


UML Class Diagram
You can...
Omit the return type if it is "void"
Specify arguments and their data type

no notes exist for this slide

Slide 5


Encapsulation
Basically encapsulation means hiding the inner workings of your class. 
Advantages
The calling code doesn't know about the implementation or the data that is being manipulated only the methods available.
This means that you can completely change the code in your class without it affecting any calling code.

no notes exist for this slide

Slide 6


Inheritance
Inheritance allows sub (or child) classes to inherit all the properties and methods of the super (or base) class.

no notes exist for this slide

Slide 7


Inheritance
Let's model this with some code!

no notes exist for this slide

Slide 8


Interfaces & errr Interfaces
It is important to note that there are two different uses of the word "interface". Don't confuse the two (like I did when I started learning OO)
An interface is the public methods of your class. You can think of the interface as the API.
An interface also refers to a definition of the methods your class must have. This type of interface (cfinterface) ensures that all classes that implement the interface have the same method signatures.

no notes exist for this slide

Slide 9


Method Overriding
With Inheritance you may end up in a situation where an inherited method needs to work differently in a particular sub class.
 
Let's look at a contrived example!

no notes exist for this slide

Slide 10


Method Overriding
BookProduct.getSku() could use the ISBN

no notes exist for this slide

Slide 11


Talking to your parents is super
When you override a method, you may want to be able to access the original method in the super class.
You can not access the super method from outside your object.
Let's look at an example

no notes exist for this slide

Slide 12


Composition
An object can be made up of other objects.
For example, a (typical!) car consists of:
4 wheels
1 engine
4 seats
etc
 
The car object, needs the other objects to work. It is the composition of it's parts.

no notes exist for this slide

Slide 13


Composition
In our on-line shop, the Product is composed of a Supplier. This is indicated with a solid diamond.

no notes exist for this slide

Slide 14


Aggregation
Aggregation is the weaker form of Composition, where the object doesn't need the other objects to work.
A Car can have an driver, but it can still exist without one.

no notes exist for this slide

Slide 15


Aggregation
A Shopping Basket is aggregated with Product

no notes exist for this slide

Slide 16


Polymorphism
Polymorphism is a really powerful and useful aspect of writing OO code.
It simply means that you can substitute objects which have a common super class and the code will still work.
Sounds good? Let's see it in action by adding our DVD and Book Products to a Basket which expects a Product.

no notes exist for this slide

Slide 17


Resources
This presentation and code samples can be seen at:
http://www.aliaspooryorik.com/presentations/oo/part2/

no notes exist for this slide

Slide 18


Any Questions?
 

no notes exist for this slide