Skip to content
jhasenzahl edited this page Sep 1, 2012 · 4 revisions

To keep our code uniform throughout the project, I propose that we try to adhere to the following standards. Some of these are Java recommended and some are just my own thoughts. Please update this page with any good standards that you can think of.

###Java###

  • Classes: Begin each word with an uppercase letter. Last word should be what type of object the class will create. Example: AddTaskActivity
  • Methods: The first word is lowercase and the rest start with an uppercase letter. Example: parseTask
  • Variables: Words are lowercase and separated with an underscore. Example: task_name
  • Constants: Words are uppercase and separated with an underscore. Example: EXTRA_TASK
  • Comments: Follow Android and Java standards. Make sure GPL is at the top of each source file.

###XML###

  • Strings: Words are lowercase and separated with an underscore. The first word should describe what type of element the string is for. Some common ones are Menu items (menu), TextView (text), EditText (edit), Button (button), and RadioButton (radio). Example: button_create_task
  • IDs: Words are lowercase and separated with an underscore. The first word should be the type of element, same for strings. The next word should describe which activity the ID is for. This will help avoid conflicts. Example: menu_main_settings

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

Clone this wiki locally