This tutorial was inspired by a speech given by Robert C. Martin that Patkos Csaba watched a year or so ago. The main subject of his talk is about the possibility of picking The Last Programming Language. He addresses topics such as why should such a language exist? And what it should look like? However, if you read between the lines, there was another interesting idea that caught my attention: the limitations that each programming paradigm imposes upon on us programmers. So before we get into how we could go about converting a procedural based PHP app into an object oriented one, he wants to cover a little bit of theory beforehand.
Paradigm Limitations
So, each programming paradigm limits our ability to do whatever we want to do. Each of them takes something away and provides an alternative to achieve the same result. Modular programming takes away unlimited program size. It enforces the programmer to use maximum sized modules and each module ends with a “go-to” statement to another module. So the first limitation is upon size. Then, structured programming and procedural programming takes away the “go-to” statement and limits the programmer to sequence, selection and iteration. Sequences are variable assignments, selections are if-else decisions, and iterations are do-while loops. These are the building blocks of most programming languages and paradigms today.
Object oriented programming takes away pointers to functions and introduces polymorphism. PHP doesn’t use pointers in a way that C does, but a variant of these pointers to functions can be observed in Variable Functions.
Comments
Be the first to write a comment
You must me logged in to write a comment.