Definition of Object-Oriented Analysis
ICT2622 - Object-Oriented Analysis · Introduction to Object-Oriented Analysis
Definition of Object-Oriented Analysis
Object-oriented analysis (OOA) is a method for analysing and designing systems using object-oriented principles. It focuses on identifying the objects that are relevant to a system and the relationships between these objects. This approach helps in understanding the requirements of the system and facilitates better communication among stakeholders.
What are Objects?
In object-oriented analysis, an object is an instance of a class. A class is a blueprint that defines the properties (attributes) and behaviours (methods) of the objects created from it. For example, consider a class named Car. The attributes of this class might include colour, make, and model. The behaviours could include start(), stop(), and accelerate().
Remember: Objects encapsulate both data and behaviour.
Key Concepts in Object-Oriented Analysis
There are several key concepts in object-oriented analysis that you should understand:
- Encapsulation: This is the bundling of data and methods that operate on the data within one unit, or class. It restricts direct access to some of the object's components, which can prevent the accidental modification of data.
- Inheritance: This allows a new class to inherit properties and methods from an existing class. For example, if you have a class Vehicle, you can create a class Truck that inherits from Vehicle.
- Polymorphism: This allows methods to do different things based on the object that it is acting upon. For example, the method start() might behave differently for a Car object compared to a Truck object.
The OOA Process
The object-oriented analysis process generally involves the following steps:
- Requirement Gathering: This is the first step where you collect all the requirements from stakeholders. This may involve interviews, surveys, and document analysis.
- Identifying Objects: After gathering requirements, you identify the objects that will be part of the system. This may involve creating a list of nouns from the requirements.
- Defining Relationships: Once you have identified the objects, you need to define how they relate to each other. This can be represented using a class diagram.
- Creating Class Diagrams: A class diagram visually represents the classes in the system and their relationships. It includes attributes and methods for each class.
Example of Object Identification
Let’s consider a simple example of a library management system. The requirements might state that the system should manage books, members, and loans. From these requirements, we can identify the following objects:
- Book
- Member
- Loan
Next, we can define the relationships between these objects:
- A Member can borrow multiple Books.
- A Book can be borrowed by multiple Members (but not at the same time).
- A Loan object can link a Member and a Book.
Class Diagram Example
Based on the identified objects and their relationships, we can create a simple class diagram. Here is how it might look:
class Book {
String title;
String author;
String ISBN;
void checkAvailability();
}
class Member {
String name;
String memberID;
void borrowBook(Book book);
}
class Loan {
Member member;
Book book;
Date loanDate;
Date returnDate;
}Tip: When creating class diagrams, be clear about the attributes and methods for each class.
Common Mistakes in OOA
One common mistake in object-oriented analysis is failing to identify all relevant objects. This can lead to incomplete system requirements and may cause issues later in the development process. Always ensure that you thoroughly review the requirements and involve stakeholders in the identification process.
Watch out: Do not confuse attributes with methods. Attributes describe the object, while methods define its behaviour.
Conclusion
Object-oriented analysis is a powerful technique that helps in designing systems that are modular and easier to maintain. By focusing on objects and their relationships, you can create a clear model of the system that meets the requirements of its users.
Check your understanding
- What is an object in the context of object-oriented analysis?
- Explain the concept of encapsulation.
- How does inheritance work in object-oriented analysis?
- What are the steps involved in the object-oriented analysis process?