In this article, we will try to understand why OOP is the worst thing that happened to programming, how it became so popular, why experienced Java (C#, C++, etc.) programmers can’t really be considered great engineers, and why code in Java cannot be considered good.
Unfortunately, programming is quite far from being a science (just like me), so many terms can be interpreted differently. Let’s first define them. I should warn you that these definitions are my subjective opinion, an attempt to bring order and fill in the gaps. Constructive criticism is welcome.
Definitions
[Data] structure — pure data that does not contain any processing logic (functions).
— pure data that does not contain any processing logic (functions). Function — a block of code that performs a specific logic. It can return a value.
— a block of code that performs a specific logic. It can return a value. Object — an entity that contains both data and functions to process them — methods. An object can be imitated in FP by placing data and functions in the same structure. In classical OOP, this is always an instance of a class.
— an entity that contains both data and functions to process them — methods. An object can be imitated in FP by placing data and functions in the same structure. In classical OOP, this is always an instance of a class. Class — a blueprint for creating objects, defining their data and methods. The foundation of OOP.
— a blueprint for creating objects, defining their data and methods. The foundation of OOP. Method — a function that is part of a class. Instance methods (non-static) have a reference to the object itself ( this , self ), with all its data and methods, which is essentially a implicit first argument.
— a function that is part of a class. Instance methods (non-static) have a reference to the object itself ( , ), with all its data and methods, which is essentially a implicit first argument. Functional programming (FP) — programming using structures and functions. Do not confuse with functional (math) style.
— programming using structures and functions. Do not confuse with functional (math) style. Object-oriented programming (OOP) — programming using classes, objects, and all their features — inheritance, encapsulation, polymorphism, etc. If desired, one can mimic structures using classes [almost] without methods and functions with static methods in static classes.
... continue reading