Explain the importance of style and naming conventions in code.


Teaching Note:

Students should understand that meaningful identifiers, proper indentation and adequate comments all improve the readability of code for humans and thus save money, time and effort in programming teams.

INT, AIM 5 The need to develop a common “language” to enable collaboration across international frontiers when resolving problems.


Sample Question:


JSR Notes:

meaningful identifiers
- either you, many months or years later, or other programmers at some point where you are no longer immediately available to offer help, will surely be re-looking at your code at some point. So you NEED to make your identifiers of variables and methods and classes to be clear. Certainly don't make them too long, but better to err on the side of caution, and be clear if a little long in your choice of identifier names.

proper indentation - code is so, so, so much easier to read if indentation is correct, and this should be easy to do with most modern IDEs (Integrated Development Environments), simply with a keyboard shortcut or click of a button. But don't forget.

adequate comments - again, you never really understand the importance of this until you have to go back and try to figure out some code that you once upon a time understood. Commenting is simply something you must develop as a habit of a good coder.