Как зарегистрировать метод, который переопределяет другой метод?

Стоит также отметить, что в настоящее время есть меньше веских причин проверять явную ориентацию с помощью getResources().getConfiguration().orientation, если вы делаете это по причинам компоновки, как Поддержка многооконности , представленная в Android 7 / API 24+ может немного испортить ваши макеты в любой ориентации. Лучше рассмотреть возможность использования и альтернативных макетов в зависимости от доступной ширины или высоты , а также других приемов для определения того, какой макет используется, например, наличие или отсутствие определенных фрагментов, прикрепленных к вашей деятельности.

7
задан Janusz 4 July 2009 в 03:57
поделиться

2 ответа

Every method - private, protected public - should be documented describing what it does. Forget about inheriting documentation from a base class - you can include a link to it if you like, but as long as the information is there that it overrides an inherited method then the other person is free to look it up for themselves. DRY - don't repeat yourself - document the base class method in one place only.

I don't even think it is good to document which method it overrides, because that can change and it will be hard to keep it up to date if you insert new classes in the hierarchy between your class and the base class. Simply the information that it overrides an inherited method is sufficient.

If your methods are too complex to document in a few lines of comments, then they are probably too complex and should be refactored.

10
ответ дан 6 December 2019 в 23:12
поделиться

, включая аннотацию @Override, должно быть достаточно, чтобы отправить любопытного разработчика в супер.

1
ответ дан 6 December 2019 в 23:12
поделиться
Другие вопросы по тегам:

Похожие вопросы: