OOPS – Fundamentals, Models, Relations and Principles
Object-Oriented Programming System, commonly called OOPS, is one of the most important programming paradigms in Java. Java is strongly object-oriented in design, and almost every real-world Java application is built using OOPS concepts.
OOPS helps developers design software by modeling real-world entities as objects. Instead of focusing only on functions and procedures, object-oriented programming organizes software around data and the behavior associated with that data.
What is OOPS?
OOPS stands for Object-Oriented Programming System. It is a programming methodology in which a program is designed using objects and classes instead of only writing instructions step by step.
In OOPS:
- data is grouped with related behavior
- real-world entities are represented as objects
- code is organized into reusable components
- software becomes modular, scalable, and maintainable
Why OOPS is Important
OOPS is important because modern software systems are complex. Without a proper design model, code becomes difficult to manage, test, and extend.
- improves code reusability
- helps in modular development
- reduces redundancy
- makes maintenance easier
- supports real-world software modeling
Real-World Understanding of OOPS
Consider a real-world example of a Student.
- Properties → name, roll number, age
- Behaviors → study(), attendClass(), takeExam()
In Java:
- properties are represented using variables
- behaviors are represented using methods
- the entire structure is represented using a class
Basic OOPS Example
In this example:
Studentis a classs1is an objectnameandageare propertiesstudy()is behavior
Fundamental Concepts of OOPS
The main fundamentals of OOPS are:
- Class
- Object
- Encapsulation
- Inheritance
- Polymorphism
- Abstraction
1. Class
A class is a blueprint or template used to create objects. It defines what data the object will have and what actions it can perform.
Example
2. Object
An object is a real instance of a class. It occupies memory and can use the data and behavior defined by the class.
Example
3. Encapsulation
Encapsulation means wrapping data and methods into a single unit and controlling direct access to data.
This is usually achieved using private variables and public getter-setter methods.
Example
Here, direct access to balance is restricted.
4. Inheritance
Inheritance allows one class to acquire the properties and methods of another class.
It supports code reuse and hierarchy building.
Example
Dog inherits from Animal.
5. Polymorphism
Polymorphism means “many forms.” It allows the same method or interface to behave differently in different situations.
Java supports:
- compile-time polymorphism (method overloading)
- runtime polymorphism (method overriding)
Method Overloading Example
Method Overriding Example
6. Abstraction
Abstraction means hiding implementation details and showing only the essential features to the user.
In Java, abstraction is mainly achieved through:
- abstract classes
- interfaces
Example
OOPS Models
OOPS models are conceptual ways of representing software design using classes and objects.
Important modeling ideas include:
- Object model
- Class model
- Interaction model
- Relationship model
1. Object Model
The object model focuses on real-world entities as objects with state and behavior.
Example:
- Object: BankAccount
- State: accountNumber, balance
- Behavior: deposit(), withdraw()
2. Class Model
The class model focuses on the structure of software using classes and their members.
Example:
- Class: Employee
- Variables: name, id, salary
- Methods: work(), display()
3. Interaction Model
This model explains how objects communicate with each other through method calls.
Example:
- Customer object calls Account object
- Order object interacts with Product object
4. Relationship Model
OOPS uses relationships between classes to model real-world associations.
Important relations are:
- IS-A relationship
- HAS-A relationship
- Association
- Aggregation
- Composition
OOPS Relations
1. IS-A Relationship
IS-A relationship represents inheritance.
Example:
- Dog IS-A Animal
- Car IS-A Vehicle
2. HAS-A Relationship
HAS-A relationship means one class contains another class as a member. It is also called composition or aggregation depending on strength of ownership.
Example:
- Car HAS-A Engine
- Student HAS-A Address
3. Association
Association means two classes are connected in some way and can interact with each other.
Example:
- Teacher teaches Student
- Customer places Order
4. Aggregation
Aggregation is a weak HAS-A relationship. The contained object can exist independently.
Example:
- Department has Teachers
- Library has Books
Even if the department is removed, teachers may still exist.
5. Composition
Composition is a strong HAS-A relationship. The contained object depends fully on the container object.
Example:
- House has Rooms
- Human has Heart
If the container is destroyed, the contained object logically does not exist in that context.
OOPS Principles
OOPS principles are the design rules that make object-oriented software strong and maintainable.
The four core principles are:
- Encapsulation
- Inheritance
- Polymorphism
- Abstraction
But in practical software engineering, OOPS also encourages:
- modularity
- reusability
- extensibility
- maintainability
Encapsulation Principle
Data should be protected inside the class and exposed only through controlled methods.
This improves security and data hiding.
Inheritance Principle
Common features should be placed in a parent class so child classes can reuse them.
Polymorphism Principle
The same method name or interface should support multiple behaviors depending on context.
Abstraction Principle
Only the essential view should be exposed to the outside world while internal complexity remains hidden.
Real-World Example Combining OOPS Fundamentals
This example demonstrates:
- Class and object
- Inheritance
- Abstraction
- Runtime polymorphism
Advantages of OOPS
- better code organization
- high reusability
- easy maintenance
- better real-world mapping
- improved scalability
- safer code through encapsulation
Limitations of OOPS
- can be complex for small programs
- requires good design thinking
- too many objects may increase complexity
- poor OOPS design can make code harder instead of easier
Common Mistakes
- Confusing class with object
- Using inheritance where composition is better
- Breaking encapsulation by exposing data directly
- Creating too many unnecessary classes
- Using abstraction without clear design purpose
Best Practices
- Use classes to model real-world entities clearly
- Prefer encapsulation for data safety
- Use inheritance only for true IS-A relationships
- Prefer HAS-A when composition fits better
- Keep classes focused on one responsibility
- Design with maintainability and reuse in mind
Interview-Oriented Points
- OOPS stands for Object-Oriented Programming System
- Main fundamentals are class, object, encapsulation, inheritance, polymorphism, and abstraction
- IS-A represents inheritance
- HAS-A represents containment relationship
- Encapsulation hides data, abstraction hides complexity
- Polymorphism means one interface with multiple implementations
- OOPS improves modularity, reusability, and maintainability
Conclusion
OOPS is the foundation of Java programming. It helps developers think in terms of objects, relationships, and reusable designs instead of only writing procedural code.
Understanding OOPS fundamentals, models, relations, and principles is essential not only for interviews but also for writing clean and scalable Java applications in the real world.

