This article is the second in our new series of article for 2019; perspectives from our expert instructors. Keep your eye on this space to get the latest in what’s happening in code education, straight from our instructors. This month, Director of Curriculum and Instruction Alan Galloway covers a topic we hear about frequently.
Apprentices in our bootcamps point out articles that declare Object Oriented Programming (OOP) is dead and question: why we are teaching a dying approach? This claim leaves them thinking that functional programming is the only paradigm needed in a modern world! When considering this possibility, my first thought is to recall the answer I have heard most often throughout my career: “It depends.”
OOP is a tool that is used often and is poorly used in a large portion of those implementations. These articles rightfully lament the current state of how often the paradigm is used: in a manner that undermines the very purpose behind the structure. Couple this with the implementation of languages that continually evolve to support a variety of programming approaches, and we often encounter code that is difficult to understand and frustrating to maintain.
Objects can be either apples or oranges. And with OOP, they can both be used! Confusing, but useful.
If we consider the purpose and intent behind OOP, it can help us to see why it can be a useful tool. OOP allows us to break apart issues and model them in a way that relates to things we are used to managing in the physical world. It allows us to manage complex code in an organizational structure that relates to our everyday life. One of the most powerful concepts we can embrace in OOP is the use of interfaces that allow us to write flexible, sustainable code.
An example image depicting an Object Oriented Programming challenge from one of our courses
As a beginning developer you will typically be working to support an existing product when you join a team. The reality of the industry is that this product will most times be written either using or abusing OOP principles. When preparing to contribute to these types of products, you need to understand the goals of OOP and be aware of the pitfalls.
Even as you explore other programming practices, the fundamental goal is to provide solutions through code. These solutions need to be maintained and grow to meet future requirements. The approaches we take are ways of framing the logic to build the solutions needed. Modern applications often blend programming approaches across different tiers of the application depending on the needs and demands of each aspect.
Procedural programming is structured around the procedure call. Focusing on the organization of code, collections of variables and data structures this approach does not bundle data and actions like OOP does. Functional programming is a structured programming approach that has significant similarities with procedural programming. In functional programming the emphasis is on the evaluation of complex expressions and less emphasis on the order of calls in the program control. This makes it a useful tool for processing portions of large problems in parallel. Aspect oriented programming is an approach that works to organize common tasks that are spread across large portions of an application, such as logging or security, and isolating them into stand alone aspects of the code. Then they can be joined through advice code to the other portions of the application in the typical model.
Rest assured that OOP is alive and well, as is Aspect Oriented Programming, Functional Programming and Procedural Programming. One of the signs of maturity in an application developer is being able to recognize the strengths of each style and finding how to use them to provide solutions. To best prepare for the future, be open to exploring a new way of thinking about programming and adding new tools to your repertoire.