Hacker News new | past | comments | ask | show | jobs | submit login

Views in UI toolkits are the best example I know for an is-a relationship. A button is a view, a slider is a view. A container may have heterogenous children, but all of them are views. An interface doesn't work, because you would have to implement basic properties like containment, geometry, etc. separately for every widget.

To my knowledge, nobody has found any better design than this, though some have found worse ones (e.g. HTML and its bizarre input element).

To your specific points:

1. Yes, NSResponder should definitely have been an interface. See for example the weird way that documents and delegates are spliced into the responder chain.

2. The fact that NSMutable* is-a NS* is a lovely design. Mutability can be understood as adding setters to a class that doesn’t have them. The alternative seems to be weird duplicative splits like ArrayList/Array, or String/StringBuilder/CharSequence.

3. Agreed; it’s a failing of ObjC that it’s usually unspecified whether a method is designed to be called, to be overridden, or both. I wish this were enforced at the language level.

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