UNIT 1 NOTES
UNIT 1 NOTES
1. Objects:
o Objects are the fundamental units in object-oriented systems. They
represent entities in the system and can contain both data and
methods that operate on that data.
o Example: In a banking system, an object could be an instance of
an account with attributes like balance and methods like deposit or
withdraw.
2. Classes:
o A class is a blueprint or template from which objects are
instantiated. It defines the properties (attributes) and behaviors
(methods) that the objects created from the class will have.
o Example: A class Account could have attributes like balance and
methods like deposit() or withdraw().
3. Encapsulation:
o Encapsulation refers to the concept of bundling the data
(attributes) and the methods that manipulate the data into a single
unit or object. It also hides the internal state of the object from the
outside world, exposing only what is necessary through interfaces.
o Example: The balance of an account may be encapsulated within
the object, and access to it may be controlled via methods like
getBalance().
4. Inheritance:
o Inheritance allows new classes to inherit the properties and
behaviors of existing classes. It promotes code reuse and
establishes a relationship between parent and child classes.
o Example: A SavingsAccount class can inherit from a general
Account class, thus gaining all the properties and behaviors of the
Account class while adding additional features like interest rate.
5. Polymorphism:
o Polymorphism enables objects of different classes to be treated as
objects of a common superclass. It allows for methods to be used
interchangeably across different object types, simplifying code
and increasing flexibility.
o Example: A method processTransaction() could work with any
type of account (checking, savings, etc.), even though each
account type may have a different implementation.
6. Abstraction:
o Abstraction involves hiding complex implementation details and
exposing only the necessary functionality to the user. It simplifies
the interaction with complex systems and improves
maintainability.
o Example: A BankAccount class might abstract the details of how
transactions are processed and only provide a simple method to
deposit or withdraw funds.
7. Message Passing:
o Objects communicate with one another by sending messages
(calling methods) to each other. This communication is central to
the interactions within an object-oriented system.
o Example: A Customer object might send a message to the
BankAccount object to process a withdrawal.
1. Analysis:
o The focus here is on understanding the problem domain. The
requirements are gathered, and objects, their behaviors, and
relationships are identified. Techniques like use cases and class
diagrams are often used in this phase.
2. Design:
o In this phase, a blueprint for the system is created. This includes
designing the classes, defining their attributes, and specifying the
methods. Class diagrams, sequence diagrams, and interaction
diagrams are commonly used to represent the design.
3. Implementation:
o The actual coding of the system occurs in this phase, where the
design is translated into code using an object-oriented
programming language (like Java, C++, or Python).
4. Testing:
o After implementation, the system is tested for correctness,
performance, and reliability. Object-oriented testing focuses on
testing individual objects, their interactions, and the overall system
behavior.
5. Maintenance:
o After deployment, the system enters the maintenance phase, where
bugs are fixed, and new features may be added. Object-oriented
systems are generally easier to maintain due to their modularity
and reusability.
Major Elements − By major, it is meant that if a model does not have any
one of these elements, it ceases to be object oriented. The four major elements
are −
Abstraction
Encapsulation
Modularity
Hierarchy
Minor Elements − By minor, it is meant that these elements are useful, but
not indispensable part of the object model. The three minor elements are −
Typing
Concurrency
Persistence
Abstraction
Abstraction means to focus on the essential features of an element or object in
OOP, ignoring its extraneous or accidental properties. The essential features
are relative to the context in which the object is being used.
Encapsulation
Modularity
Modularity is the process of decomposing a problem (program) into a set of
modules so as to reduce the overall complexity of the problem. Booch has
defined modularity as −
“Modularity is the property of a system that has been decomposed into a set
of cohesive and loosely coupled modules.”
Typing
Concurrency
Concurrency in operating systems allows performing multiple tasks or
processes simultaneously. When a single process exists in a system, it is said
that there is a single thread of control. However, most systems have multiple
threads, some active, some waiting for CPU, some suspended, and some
terminated. Systems with multiple CPUs inherently permit concurrent threads
of control; but systems running on a single CPU use appropriate algorithms to
give equitable CPU time to the threads so as to enable concurrency.
In an object-oriented environment, there are active and inactive objects. The
active objects have independent threads of control that can execute
concurrently with threads of other objects. The active objects synchronize
with one another as well as with purely sequential objects.
Persistence
An object occupies a memory space and exists for a particular period of time.
In traditional programming, the lifespan of an object was typically the
lifespan of the execution of the program that created it. In files or databases,
the object lifespan is longer than the duration of the process creating the
object. This property by which an object continues to exist even after its
creator ceases to exist is known as persistence.
Booch Methodology
The Booch Methodology is an early and influential object-oriented software
development methodology created by Grady Booch. It was designed to
provide a formal and structured approach to software development using
object-oriented principles. This methodology emphasizes the use of object-
oriented concepts like classes, objects, inheritance, and encapsulation to
model and design complex systems.
Booch's work is one of the key foundations for what would later become the
Unified Modeling Language (UML), and the Booch method itself played a
significant role in the evolution of object-oriented modeling.
Although the Booch Methodology itself is less commonly used today, its
principles are embedded in many modern object-oriented development
practices, particularly those used in UML and Object-Oriented Analysis
and Design (OOAD).
Rumbaugh Methodology
The Rumbaugh Methodology is often associated with the Object Modeling Technique
(OMT), which is a framework for object-oriented analysis and design. OMT provides
techniques for modeling and constructing systems using object-oriented principles.
1. Analysis Phase:
o Identify the problem and the relevant objects.
o Discover and model the key objects, their attributes, and interactions.
o Define the system requirements through use cases.
2. Design Phase:
o Develop a more detailed object model and design the classes, including
their attributes, methods, and relationships.
o Define the internal and external interfaces between objects.
3. Implementation Phase:
o Translate the design into actual code, using an object-oriented programming
language.
o Ensure that the code adheres to the object-oriented principles established
during the design phase.
Jacobson Methodology
The Jacobson Methodology, also known as the Use Case Driven Object-Oriented
Analysis and Design (OOAD) methodology, was developed by Ivar Jacobson in the
early 1990s. This methodology is particularly focused on the use case as the central tool
for modeling the functional requirements of a system.
Jacobson’s approach emphasizes the importance of understanding user interactions with
the system through use cases, which are descriptions of how users or other systems
interact with the system to achieve a particular goal.
1. Use Cases:
o Use cases are central to the Jacobson methodology. A use case defines a
sequence of interactions between an actor (usually a user or another system)
and the system to achieve a goal.
o Use cases capture the functional requirements of the system from the
perspective of its end users.
o Actors represent entities that interact with the system, such as users, other
systems, or external devices.
o Use cases are organized into use case diagrams and detailed narratives to
capture scenarios and actions.
2. Object-Oriented Analysis (OOA):
o Object modeling: In this phase, objects are identified based on the
functional requirements captured in use cases.
o The primary goal is to represent real-world entities in terms of objects,
which encapsulate both state (attributes) and behavior (methods).
o Identify classes, objects, associations, and responsibilities to achieve the
system's goals.
3. Object-Oriented Design (OOD):
o Once the objects are identified in the analysis phase, the next step is to
refine and design the system architecture.
o Classes are further refined into design classes, and collaborations (the
interactions between classes) are specified to achieve the functionality
described by the use cases.
o The design phase focuses on mapping the analysis model to a detailed
system design.
4. Responsibilities-Driven Design:
o In the Jacobson methodology, each object or class is designed to take on
specific responsibilities. Responsibilities refer to what an object is
supposed to do and how it does it.
o Objects interact with each other to fulfill their responsibilities. The focus on
responsibilities helps in creating a well-structured, modular system where
each class or object has a clear, manageable role.
5. Iterative Development:
o Jacobson advocates for an iterative and incremental approach to software
development.
o The methodology stresses the importance of continuously refining the
system through iterations, allowing for changes and feedback throughout
the development process.
o This allows teams to adapt and evolve the system as more is learned about
the requirements and the design.
6. Subsystems:
o Large systems are often decomposed into smaller subsystems or packages
of related classes.
o This helps manage complexity by organizing the system into manageable
components with well-defined interfaces.
1. User-Centered Focus: Use cases emphasize user interactions, which helps ensure
that the system meets user needs.
2. Clear Requirements: Use cases provide a straightforward way to capture and
communicate system requirements.
3. Modular Design: Emphasis on classes, objects, and responsibilities leads to a
well-structured, modular system.
4. Iterative Process: The iterative development process allows for flexibility and
adapts well to changing requirements.
Challenges:
1. Complexity in Large Systems: As the system grows, the number of use cases and
interactions can become difficult to manage.
2. Focus on Functional Requirements: While use cases are great for capturing
functional behavior, non-functional requirements (like performance, scalability,
etc.) might be harder to represent.
Patterns
These patterns deal with the process of object creation and help to make the system more
flexible by decoupling the client from the object creation process.
Singleton Pattern: Ensures a class has only one instance and provides a global
point of access to it.
Factory Method Pattern: Defines an interface for creating objects, but allows
subclasses to alter the type of objects that will be created.
Abstract Factory Pattern: Provides an interface for creating families of related
or dependent objects without specifying their concrete classes.
Builder Pattern: Allows the creation of complex objects step by step. It separates
the construction of a complex object from its representation.
Prototype Pattern: Creates new objects by copying an existing object, known as
the prototype. This is useful when the cost of creating an object is more expensive
than copying an existing one.
2. Structural Patterns
These patterns focus on the composition of classes or objects and provide solutions for
creating relationships between entities in a flexible way.
3. Behavioral Patterns
These patterns are concerned with the interaction between objects, and the
responsibilities of each object in a system.
Frameworks
Unified Approach
What is UML?
Structure diagrams represent the static aspects of the system. They show how the system
is organized, its components, and their relationships.
Class Diagram:
o Shows the internal structure of a class, including its relationships with other
classes and components.
o Helps to describe how individual objects or parts of an object interact with
each other.
Deployment Diagram:
Package Diagram:
Behavior diagrams represent the dynamic aspects of the system. They focus on how
objects or components interact, how they change states, and how the system behaves
over time.