This is a mirror of official site: http://jasper-net.blogspot.com/

Best Practices for .NET developers

| Wednesday, January 19, 2011
This is something I'm doing for my team at work...thought you may like a look / comment etc...

Know the SOLID principles…
See http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod (the first 5).  These are fundamental principles for good OO software design, know them…love them!

If you don’t need it…delete it!
As for Code Comments below, never check in an Excluded Class to the source control system. It adds noise and is a great way to have hard to trace exceptions if they’re accidentally re-included.

Code comments
I know it’s in the policy document but to be honest no-one uses generated docs when tests are a better alternative for learning code.

Code comments should only be used to clarify complex algorithms, apart from that they just add cruft to code and make it harder to read. Method / parameter names should be descriptive (I frankly don’t care how long they are, that’s what intellisense is for!). If you can’t work out what a method does from its name…rename it. Or if a method does more stuff than you can reasonably fit in a name, you need to refactor the method.

Keep classes compact
No hard and fast rule here but if you’re >200 lines in a single class think seriously whether you need to refactor. If you follow rule 1 of SOLID (Single Responsibility Principle) then this should rarely happen.

Read more: mostlylucid

Posted via email from .NET Info

0 comments: