Notes > Software Engineering > Object Oriented Concepts
An object is an abstraction of something within the domain of the problem. It can be real or conceptual (logical). Objects have a state and they behave in a certain way which is determined by the operations it can undertake. It also has a unique ID. An object is an instance of a class and has unambiguous boundaries.
Objects interact with other objects but it performs operations on itself in order to facilitate this interaction. Other objects (commonly known as clients) know what services the object provides but they do not know how they are provided. This lends towards the desired low coupling strived for in object-oriented programming.
In designing a system, classes need to be "discovered". his is done by analyzing Use Cases and the current system and determining where seperate objects and relationships occur. Classes also need to be documented. THis documentation states the purpose of the class and gives a description of the associated objects and reasons why the class is needed.
Encapsulation is an important concept in object-oriented systems development. Encapsulation is closely associated with the concept of "information hiding". Information hiding means hiding the internal workings of a class. Good encapsulation means that data and the methods associated with that data are packaged together.
Inheritance involves two types of class. A general / parent class contains general attributes and features. A child class then inherits the parent class' properties. Adding more attributes to the child class is known as specialisation. A class with no parent classes above it is the root class. For inheritance in the context of Use Cases please refer to Use Case Models.
Multiple inheritance involves inheriting characteristics from more than one class. This can lead to very complex situations and may cause problems in the long-term development of a system as it becomes increasingly complicated. Incidentally, Java does not support multiple inheritance.
Overloading refers to the ability to have more than one function of the same name. The differentiating factor between these overloaded functions is the parameter type (and / or quantity). When the function is called, the function with the matching signature or parameters is invoked. For example, the function "add" (+) may have different implementations depending on whether the parameters are integers or real numbers.
Polymorphism and Dynamic Binding
Dynamic Binding implements Polymorphism. Polymorphism is closely related to inheritance and ensures that child classes have the same functionality as their parent class while also having their own specific functionality. Dynamic Binding involves sections of code being selected for execution at run-time opposed to at compile-time. Dynamic Binding gives a greater amount of flexibility over explicit selection. If new classes are created or existing classes changed, the use of explicit selection can lead to broken references.
There are three main types of message that can be sent between objects within a computer program. These are as follows:
Informative messages consist of information which is used to update an object's state (its associated data / variables). Interrogative messages request an output from an object. They read or request data. Imperative messages instigate an action. They cause the receiving object to carry out a certain operation or function.
Search for "Object Oriented Concepts" on:
eBay (UK) |
Search for "Object Oriented Concepts" on the rest of Computing Students: Object Oriented Concepts