HN2new | past | comments | ask | show | jobs | submitlogin

I've underutilized Python's OO system and I've certainly overutilized it. The light bulb moment for me was when I read: "prefer composition to inheritance". Which Wikipedia tells me comes from "Design Patterns" but I'm pretty sure I remember the argument from "Working Effectively with Legacy Code." Obviously it's not a hard rule to avoid inheritance, but once I started asking myself, "Is this relationship an is or a has?", my designs got a lot better. And by better I mean they quit making me angry when I revisited them months later.

PS. Highly recommend that book BTW. Especially (and somewhat ironically) for people designing new systems. Everything is eventually legacy. :-)



Usually when someone says they hate OOP they really mean that they hate inheritance and no one taught them about composition.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: