My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
Object oriented programming.

Object oriented programming.

Paul's photo
Paul
·Jun 26, 2019

This is an essential skill that any modern day programmer would need to know and understand. For anyone who has done java and c#, you for sure have came across this topic and know how important it really is. For those who have tried going through this topic but have had challenges, i can assure you that you aren't the first and the last. It confused me a bit but i have finally come to understand it. If you can go through this, you might be able to understand and hopefully keep on coding.

If you are wondering why i say it is important, it would be because it has practical and fundamental uses.

What is OOP.

I'll now begin by explaining exactly what OOP really is. OOP is a type of programming whereby data structure, data type and functions are considered when writing down code. Data type is the classification of data while data structure is the method of arranging of information that relates with each other. While going through OOP, there are some key terms that you would hear being constantly used such as class and function. Class is the description of data or information while function is a section of code that has a specific task to perform. There are many more key terms which are used in OOP but i just got there two most common ones that i had an issue remembering. If you find more feel free to share. OOP language.png

Languages used in OOP.

There are various high level languages that use the concept of OOP. Some my ask why high level languages are used and what is even a high end language. A high level language is a type of programming language that enables you to give a computer commands and specifics on what to do. A high level language is easily read by humans than low level languages. High level languages are used in OOP because they are more easier to understand and they are user friendly. The example of high level languages used are:

  • c#
  • c++
  • java
  • php
  • kotlin e.t.c OOP2.jpeg I'll now get into the four features/characteristics of OOP. This are what give people a head ache trying to understand in OOP. I have tried explaining them as easily as i could understand them and i hope that you to could understand.

    Encapsulation.

    This is combing data and code into one unit. For example the way drugs are made up of different elements that are contained in one whole tablet/capsule. Encapsulation works by keeping the state of data private and only restricted access.

    Abstraction.

    This is whereby a user is only given necessary and a usable amount of data that is only needed for the moment and the rest is hidden. A good example could be the the body. The skin shows only what is appealing to the eyes such as a pretty face but the rest of the non-appealing stuff like the liver is hidden by the skin. In abstraction only limited and useful data is given while the rest is hidden from the user.

    Inheritance.

    This is where a one(child) class obtains the properties of another class(parent) and even creates its own special and unique properties. An example that i can give is the way a baby takes over and learns skills by watching adults do it over and over again and even obtains its own special sets of skills such as learning to climbing stairs without assistance from its parents.

    Polymorphism.

    This the ability of data to appear in various forms. It is the way objects and data of different types are processed and accessed through the same interface. An example would be the different sounds made by animals. They are all made by different animals but at the end of the day, they still appear under animal sounds.

    Why OOP.

  • First is because it makes code management easier and simpler. -Another reason is because it fits the criteria of modern day programming whereby the languages are more interactive than assembly language(low level language) and readable by humans -Finally, the benefit of code that is written using the concept of OOP is that it is easier to maintain and update. thumbs-up-2.png

    Conclusion.

    That will be all on OOP and if you feel like there was some important info that i did not completely share, feel free to comment and hopefully i shall try to update my existing information. Also please share is you feel that there could be some mistakes or issues with what i have written down. A hand of correction is always accepted.