numinous vs olympic abstractionshttps://twitter.com/LTF_01/status/1004061149812404224 …
-
-
if you're trying to do traditional OOP it's "good, actually". if you're using a different paradigm it's only piece-wise good. separate discussion entirely as to when and where OOP is a good choice (spoiler: much less often than OOP is used in practice).
-
tbh i have no idea whether i'm doing trad OOP or some freakish variant at this point but coming it at it from a real object-level POV it's hard to see what having to build the glue to call car.getWindshieldThickness() instead of just doing car.windshield.getThickness() buys me
-
but i know there are cases where i felt like that glue was definitely the best thing; apparently they're a little more esoteric because i can't produce one on demand) so i'm left feeling like it's the usual "overstate the applicability of a rule to try to get ppl to do it at all"
-
maybe you're misunderstanding it? this is Law of Demeter compliant implementationpic.twitter.com/XRVAZwlrA5
-
right, honestly when windshield has 30 properties the clutter of basic bitch getWindshieldThickness()es offends me
-
well, look, we're talking about traditional by-the-book OOP so at some level you have an interface defined for both Car and Windshield so you are by no means required to have getters for all 30 properties, only the ones your interface defines.
-
building on that though, if windshield is a public member attribute then you don't have to go through with all the boilerplate of pushing up one layer of encapsulation. presumably you want to do that because the example I showed has a IoC/dependency injection thing going on.
-
it might not though. you get just set or reset the windshield after object construction. that's not wrong, per se, it just means that in your design spec the windshield component is an interface.
- 5 more replies
New conversation -
-
-
i don't code and never had so i can confidently state it's Bad and Nobody Should Do It
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.