Difference between revisions of "Coding Standards"

From Teknologisk videncenter
Jump to: navigation, search
m (Created page with "*[http://www.terminally-incoherent.com/blog/2009/04/10/the-only-correct-indent-style/ Read about different C/C++/C#/Java indent styles here - and then vote for your favourite]")
 
m
Line 1: Line 1:
 +
Remember: you shouldn't write source code just for yourself.  What happens if someone else on the team needs to update it, while you're on the beach in Acapulco (or Aggersund)?  Will your boss be pleased if you present unreadable code for the rest of the team to review?  What if you have to make changes to code you haven't seen in the last six months?  One of the most basic elements of good code layout is indentation, as discussed here:
 +
 
*[http://www.terminally-incoherent.com/blog/2009/04/10/the-only-correct-indent-style/ Read about different C/C++/C#/Java indent styles here - and then vote for your favourite]
 
*[http://www.terminally-incoherent.com/blog/2009/04/10/the-only-correct-indent-style/ Read about different C/C++/C#/Java indent styles here - and then vote for your favourite]
 +
 +
The current author prefers Allman (and always has, before he found out that it is twice as popular as the second placed K&R = Kernighan and Ritchie in the above survey! ;-)).
 +
 +
The bottom line is: use a style (either becuase it suits you best or because you have been asked/told to do so) and use it consistently and always...

Revision as of 13:39, 18 January 2012

Remember: you shouldn't write source code just for yourself. What happens if someone else on the team needs to update it, while you're on the beach in Acapulco (or Aggersund)? Will your boss be pleased if you present unreadable code for the rest of the team to review? What if you have to make changes to code you haven't seen in the last six months? One of the most basic elements of good code layout is indentation, as discussed here:

The current author prefers Allman (and always has, before he found out that it is twice as popular as the second placed K&R = Kernighan and Ritchie in the above survey! ;-)).

The bottom line is: use a style (either becuase it suits you best or because you have been asked/told to do so) and use it consistently and always...