“Software technology has barely changed from the ‘60s” — says Robert C. Martin
And he is kind of correct. We still using conditionals, iterators and assign operations what programmers used to do almost 50 years ago.
Robert C. Martin has a different point of view about the programming paradigms than Wikipedia and it is worth to acknowledge.
Best Coding Languages to Learn in 2019 | Data Driven Investor
During my years as an undergrad, I skipped many night-outs to pick up Java hoping it would one day help me get ahead in…
His book Clean Architecture 📘says that despite the stability in the fundamentals of software technology, there were three programming paradigms composed long ago which are still significant in nowadays world.
1. Object-Oriented Programming 🔌
The first object-oriented language was created in 1966. Ole-Johan Dahl and Kristen Nygaard created Simula-67.
The definition of OOP is quite slippery. It is common to say, that OOP language is the one which best represents the real-world activities and relations.
Some say that OOP gives us encapsulation, but encapsulation was possible in C. Also it is usual to think that inheritance is a key feature of OOP, but that was possible in C language too, not so explicit, but it was.
Polymorphism is another key feature that we think of when describing the OOP language. Polymorphism existed long ago when on different machines people started to use the same software. Different peripherals needed to have the same interface for software to consume them. So polymorphism also was not introduced by OOP? Pointers were being used in C to apply polymorphism long ago. But the OOP made polymorphism easy. Using pointers is kind of wild west, a set of manual conventions prompted this usage in C. Object-oriented languages made polymorphism much safer and much convenient. Thus when describing OOP we should underline polymorphism feature.
2. Functional Programming 📚
While other paradigms can be complicated to explain this one is fairly easy. The key concept of functional programming is immutability.
Functional programming is not mutating variables, but creating new ones. This can help avoid problems that we face while writing concurrent code. All the race conditions, deadlocks, concurrent update problems occur because of variable mutations. Anyway, because we do not have infinite memory and processor speed, full immutability rarely applies to strategy.
3. Structured programming 🔨
Structured programming is trivial and is being used by almost every programmer daily. This paradigm encourages the use of conditionals, repetition constructs, and block structures. Many of us probably did not even write a single program without using them. Then you may ask me — “What was before structured programming?” Let me tell you the story.
This paradigm was conceived by Edsger Dijkstra in 1968. He recognized that programming is hard and programmers don’t do it very well. Code with any complexity can fail in surprising ways. His solution was to apply the mathematical discipline of proof to prove that code is correct.
During the research, Dijkstra determined that Go To statements prevent the code from being decomposed into smaller chunks to be proven.
He wrote a paper called “Go To Statement Considered Harmful”. Dijkstra escalated a problem that Go To statement makes code less human-readable which leads to more error-prone software, especially when the changes have to be made for existing code.
Paper that Dijkstra wrote suggests using if/else conditionals and while loops instead of Go To statements. Suggested control structures are language constructs that are controlled by programming language itself and interpreted always the same by everyone who reads the code.
There is a construct which was not mentioned by Dijkstra — it is functions/methods. They help to avoid Go To statement the most in my opinion.
Nowadays it is nothing special using these handy language constructs, but back at the time, it was a thing.
Are they legit? 🛂
The point of view about paradigms produced by Robert C. Martin is quite strange for me because it is quite different from the one which can be found in the tech media. Anyway, I would agree with the author that these three really made an impact:
Each of the paradigms is restricting us from something. None of them have added power for us — programmers. Over the last half-century, we have learned what not to do.
These programming paradigms are time-tested and whole languages are based on them, so no matter if we acknowledge them or not — they live in our code 😊