Object-oriented programming: As the name suggests, Object-Oriented Programming or OOPs refers to languages that use objects in programming. Object-oriented programming aims to implement real-world entities like inheritance, hiding, polymorphism etc in programming. In this article, we will discuss how this OOP’s concept is implemented in real world scenario.
Let’s consider an example of a Geek who wants to learn the Java full course online. He chooses one of the sources to know about various platforms which are offering Java Course. Let’s say he chooses Google and he searches for the course. Once Google accepts the request, it will perform various actions to carry out the request until the request has been served. The following illustration demonstrates the steps performed:
Below is the implementation of the demo class which demonstrates the steps mentioned in the above image:
Geek Requested: Java Google Searched: Java
From the above example, lets understand the different terminology used in the Object-Oriented Design:
- Agents and Community:
- Agent: Every object in the community acts as an agent (i.e.) from the above example, we can say that Geek, Google, and the other extra objects are known to be agents. Every agent performs some actions and those actions are being utilized by other members of the community to solve the problem.
- Community: It is created by actions. In the above example, we can say that the search engine community has been formed.
Therefore, in the above example:
Agents: Geek, Google, and other objects Community: Search engine community
- Messages and Methods:
- Messages: Every message may be a request or response that is being passed to other members of the community.
- Methods Every method is used to perform an action in the community, that action will be used by other members of the community to solve various problems.
- Responsibilities: From the above example, we can observe that once the Geek passes a request to Google, it will accept the request and it performs various actions to give him the desired result. It means if the request accepted by an agent, it is the responsibility of the agent to carry out the request until the problem is solved.
Finally, we can conclude that we have achieved hiding of the data or Abstraction by implementing the system in such a way that when the Geek passes the request, the actions performed by Google are hidden from him to get the desired result.
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
- Understanding Encapsulation, Inheritance, Polymorphism, Abstraction in OOPs
- Difference between Abstraction and Encapsulation in Java with Examples
- Abstraction in Java
- OOPS | Generalization as extension and restriction using Java
- Messages, aggregation and abstract classes in OOPS
- Print Hello World Without using a Semicolon in Java
- OOPs | Object Oriented Design
- Object Oriented Programming (OOPs) Concept in Java
- Understanding Classes and Objects in Java
- Understanding storage of static methods and static variables in Java
- Beginning Java programming with Hello World Example
- The Changing World of Development
- Hello World Program : First program while learning Programming
- Real Time Operating System (RTOS)
- Scheduling in Real Time Systems
- Understanding Array IndexOutofbounds Exception in Java
- Understanding OutOfMemoryError Exception in Java
- Understanding "static" in "public static void main" in Java
- Understanding for loops in Java
- Understanding public static void main(String args) in Java
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.