Lately I am losing my trust in OOP. I have already seen many complaints about common OOP misuses or just simple overuse. I do not mean the common confusion between is-a and has-a relationship. I mean stuff like the problems of ORM when dealing with relational databases, the excessive use of inheritance from C# and also several years of looking at code with the same false encapsulation belief that Scott Meyers mentions in the item 23 of Effective C++
I am interested in learning more about this and non OOP software patterns that can solve certain problems better than their OOP counterparts. I am convinced that out there there are many people giving good advice on how to use this as an advantage with non pure OOP languages such as C++.
Does anyone knows any good reference (author, book, article) to get started?
Please, notice that I am looking for two related but different things:
OOP is still one of the dominant paradigms right now. But that might be due to the success of languages who happen to be OOP. Java, C++ and Kotlin rule mobile for Android and Swift and Objective-C for iOS so you can't develop software for mobile unless you understand the object-oriented approach.
These include: design patterns, abstraction, encapsulation, modularity, polymorphism, and inheritance. When not to use OOP: Putting square pegs in round holes: Don't wrap everything in classes when they don't need to be. Sometimes there is no need and the extra overhead just makes your code slower and more complex.
As a beginner, OOP is also more difficult to read for several non-code related reasons. First, it's near impossible to understand why a piece of code exists if you're unfamiliar with the domain being modeled with classes. Secondly, OOP is a craft and is inherently opinionated.
Poor naming of classes. Use of too many design patterns in a small space. Working too hard (rewriting functions already present in the framework, or elsewhere in the same project) Poor spelling (anywhere) and grammar (in comments), or comments that are simply misleading.
Well I can recommend you a book Agile Principles, Patterns, and Practices in C#. Examples are in C# of course, but the idea of the book is universal. Not only it covers Agile but also focuses on bad practices and shows in examples how to convert bad code to a good code. It also contains descriptions of many design pattern and shows how to implement them in semi-real example of Payroll application.
This has to be done but if you truly want to get away from OOP or at least take a look at concepts which are not OOP but are used with great effectiveness: Learn you a Haskell. Try a new programming paradigm and then start seeing where you can apply much of the concepts back to OOP languages. This addresses your second bullet, not in a direct way but trust me, it'll help more than you can think.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With