Programming Paradigm?

Gabriel Castro
4 min readFeb 23, 2021

--

I am still pretty new to programming but now that I have a little bit of code behind me, I find myself having more questions then answers. For example, OOP(Object-oriented Programming) why is this methodology considered the gold standard of modern day frameworks? Having no traditional background in computer science, I thought it would be interesting to look at the methodology of OOP and others that make up languages used today.

The Four Pillars

OK let’s start here, Object-oriented Programming. Just what is it? Well OOP has 4 unique principles that it follows, Encapsulation, Abstraction, Inheritance and Polymorphism. Essentially OOP is designed on the basis of objects, which in turn contain data referred to attributes or properties, and code in the form of procedures usually referred to as methods. Whew, now that we got all that out of the way, let’s take a look at these four principles in practice and what exactly they entail.

Encapsulation: This idea refers to the building of data and methods that operate in a single unit; usually these take the form of a class. These classes can be used to restrict access to components, that prevent a user from access certain state values. Best example I have seen is to think of Encapsulation as a car, this car has properties such as the make, model and color. It also has methods like start(), stop() and move(). These are all encapsulated in a class called car. — Programming with Mosh.

Abstraction: The concept of handling complexity in code by hiding unnecessary information from the user. This allows for our user to implement complex logic without having to know the hidden complexity underneath. Back to the car example, in the morning when you go out to your car you simply unlock your door, put your key in the ignition and flip it over. You might turn on the radio or put even put the heater on. What you don’t need to know is how the engine works, how it knows when to fire what piston to force the gas which expands the cylinders to the crankshaft to turn the wheels. — autobutler.

Inheritance: Eliminate Redundancies. Lets take HTMLElement for example, TextBox, Select and Checkbox have common properties like hidden, innerHTML and methods like click() and focus(). Instead we can create a generic object like HTMLElement and have these other objects inherit from this one object type. — Programming with Mosh.

Polymorphism: Many Forms. This principle allows us to use one method such as render() and based of the type of the object being reference will preform a set of instructions. — Programming with Mosh.

As we can see OOP has some amazing benefits for modern frameworks, these really help to streamline our code to help keep it clean and clear of unnecessary redundancies. Some examples of OOP languages include Java, JavaScript and Python. Lets take a look at a couple other methodologies however, and just how they stack up in comparison.

Procedural

These are imperative programming languages, they use statements that change a programs state. I like to think of these as a little bit more straight forward then OOP; they use a concept of procedure call, this executes a set of instructions to preform a specific task. As you can imagine from the diagram above this type of top down approach can get pretty messy, with functions pointing to other functions to preform actions. These type of languages still have great value, such as COBOL, this language which derived from the late 50’s, is still used today for business, finance and government agencies.

Functional

If Procedural programming are all about control, Functional programming is the opposite that employees a declarative style of building structure and elements of programs without describing its control flow. — Wikipedia

So what exactly is control flow? simply put its the order in which programs are executed, from statements to function calls. The benefit of applying functional programming is to minimize the side effects of what a program must do. These side effects can be thought of unintended consequences of modified state or values. Although LISP is not a true Functional programming language its one of the older ones. LISP helped with some of the core concepts in computer science today such as tree data structures, conditionals and higher-order functions.

Conclusion..

In conclusion what I have found is languages have evolved with the technology that is being built. These are not the only programming methodologies, these just were a few that interest me. Below are some resources on programming paradigms.

--

--

Gabriel Castro
Gabriel Castro

Written by Gabriel Castro

Full Stack, Software Engineer. Focus in Rails, JavaScript and React.

No responses yet