- Object-Oriented programming is a way of developing software applications using real-world terminologies to create entities that interact with one another using objects.
Most Programming languages provide the following basic building blocks to build object-oriented applications:
- Classes: A Class define the structure using methods and properties/fields that resemble real-world entity.
- Methods: A method represents a particular behavior. It performs some action and might return information about an object, or update an object's data.
- Properties: Properties hold the data temporarily during execution of an application.
- Objects: Objects are instances of the class that holds different data in properties/fields and can interact with other objects.
- Interfaces: An interface is a contract that defines the set of rules for a particular functionality. They are used effectively with classes using OOP principles like inheritance and polymorphism to make appplications more flexible.
- a: Abstraction
- b: Encapsulation
- c: Inheritance
- d: Polymorphism
The business requirement is the starting point.
- Abstraction: First, identify essential entities and their characteristic from the business requirment for a high level view. a. Find nouns from the business requirment (the noun is the person, place, thisng, or process). b. Identify potential classes and their members from the nouns.
- Encapsulation: An implementation of abstraction in code. Cdreate classes and their members with appropriate access modifiers to show functionalities and hide details and complexity.
- Define relationship: Establish relationships between classes using inheritance and polymorphism. a. Inheritance b. Polymorphism
- Use principles & Patterns: use the "SOLID" principles and Design Patterns as and when necessary to make applications flexible.
- Single Responsibility Principle
- Open/Closed Principle
- Liskov Substitution Principle
- Interface Segregation Principle
- Dependency Inversion Principle