Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

GUI is to me the field where inheritance actually makes a lot of things easier and natural.

I would invert that and say GUI frameworks are why bad OO/excessive inheritance is so ubiquitous. I have no idea why all the major frameworks have these horrible inheritance hierarchies, there's really no excuse for it.

In my UI days, I would avoid this by having a Window or Component class extend nothing, housing the necessary component as a field. I'd extend it only if I had to (rarely, and even then usually just one or two methods), and expose it with a getter. Cleaned things up a LOT.



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

Search: