Click here to Skip to main content
15,881,089 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is there any tool that can help to count the length of my solution, with blank lines and without blank lines. My solution is very large, now the client need to know the line of code done so far. So in case if you know any such tool please help.
Posted

Take a look at this great article : Line Counter - Writing a Visual Studio 2005 & 2008 Add-In
 
Share this answer
 
Comments
Anuja Pawar Indore 23-Sep-11 5:33am    
Thanks, this is what my client needs
Why? Lines of code is a pretty useless metric - is it worth counting a block start:
C#
if (condition)
   {
   variable = value;
   }
Is that one line of code? Or two? Or four? Do comments count - they should do, because they are an investment in the future maintainability of the software. Or they shouldn't, because they don't add anything to the "user experience".

If you must, then it is pretty simple to write your own: Use File.ReadAllLines to return the content in line by line form, and then discard blank lines. Recurse through your solution folder, and you are there.
About half an hour to write and test, at a guess. In addition, you can apply your own metrics to the questions above.
 
Share this answer
 
Comments
Mehdi Gholam 23-Sep-11 3:16am    
Generally yes, its a bad metric to be judged/paid on, but I believe it's a good metric if it is used inversely ie the less code you write to get the job done is better!
OriginalGriff 23-Sep-11 4:06am    
Cobblers!
The "Goodness" code has sod-all to do with the size: It can be small but slow and useless, bug ridden and difficult to maintain. Conversely, it can be enormous and slow, bug ridden and inefficient.

What makes "Good" code differs from client to client. If it is control software for an airliner, the "Goodness" is probably counted in terms of peer-reviewed code construction, adherence to specification, maintainablity, fault tolerance, and similar metrics. If it's a FPS game, it's probably speed, lens flare and how far the blood splash travels in a parabola.

Size of source code is completely irrelevant.
Mehdi Gholam 23-Sep-11 4:20am    
The less code you write, the less mistakes you make, and the easier and faster it is to maintain in the future. Not being "slow and useless" is usually part of the requirements to "get the job done".

I agree there are many factors to take into account which are domain specific.

But I still stand by less code is better... in the words of Austin : "it's not the size, but how you use it!" :)
Anuja Pawar Indore 23-Sep-11 5:57am    
I agree to you OriginalGriff, but this was a requirement by my client, as the application line was increasing a lot, and he had some plan to change the app. to a new look. So he wanted to no, so far how much line of code is already being done. This people are working on this app. from past 1.5 years. So was imp. from his point. Hope you undrestand my concern.
Hi,
This could be done by writing 5/6 line of code so far, the steps are listed below:
(i) Read the source file & store into a string type variable.
(ii) Split it with ""NewLinee()" in to arrayList.
(iii) Write a foreach loop to count lines.

I think that's it.
 
Share this answer
 

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