Object Oriented Thought Process
Why Object Orientation ???
Relational Data
Types Of Data
XML JSON
Imperative Programming
What's An Object
Dog Object
What's a Class ???
Abstraction & Inheritance
Inheritance Types
An Interface
Object Encapsulation
Polymorphism
Class Diagram
Dependency Aggregation
Unidirectional Association Compositions
Bidirectional Association
Inheritance Relationship
Generalization Realization
Think In-terms of Object
- Workshop
Design a class level diagram for,
• RVCE
• Car
Java Memory : Stack & Heap
Java Memory : Stack & Heap
More Object-Oriented Concepts
Error Handling
Constructors
- Default Constructor
- Overloading Constructors
- Super ()
Cohesion & Coupling in OOD
OOD- SOLID Principles
In software development, Object-Oriented Design plays a crucial role when it comes to writing flexible, scalable, maintainable, and reusable code.
There are so many benefits of using OOD, but every developer should also have the knowledge of the SOLID principle for good object-oriented design in programming.
The SOLID principle was introduced by Robert C. Martin, also known as Uncle Bob and it is a coding standard in programming.
This principle is an acronym of the five principles which is given below.
• Single Responsibility Principle (SRP)
• Open/Closed Principle
• Liskov’s Substitution Principle (LSP)
• Interface Segregation Principle (ISP)
• Dependency Inversion Principle (DIP)
OOD- SOLID Principles
Single Responsibility Principle
This principle states that “a class should have only one reason to change”
which means every class should have a single responsibility or single job or single purpose.
Advantages
- Frequency and Effects of Changes
- Easier to Understand
e cases :
sign the classes using Single Responsibility Principle ,
Pizza Delivery
Bank Account
Simple Question to Validate Your Design “What’s your responsibility”
OOD- SOLID Principles
Open and Closed Principle
This principle states that “software entities (classes, modules, functions, etc.) should be open for extension,
but closed for modification”
“A class is closed, since it may be compiled, stored in a library, baselined, and used by client classes.
But it is also open, since any new class may use it as parent, adding new features. When a descendant class is defined,
there is no need to change the original or to disturb its clients.”
Use cases :
Design the classes using Open and Closed Principle,
• Cuboid
• Bank Account
OOD- SOLID Principles
Liskov Substitution Principle
e principle defines that objects of a superclass shall be replaceable with objects of its subclasses without breaking t
plication. That requires the objects of your subclasses to behave in the same way as the objects of your superclass.
OOD- SOLID Principles
Liskov Substitution Principle
OOD- SOLID Principles
The Interface Segregation Principle
The Interface Segregation Principle was defined by Robert C. Martin while consulting for Xerox to help them build
the software for their new printer systems.
He defined it as:
“Clients should not be forced to depend upon interfaces that they do not use.”
OOD- SOLID Principles
The Interface Segregation Principle
OOD- SOLID Principles
Dependency Inversion
The Interface Segregation Principle was defined by Robert C. Martin while consulting for Xerox to help them build
the software for their new printer systems.
Based on this idea, Robert C. Martin’s definition of the Dependency Inversion Principle consists of two parts:
• High-level modules should not depend on low-level modules. Both should depend on abstractions.
• Abstractions should not depend on details. Details should depend on abstractions.
OOD- SOLID Principles
Dependency Inversion
Creational - Factory Pattern
Creational - Factory Pattern
Creational - Factory Pattern
Creational - Abstract Factory
Creational - Abstract Factory
Creational - Abstract Factory
Creational - Abstract Factory