Friday, May 11, 2007

Visual Studio 2005 Tips & Tricks #1 - Automatically format the code

Visual Studio 2005 Tips & Tricks - Automatically format the Code

I have seen many managers pay more attention to how code is written (mainly to alignment, spacing and indendation), even previous programming languages like FORTRAN 77 & COBOL 65 had particular column numbers where we need to code exactly.

But mainly coding is formated to make it more readable and to look neat for another developer to read and to try to understand.

But most of the developers do not align their code properly making it worse to read and understand, though this is not a new feature in VS2005 it is one of the essential features for any IDE to possess and here it is. Note: It is also present in VS2003, and other famous editors like homesite etc but many developers do not use it and still we see poorly aligned code making it hard to read.

Open the IDE, go to Edit >> Advanced >> Format Document, and
the source and code behind is automatically formated and aligned very neatly with indendation.



Read more tips coming soon on my blog.

Tale of a .Net Component

Most of dot net books or articles on the web are task based, meaning they explain a method or a property or a small task and explain how to do it and the entire MSDN is something similar.

It is very rare to find a full fledged project implementation or a book which explains how to code a project, from scratch to rollout and updates.

If we look at real life that is what one expects, the best practices how to seperate layers of code, when to write components vs when to write controls, how to reuse code, but there were few implementations in the past like the pet shop project where an entire project was given as download for enthusiastic developers to learn. That is how i coded my first dot net project not by learning from a book or from msdn but by looking at the code of a sample dot net project provided by microsoft.

Today was the last post of a 5 part series explaining from scratch how to write a dot net component, i liked this article a lot and hence am posting it on my blog.

Tale of a .Net Component - Part 1 (Explains the requirement & the design)
http://www.devsource.com/article2/0,1895,2095440,00.asp

Tale of a .Net Component - Part 2 (Explains the class design)
http://www.devsource.com/article2/0,1895,2097685,00.asp

Tale of a .Net Component - Part 3 (Properties creation)
http://www.devsource.com/article2/0,1895,2099681,00.asp

Tale of a .Net Component - Part 4 (Depth in to code)
http://www.devsource.com/article2/0,1895,2104404,00.asp

Tale of a .Net Component - Part 5 (Testing & Rollout)
http://www.devsource.com/article2/0,1895,2111753,00.asp

The author of this excellent series is Peter Aitken (author of more than 40 books), http://www.pgacon.com/default.htm

I am sure any developer would love to read such articles.