Object Oriented Programming Polymorphism

This is the final part of the OOP primer series, where we discuss the concept of Polymorphism and the idea of objects being able become become different object if the situation for it occurs.

Polymorphism is one of the harder topics, so I suggest practice writing objects that take advantage of polymorphism, along with implementing the other concepts previously discussed. I have also included refrence materials that had helped me understand OOP and write this OOP primer series.

As always, if there are any comments please feel free to email me.

Polymorphism

I’m assuming “you” are a programmer, or the like because if you are not then you are halfway to becoming one if you got this far into the essay. We have already covered that you are a child that has inherited the many characteristics of your parents and those before you and that you modify those characteristics to fit your needs. What if I told you that besides being a part of the “Person” class, you can make yourself a part of the “Programmer” class by modifying certain aspects of your characteristics.

When a “Person” asks how many languages do you know, most people think of linguistic languages such as English, French, Japanese, etc. Though because you are a “Person” you can say that you know English, but as a “Programmer” you can say that you know Java, C++, and Python. The way in which we modify characteristics depending on our role is similar to the concept of Polymorphism in OOP, where an object can be a part of a class but can override the methods of its parent class based on their needs. Just as our example before “you” the “Person” is going to tell me you know English, but “you” the “Programmer” is going to tell me you know Java. Depending on which “you” I am talking to, the same question can have different outputs; or in programming terms, the same method can have different outputs.

Now all of the concepts described above are integral when it comes to the OOP paradigm and programming design. The explanations that I have written for these concepts are just short excerpts so that you the reader can understand the basics of what these concepts me when they do occur in either your studying or work. There are have been many books that write about OOP and the other programming and development aspects that come with OOP such as Agile, Clean Code, and much more. These concepts run most of the technology that we use in our everyday life and understanding these concepts is ideal to become a great programmer.

References

Lewis, J., & Loftus, W. (2011). Java Software Solutions: Foundations of Program Design (7th ed.). Pearson.

Martin, R. (2021). Robert Martins Clean Code Agile Software Craftmanship (1st ed.). Generic.

Thomas, D., & Hunt, A. (2019). The Pragmatic Programmer: Your Journey To Mastery, 20th Anniversary Edition (2nd Edition) (2nd ed.). Addison-Wesley Professional.

Written on March 4, 2023