rules to better code – in English

The site
It is a must read.
Some observations, though :

Rules to Better Code
15.Do you have the time taken at the end of a long process?

It’s good to have the time * but to display in another box to force the user to push an OK
It’s better (like you said) to have a status bar for this

20.Do you use interoperability mechanism for COM object?
CreateObject is usefull, in my opinion, in one situation:
You want your program to function with Word 2000 and Word 2003.
You do not want to have 2 programs with 2 references – but you know for sure that the
function you call are the same in both Words.
So – you reference Word2000, create the project, compile, remove New Word.Application with
CreateObject  – and recompile.

33. Do you use Asynchronous method and CallBack when invoke web method?
You can execute the synchronous call to the web service in a background thread ( or other asynchronous method)

Better Dot Net projects
26.Do you Open your Connection in a Try Block?

Note:Do not use the ‘using’ keyword in C#. The using keyword is used to declare a scope out of which the connection will be disposed. For the sake of consistancy, we like out VB.NET and C# projects to be as similar as possible. For both languages you should use a Try..Catch..Finally block.   
end quote

VB2005 HAS using(vezi sau and I prefer using over try catch finally

Rules To Better Windows Forms

26.Do your List Views support multiple selection and copying?
Make it easier for the user by enabling the “MultiSelection” property of a ListView and providing a right click menu with a “Copy” item that copies to the clipboard.
end quote
Make the same support for CTRL+C

Rules to Better Interfaces

33.Do you provide a warning before the program exits?
In 99% percent of cases, the user is right – he really wants to exit. If all documents are saved, then exit.
For 1% of cases that a user makes a mistake, do not bother you with that.

Leave a Reply

Your email address will not be published. Required fields are marked *