What Is Difference Between Abstraction and Encapsulation in Object Oriented Programming?

difference between encapsulation and abstraction

Image credit: businessinsider.com

What Is the Difference Between Encapsulation and Abstraction?

At first glance you may be forgiven for thinking that encapsulation and abstraction are doing something very similar in that they appear to hide information from the user. However they are in fact completely different concepts with object oriented programming. Whether it is C object oriented programming, java or any other language the concepts are basically the same:

Encapsulation within OOP is how you will bind together the data and functions that manipulate the data preventing any form of interference. While abstraction is the process that the programmer uses to hide everything but the specifically relevant data about an object to improve efficiency through the removal of complexity.

It gets worse: look up the difference between these online and you may just end up becoming more and more confused as many of the answers that are given online are confused and often contradictory. To answer this question correctly you will have to dig deep and truly understand how each concept really works within OOP.

But: if you look at Rasmussen college for their discussion on what programming languages will get you the best salaries you will quickly see that the top earners are all within object oriented languages. So it is best to ensure that you fully understand all of the OOP concepts.

Tips for Answering Your Encapsulation and Abstraction Assignment

Getting good results from your assignments is not difficult if you relax and put in the required work to understand the different concepts of OOP. To answer your assignments well simply follow this advice:

  • Pay attention in your classes, do the required reading and conduct your own research to fully understand concepts like abstraction, encapsulation and others.
  • Never leave your assignment to last minute; have a regular time within which you do all of your work.
  • Do your programming assignment in a place that is free from all distraction. Switch off things like social media and your phone so that you are not disturbed.
  • Read your assignment very carefully so that it is clear what you are being asked for f .e. what are syntax errors in python. If you are not sure then ask your tutor for clarification.
  • Make an outline for you answer. This does not have to be overly complicated but it should clearly show what you need to cover within your answer. This will highlight any areas that you need to research and will help you to avoid a lot of rewriting.
  • Working in groups or with a study partner can help; but do not all submit identical answers!
  • Look online for answers but do not simply copy what you see. Plagiarizing answers is not the way to get in your tutors good books.
  • Proofread your answers very carefully to avoid any errors.

Of course you will have to do some work to answer your assignment and to learn about OOP. But it gets better: the concepts of object oriented programming are transferable between languages and using them allows you to in many areas produce better programs and as Eric S Raymond once said:

“Ugly programs are like ugly suspension bridges: they’re much more liable to collapse than pretty ones, because the way humans (especially engineer-humans) perceive beauty is intimately related to our ability to process and understand complexity. A language that makes it hard to write elegant code makes it hard to write good code.”

If you still be having issues understanding the difference between encapsulation and abstraction contact our specialized tutors here today!