Showing posts with label Object-Oriented Programming. Show all posts
Showing posts with label Object-Oriented Programming. Show all posts

Thursday, May 10, 2012

Object-oriented design & programming

"Object-oriented programming - Wikipedia, the free encyclopedia" ( http://bit.ly/cLXHSq )

"Object-oriented design - Wikipedia, the free encyclopedia" ( http://bit.ly/cbnJAY )

Tuesday, March 27, 2012

Inheritence

When once class is derived / extended / inherited from another class, this relationship is said to be 'Inheritance'.

In Java, the extends keyword is used in the class declaration to implement inheritance.



"Inheritance (The Java™ Tutorials > Learning the Java Language > Interfaces and Inheritance)" ( http://bit.ly/OgTDmk )

"Is-a - Wikipedia, the free encyclopedia" ( http://bit.ly/JWeeX1 )

An example class diagram.



Monday, March 19, 2012

CodePlay - The Computer Scientist

What is a Class? What is an object?

A class is a definition of all state/attributes & behavior belonging to an entity. The following figure is a UML class diagram for an entity called Player. The middle compartment lists each state/attribute of Player and the bottom compartment lists each behaviour of Player.

UML class diagrams are used to design classes. This design is then used to inform the code. It's like a blueprint for building a house.

Objects are created from classes - many objects may be created from a single class - in the same way as one blueprint can build many houses. The following figure is a UML object diagram showing the Player class along with 3 Player objects.

Notice that while each object has a strength and agility attribute, the values for these attributes are unique from object to object. From this diagram, we can see the state of each object.

The behaviours are not listed in the object diagram because all objects share the same behaviours.

"What Is a Class? (The Java™ Tutorials > Learning the Java Language > Object-Oriented Programming Concepts)" ( http://bit.ly/FUAjmF )

What is an object?

"What Is an Object? (The Java™ Tutorials > Learning the Java Language > Object-Oriented Programming Concepts)" ( http://bit.ly/zwj1iO )