01 is powered by Vocal.
Vocal is a platform that provides storytelling tools and engaged communities for writers, musicians, filmmakers, podcasters, and other creators to get discovered and fund their creativity.
How does Vocal work?
Creators share their stories on Vocal’s communities. In return, creators earn money when they are tipped and when their stories are read.
How do I join Vocal?
Vocal welcomes creators of all shapes and sizes. Join for free and start creating.
To learn more about Vocal, visit our resources.Show less
Understanding object oriented programming (OOP) is fundamental to any modern programmer’s knowledge base. There are a couple of ways to think about computer programming, each with their own benefits and downfalls. At its core, programming is the writing of code into coherent, logical structures and relations, such that actions and objects can be manipulated by the computer based on what is inputted into the system. OOP though, in contrast to procedural programming or functional programming, focuses on the objects and relations between them, rather than the actions involved in running the program in a step-by-step way. Many, even most, of the most modern, commonly used programming languages today are part of this paradigm.
Philosophy, Programming, and Computer Science
If you go back far enough, just about all of our modern technology and science owes its roots to philosophy. Computer programming demonstrates this more directly than anything else in the digital sphere. There are two significant aspects of analytic philosophy that enable the success of computer science: formal logic and definition. Logic is the procedure by which programs successfully run. This is how your basic “if...then…” procedures function. These programming languages operate like sets of instructions, a formula for carrying out tasks. Objects, on the other hand, are the crucial pieces of information over which these procedures operate. OOP takes this data and these behaviors, and combines them into objects and classes, which behave in defined ways.
The “Object” in OOP
Objects are the entities in computer programming between which relations exist. Objects have properties and behaviors, which determine how they can be used and what the program does. This is the definitional aspect of OOP. Object instances are instances of a class, a relation analogous to the relationship between numbers and variables, for example. The class refers to the data types being manipulated, while the objects are specific instances of this class. OOP also allows for child classes, enabling a deep complexity within a program without muddying the waters as much as procedural programs might otherwise do. The function of objects is actually a property (not in the technical sense) of that class—objects can do things in virtue of their properties as members of a class.
In OOP, you’ll come across the format ‘self.name’ regularly. The ‘self’ acts as an indexical to the instance of the object, defining it as, well, itself so that it may carry out its specific function. This allows the program to operate over the object as a self-contained entity. This defines instance methods. Technically, the ‘self’ itself is arbitrary—other words could be used; however, convention in OOP languages, like Python, is to use this form, and maintaining uniform habits across your work and other programmers’ work is crucial to avoiding unnecessary errors, a struggle every programmer knows.
Some Advantages and Purposes of OOP
Object oriented programming languages have become more or less the norm these days. Early functional or procedural programming languages came up against serious organizational issues when they were introduced to represent or model real world applications. The complexity of these kinds of real world problems meant that step-by-step instructions would quickly spiral out of control, as you had to ‘tell’ the computer how to handle every instance of a class, every object, separately. OOP organizes objects and classes in such a way as to allow you to work over them, without needlessly redefining them. There are few crucial aspects of OOP that allow this: child and parent classes and multiple inheritance are certainly some of the most crucial of these functions.
Child classes also inherit their attributes from their parent classes. Think of these as subsets of categories. OOP also has the advantage of multiple inheritance. This means that a class of objects can inherit attributes from more than one parent class. This allows programmers to organize objects in a complex way, while maintaining the causal structure that keeps things in your software running smoothly.
A class defines the set of attributes and behaviors that the objects can instantiate. This is an intuitive way to represent complex, real world issues in a programming language, and is paramount to understanding how to write a computer program. Objects in the ordinary, worldly sense can be categorized in many ways. The individual objects may have an infinite number of features, such as color, age, size, etc. In virtue of their belonging to a particular class or category of things, there will be consistent sets of features that determine their belonging to a class. A particular student in a course could be described in a variety of ways: as a real person, as some who has familial relationships, by their appearance, habits, thoughts. As a member of the class ‘student,’ their features are set by the class, including such things as their grade, attendance, etc. Should other categories be relevant to the data structures, those can then also be included as parent classes, feeding the particular instance from various angles to better execute the function the object was constructed to define. In procedural programming, the complexity of an individual object quickly becomes problematic, as the relevant features need to be defined explicitly.
Examples of OOP
Even programmers who didn’t explicitly read any beginner's guide to getting started with programming probably knows what object oriented programming concepts are, likely having used them and understanding the concept of data and method manipulation that is used in these languages. One of the first OOP languages was Smalltalk, which dates back to the 1980s; but major languages like Ruby, Scala, and, of course, Python are also object oriented. Naturally, object oriented programming languages do not preclude using procedural or functional features as well. Many of the most commonly used, fundamental languages to modern programming combine elements in this way. This includes major players like Java, C++, and Pascal, which are designed to utilize the organizational advantages of object oriented programming, but also include procedural elements.