What does it mean to be ``object-oriented''? The ``big three'' concepts are encapsulation, polymorphism, and inheritance, but the text ``Fundamentals of Object-Oriented Design in UML''  specifies that the following criteria are necessary for a language to be considered object oriented.
- Encapsulation - the grouping of related ideas into unit. Encapsulating attributes and behaviors.
- Inheritance - a class can inherit its behavior from a superclass (parent class) that it extends.
- Polymorphism - literally means ``many forms''.
- Information/implementation hiding - the use of encapsulation to keep implementation details from being externally visible.
- State retention - the set of values an object holds.
- Oject identity - an object can be identified and treated as a distinct entity.
- Message passing - the ability to send messages from one object to another.
- Classes - the templates/blueprints from which objects are created.
- Genericity - the construction of a class so that one or more of the classes it uses internally is supplied only at run time.
- Test here
- More testing here
The grouping of related items into one unit.
- One of the basic concepts of OO.
- Attributes and behaviors are encapsulated to create objects.
- OO modeling is close to how we perceive the world.
- Implementation details are hidden from the outside world. We all know how to use a phone, few of us care how it works.
- The packaging of operations and attributes representing state into an object type so that state is accessible or modifiable only through the objects' interface
- Encapsulation lets builders of objects reuse already-existing objects, and if those objects have already been well-tested, much larger and more complex systems can be created.
- A subclass is derived from a superclass. An Employee is a Person.
- The subclass inherits the attributes and behavior of the superclass.
- The subclass can override the behavior of the superclass.
- Notice the use of the ``Is-A'' phrase to describe inheritance.
- Inheritance promotes re-use.
- Literally means ``many forms''.
- A method can have many different forms of behavior.
- Commonly used between a set of classes that have a common superclass.
- The sender of a message does not have to know the type/class of the receiver.
- A single operation or attribute may be defined upon more than one class and may take on different implementations in each of those classes.
- An attribute may point to different objects at different times.
- Abstraction: the act of identifying software artifacts to model the problem domain.
- Classes are abstracted from concepts.
- This is the first step in identifying the classes that will be used in your applications.
- Better to have too many classes than too few. (?)
- When in doubt, make it a class. (?)
- Objects communicate by sending messages.
- Messages convey some form of information.
- An object requests another object to carry out an activity by sending it a message.
- Most messages pass arguments back and forth.
- Meilir Page-Jones defines three types of messages:
- Informative - send information for the object to update itself.
- Interrogative - ask an object to reveal some information about itself
- Imperative - take some action on itself, or another object
- Grady Booch defines four types of messages:
- Synchronous - receiving object starts only when it receives a message from a sender, and it is ready.
- Balking - sending object gives up on the message if the receiving object is not ready to accept it.
- Timeout - sending object waits only for a certain time period for the receiving object to be ready to accept the message.
- Asynchronous - sender can send a message to a receiver regardless of whether the receiver is ready to receive it.