Abstraction is Art…I think
You down with OOP? Yeah, you know me.
Most of us at least know what Object Oriented Programming is but let’s go over some basics:
OOP is a programming model that uses “objects” to interact with each other to build computer programs. The main concepts are:
Polymorphism: The process of using an operator or function in a variety of ways to handle different data inputs.
Encapsulation: Hiding the application details of a class from other objects and classes.
Inheritance: A method to form new classes using properties of classes that have already been defined.
Abstraction: The process of tackling a complex problem found in the real world by making classes that can process the problem. In doing so it also suppresses the complex parts of the process. Part of this is making our code flexible and easier to debug.
We need to go deeper…
So let’s think about abstraction as a principal. A traditional definition (from Google) is “the quality of dealing with ideas rather than events”. In computer science abstraction basically deals with organizing the complexity of computer software. Control abstraction is the abstraction of actions like control flow statements. While data abstraction deals with the use of data structures, such as the idea of an object in OOP.
Extending an olive branch.
Inheritance is another ingenious facet of OOP that saves programmers a lot of time and more than a few headaches. Inheritance deals with adding functionality to a class by using a super class to provide a base of attributes, which can then be added to or modified in the class set up of the class doing the inheriting.
Encapsulating your information.
Encapsulation is a mechanism that restricts and protects certain portions of an object for the purposes of security and efficiency. By keeping your information separate it also helps you to prevent unforeseen changes to integral parts of your objects and classes that may cause serious bugs. Encapsulation also has the added benefit of keeping your data together so that methods for a specific class or object stay within their boundaries and don’t cause code smell or confusion.
OOP is important to our progress as programmers, but it’s just as important in bridging the divide between the human mind and computer systems. It accomplishes this by providing a comfortable familiar programming model that deals with data in a way that we deal with every day situations. By thinking of pieces of data as objects and not actions, it affords us the opportunity to visualize software in a unique way.