When adding a comment on an overridden method, eclipse automagically enters {@inheritDoc} and that's it. Made sense to me but I had no idea what the things does. Well in this case, the {@inheritDoc} and what the default behavior is when there is no comment is the same. Thus for keeping you're code clean instead of cluttering it with unuseful stuff, you could just ommit it. You can still use it if you want to add to the original comment because {@inheritDoc} will copy over the original comment at that place. Something like this:
/**Generating getters and setters for domain objects was the second thing I do most of the time. It seems like a good idea and makes all information easily accessible. On the other hand it makes things so simple that you don't think about encapsulation anymore and do things in the wrong place. A better approach is to wait to create the getters and setters until you really need them and at that time think how you could still keep the data encapsulated.
* {@inheritDoc} and does a lot of other useful stuff.
*/
public void overriddenMethod()

0 reacties:
Post a Comment