c# Coding guidelines & conventions

  • Thread starter Thread starter jarit
  • Start date Start date
Found these coding guidelines for C#, HTML, Javascript, Java, HTML,
PL/SQL, T-SQL, VB and VBScript.

Well written and free to download.

Though not free to use in a commercial setting.

There seems to be very little actual *useful* C# stuff in there though.

The author seems unaware of the "using" statement, and doesn't roll
back failed transactions (or dispose of them, despite saying just a
page earlier that you shouldn't forget to call Dispose). Frequent
examples catching bare Exception aren't encouraging either.

I would also have liked to see

if (x)
y;

avoided in favour of

if (x)
{
y;
}

In short, I certainly wouldn't pay $99 for the privilege of using these
in a commercial setting.

(By the way Jeroen, you're not the same Jeroen who appears to be one of
the authors of the document, are you? After all, you then couldn't
honestly say you'd "found" these coding guidelines.)
 
Hi,

Found these coding guidelines for C#, HTML, Javascript, Java, HTML,
PL/SQL, T-SQL, VB and VBScript.

Well written and free to download.

www.demachina.com/products/swat

I enjoyed the statement "Follow the simple guidelines described in this
document and you won't encounter a single problem ever. Promise"

Yeah sure, all bugs can be traced to sloppy coding conventions.
 
Found these coding guidelines for C#, HTML, Javascript, Java, HTML,
PL/SQL, T-SQL, VB and VBScript.

Well written and free to download.

www.demachina.com/products/swat

Oh, I've only just looked at the Java section. The string concatenation
section is a real laugh, showing that the author really doesn't know
Java particularly well. While it's a good idea to use a StringBuffer
when concatenating strings in a loop (or with other temporary copies),
the code example given is just a less readable version of the code
which the compiler would have generated for

return "The value of "+name+" is "+val;

(In fact, with Java 1.5, the latter would be *faster*, as it will
automatically use StringBuilder rather than StringBuffer.)


Specifying that reflection just shouldn't be used is foolish - there
are lots of places where it makes perfect sense to use it. It shouldn't
be *overused*, but that's a different matter.


Suggesting the direct use of Log4j but talking about this being
reviewed in the long term is foolish when the Commons Logging project
allows you to use common logging code which will then use whatever
logging implementation you want underneath. Saying that debug logging
isn't very granular suggests a lack of understanding of Log4j - you can
very easily turn debug logging on just for one class, assuming you
choose your logging categories appropriately. (Calling Logger.getLogger
with the *name* of the class rather than the class itself is also
somewhat odd.)
 
Found these coding guidelines for C#, HTML, Javascript, Java, HTML,
PL/SQL, T-SQL, VB and VBScript.

Well written and free to download.

www.demachina.com/products/swat

Oh, just found another amusing bit - the HTML guidelines.

Immediately following a section talking about standlone HTML pages
having a long comment at the start, it says to make sure that the HTML
is optimised, and to remove excess tags. What, you mean like a large
comment?
 
I really like the microsoft patterns and practices, they are really very
useful for stuff like optimizing perf and best practices for data access and
stuff. They are must for every developer starting to develop for the .NET
Framework.
 
Jon said:
Suggesting the direct use of Log4j but talking about this being
reviewed in the long term is foolish when the Commons Logging project
allows you to use common logging code which will then use whatever
logging implementation you want underneath.

Slightly OT remark: Commons Logging lacks MDCs and NDCs, which are
quite useful for certain types of applications.

(I'll suppress my urge to whine about Commons Logging classloading
issues here ;->)

We're now switching back to our C# program...

Cheers,
 
Back
Top