Click here to Skip to main content
15,890,382 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
How to Write a Better Code Which is easy to understandable and has less LOC.
I mean What are the Key Point i have to Remember when writing a code.
and how to calculate the executable time of a code in aspect to most Environment.
If I am wrong at anywhere Please Correct it.
Posted

In general, "more understandable" and "less Lines of Code" are mutually exclusive. Reducing lines of code frequently reduces readability, and thus understandability.

There is no magic formula we can give you to write good code. It's a combination of a readable, consistent style, with good design and documentation, and (in general) adherence to standards and Best Practice guidelines. It's experience that makes good code, not Key Points.


It is difficult to calculate execution time from a look at the source - certainly Lines of Code estimate will not help: a single line of code could look innocuous but take minutes to execute:
C#
foreach (MyClass mc in list) mc.Save();


You can measure it though - look at the Stopwatch class[^]
 
Share this answer
 
Comments
Mohd Imran Saifi 7-Jul-12 7:10am    
Thanks for the Explanation.
Andreas Gieriet 7-Jul-12 8:17am    
My 5 for this answer!
Andi
Sergey Alexandrovich Kryukov 7-Jul-12 22:59pm    
Agree, a 5.
--SA
To calculate the executable time of a code

Enable trace in ur application. which will provide the execution time details

To know more about it, visit the following urls
http://msdn.microsoft.com/en-us/library/0x5wc973.aspx[^]

http://msdn.microsoft.com/en-us/library/94c55d08.aspx[^]
 
Share this answer
 
Comments
Mohd Imran Saifi 7-Jul-12 9:35am    
thanx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900