1. Abstraction
Define high-level modules, interfaces, or contracts first — implementation details come later.
Example:
In a car inventory system, define an abstract Car class:
abstract class Car {
void updateBookingStatus();
void getSpecification();
void getModel();
void setInventoryDetails();
void getInventoryDetails();
}
2. Encapsulation
Bind data and behavior into the same class; restrict direct access to object data.
Example:
class Tiger {
private double height;
private double weight;
void setHeight(double h) { this.height = h; }
void setWeight(double w) { this.weight = w; }
}
Only methods inside Tiger can modify its internal state.
3. Cohesion
Each class should have a single, focused responsibility.
Example:Wheel class in a car system should handle rotation only — not braking or acceleration.
4. Coupling
Reduce interdependencies between components — use interfaces to connect related classes.
Example:
interface Wheel {
void attach();
void remove();
}
class MRFWheel implements Wheel {}
class CEATWheel implements Wheel {}
class Car {
Car(Wheel[] wheels) { ... }
}
Now you can replace wheel brands without modifying the Car class.
5. Complexity
Minimize unnecessary complexity in design.
Follow Material Design, MVC, or MVP patterns to separate concerns and maintain clarity.
Material Design (UI Patterns & Styling)
A design language introduced by Google for Android apps.
Key features:
- Defined color themes and styles
- Modern UI elements: Cards, RecyclerView, ripple effects
- Visual consistency across screens and devices
