3 ms·
>Object-oriented programming is about objects: bundles of state and behavior. That means hiding state, and having it spread throughout the app, in places that
by DeathArrow 3y ago
>Object-oriented programming is about objects: bundles of state and behavior.
That means hiding state, and having it spread throughout the app, in places that are hard to find, which is error prone and leads to complexity. And monstrosities like FactoryFactoryFactory [0] and Kingdom of nouns.
[0] https://factoryfactoryfactory.net/ https://factoryfactoryfactory.net/
[1] http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom...
- usrbinbash 3y agoI don't see how. Golang has first class support for bundling state and behavior: Receiver-Functions, often called methods. This means exactly 2 things; a) That for a type `Foo` I can do this: f := Foo{} f.funcThatUsesFoo() instead of this: f := Foo() funcThatTakesFooAsFirstArgument(f) and b) that Foo implements all interfaces whos method signatures it's receiver functions satisfy. It doesn't mean that I now have to suddenly drown my code in over-architectured patterns just to satisfy some OOP sense of code-aesthetic. It doesn't mean that I have to try and hide state from code in the same module. It doesn't mean that I have to bundle things that could be free-standing functions into some type just because. It doesn't mean I have to make any of the mistakes OOP popularized over the years.
- deleted 3y ago[deleted]