What are Industry Standards?
(Attributed to John Woods)
When we talk about coding standards or code/programming style, we're talking about how your code looks - proper indentation and spacing, self-documenting identifiers, an appropriate amount of documentation, etc. Sticking with programming standards is important for any professional programmer. Writing code that doesn't follow industry standard is considered amateurish, or what some call "Mickey Mouse" programming (no offense to famous rodents). That kind of bad programming has a negative effect: it makes it difficult for you to go back and find errors, make changes, see how you solved a difficult algorithm; it makes it difficult for other programmers to do the same things. This costs a company/client more money and time. Following good programming style and standards prevents you from wasting your client's valuable time and money.
A program that is syntactically and logically correct will run and function just fine, but a program that does not follow industry standards when it comes to coding and UI design is just as bad! Why?
Programs that follow industry standard are:
- Easier to read.
- Many times you or another programmer will have to go back and review code you wrote a while ago. Code that is difficult to read will take longer to decipher, even if you wrote it yourself. It's even more difficult to read someone else's code that doesn't follow industry standard.
- Easier to maintain.
- Clients frequently require changes to existing programs. Whether you wrote the program or someone else did, it's difficult to modify and maintain code that violates standard practices: it can be difficult to find the module you need to change or the values that need to be updated.
- Easier to debug and avoid coding errors.
- As you're coding, if you're not using proper standards like good indentation, spacing, documentation, self-documenting identifiers, etc. it can be very difficult to locate problems with your code. One of the biggest problems I see in class is when a student has a missing brace or semi-colon and can't find it because their indentation is all over the place. If you follow standards properly, you will rarely make mistakes like forgetting a brace or semi-colon. If you name variables properly, you're less likely to type a variable name incorrectly. If you document well, it will be easy to find the complicated section of code that contains a logic error.
- More robust and reliable.
- Code that follows industry standards tends to run better and is more reliable. It tends to be cleaner (e.g. no unused variables, unnecessary program structures, statements, etc) and more efficient.
- More user-friendly and consistent.
- You'll focus on this in term 2.
Tip: In IntelliJ, pressing Ctrl-Alt-L in the editor window will automatically format your code.