My Junior developer told me: OO Design patterns are too complicated and useless

LORY
9 min readJun 3, 2023

I learned a lot from our conversation.

The conversation

Weeks ago, lunchtime.

My junior told me: “I think OO programming does not make sense, It is always over complicated things.”

“Why do you think so?” I asked.

Dude: “You see it always needs to create a bunch of classes even for some straightforward task. I don’t like the idea of being forced to create some classes to finish things”. “for example you see our password validator logic, one function is enough, why even need a class?”

Me: “Agree. you don’t have to. but class hierarchies are just like abstraction tools. consider it as an abstraction of data + functions ‘package’. use them when needed, if not, just leave them. continue with the way which you think simple”.

Dude: “Yes, but I don’t understand why this class idea is even invented, and what are the OO design patterns for? so complicated, and also DI/IOC which seems not necessary”, “And, what is the MVC pattern? the web framework we are using?”, “I like the way how functional programming get things done, it is so simple and less side effect”.

Me: “You are asking about different things, give me some time to consolidate the answer, I promise I will send you the link”.

To get back the details to my dude. I asked myself this first question: “What’s the core idea of object-oriented programming”.

OOP

So as I could recall some famous OO patterns like template method, factory, singleton, a chain of responsibility, and decorator.

They are all trying to do something in common — control.

  • Template method. main flow control. derive the ‘step’ implementation in the concrete class.
#include <iostream>
#include <memory>
class View { // AbstractClass
public:
// defines abstract primitive operations that concrete subclasses define to implement steps of an algorithm.
virtual void doDisplay() {}
// implements a template method defining the skeleton of an algorithm. The template method calls primitive operations as well as operations defined in AbstractClass or those of other objects.
void display() {
setFocus();
doDisplay();
resetFocus();
}
virtual ~View() = default;
private:
void setFocus() {…

--

--

LORY

A channel which focusing on developer growth and self improvement