Object Oriented Programming
Principles of OOP
Object Oriented Programming is a vast subject and it’s driven by principles mentioned below.
Real-world models of OOP
- Abstract class
Note: Examples of this and its related articles are related to high level statically typed object oriented languages such as C# and Java.
Short summary OOP principles
- To ‘abstract’ something away means to hide away the implementation details.
- The definition of encapsulation is “the action of enclosing something in or as if in a capsule”. Removing access to parts of your code and making things private is exactly what Encapsulation is all about (often times, people refer to it as data hiding).
- Inheritance lets one object acquire the properties and methods of another object.
- The word polymorphism means having many forms. Polymorphism is a very generic term, which basically just means “the ability of dealing with different types”.
- Association is a relation between two separate classes established through their objects. This allows you to model a ‘has-a’ association between objects. Composition and Aggregation are the two forms of association.
- Composition is a restricted form of Aggregation in which two entities (or you can say classes) are highly dependent on each other, for e.g. a human and a heart.
- In this relationship an object can survive even if other one ends. For example if Wallet class is not present, it does not mean that the Money class cannot exist.
Now that we have a short version of these properties, we can now dive deep into each property because you will find their implementations complement each other.
Click on the links for simple and yet in-depth guide to each topic:
Abstraction in Object Oriented Programming
Abstraction enables us to provide a simple interface to a user without asking for complex details to perform an action…
Encapsulation in Object Oriented Programming
Encapsulation ensures that each object in your code should control its own state. Encapsulation is defined as the…
Inheritance in Object Oriented Programming
It’s a kind of relationship between two classes which allows one class to inherit code from the other. It represents…
Polymorphism in Object Oriented Programming
Polymorphism means “many forms. By its name, it is a feature that allows you to perform an action in multiple or…
Thank you for reading this article. I hope this and its related articles will help you start your programming journey.
OOP Concepts for Beginners: What is Composition?
Composition is one of the key concepts of object-oriented programming languages, like Java. You can use it to reuse…
Association, Composition and Aggregation in Java - GeeksforGeeks
Association is a relation between two separate classes which establishes through their Objects. Association can be…
OOPs concepts - What is Association in java?
In this article we will discuss Association in Java. Association establishes relationship between two separate classes…
Object-Oriented Programming Concepts
Developers who are familiar with procedural languages such as C and Pascal will understand variables, functions, and…
Disclaimer & fair use statement:
This website may contain copyrighted material, the use of which may not have been specifically authorized by the copyright owner. This material is available in an effort to explain concept of Object Oriented Programming designs in an articulate and summarized manner to be used as an educational tool. The material contained in this website is distributed without profit for research and educational purposes. Only small portions of the original work are being used and those could not be used easily to duplicate the original work. This should constitute a ‘fair use’ of any such copyrighted material (referenced and provided for in section 107 of the US Copyright Law). If you wish to use any copyrighted material from this site for purposes of your own that go beyond ‘fair use’, you must obtain expressed permission from the copyright owner.