4 ms·
Here's my hot take. Most patterns are incredibly awful and abused because people prefer to solve architectural related problems in code and produce "elegant" so
by boredumb 3y ago
Here's my hot take. Most patterns are incredibly awful and abused because people prefer to solve architectural related problems in code and produce "elegant" solutions over delivering features.
Here's my pattern that I use instead of a MVC/MVVM/MVP/etc/etc: I have a handler function to choose what url and routine I need and it calls some functions and methods and then renders some json / templates out some html.
I think a good rule of OOP is to try to write everything out as functionally pure as possible and refactor into classes when you see data AND functionality blocked together that you can bottle up into an object. To start ranting, I think a lot of the OOP insanity you see in .net/java/etc is from dogmatic approaches to unit testing over there and the common examples of how to do it involving the mocking and interfacing that end up obfuscating the actual production code.
- koromak 3y agoYou can kinda argue whatever you want when it comes to this stuff. It doesn't really matter. Is the code readable? Does it not make me angry to look at? Yes? Then its good enough. I don't care if the object has one method that probably should be a function. I can still read it fine.
- boredumb 3y agoI agree. The problem these OO patterns tend to introduce is unneeded levels of abstraction that all boil down to making the code difficult to read without three wide screen monitors.
- paddim8 3y agoNot inherently. You get unneeded levels of abstractions if you add them yourself. You can follow these patterns without doing everything at once.