Brian

24%
Flag icon
Designing for inheritance involves more than just documenting patterns of self-use. To allow programmers to write efficient subclasses without undue pain, a class may have to provide hooks into its internal workings in the form of judiciously chosen protected methods
Brian
I like seeing this done well. It can really make development within a larger framework very efficient when repetitive, annoying tasks are just taken care of for you. I see a lot of @nnotations trying to abstract this even further from the code, but prefer explicit abstract patent classes to provide this. It’s hard to know all of the needed hooks to create though and you may often revisit the hooks design over time. If you own all the code, no problem though, this ends up being small cost when amortized over years. But woah, if you’re building a framework for others, look out! :)
Effective Java
Rate this book
Clear rating
Open Preview