开发者

What are some rules of thumb for naming classes that extend Android's Activity class?

开发者 https://www.devze.com 2023-01-23 22:11 出处:网络
I go back and forth about how to name activity classes.Activity seems to imply a verb, like EditContact, for example.But that seems more like what one would call the Intent that trigge开发者_如何学Crs

I go back and forth about how to name activity classes. Activity seems to imply a verb, like EditContact, for example. But that seems more like what one would call the Intent that trigge开发者_如何学Crs EditContact. Should the activity be named ContactEditor instead?


Interesting question. There is no right answer to this.

Personal opinion: Activities represent "places" in my application, so I name them accordingly: UserSettingsEditorActivity, MainScreenActivity, etc..


I've worked with a few projects and there doesn't seem to be a set way of doing it, and generally I follow the golden rule of name something by what it does. In this case, ContactEditor would be better, save your verbs for functions.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号