Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Lines of code
Message
From
26/09/2002 09:52:19
 
 
To
26/09/2002 09:17:14
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00704650
Message ID:
00704662
Views:
34
Hi!

Hilmar, I think the world is left accounting code lines and accounts time spent on development. Code lines were accounted when there were no graphical tools and only way to develop programs was to write code in text file and compile by compiler, then run. In VFP and alike tools here also we have design, and a lot of code change because we see results immediately, and thus have more time for "experimenting" to get the best result.

For example, time spent on development of some complex algorithm in 100 lines of code might be significantly greater than creating 10 forms with a lot of controls that would produce 10000 lines of code. At least this is true for VFP. In your case you should define a "value" for code line for each different module, and, say, value for VFP form will be significantly less than value of code line for class library or for PRG file. This is because class library usually takes more time for development per code line, and the same is for PRG.

And I doubt you will even reach correct evaluation, because code line value is very different and dependent on many circumstanses...



>I have seen statements that such-and-such a program had so-and-so many lines of code. How would such a thing be calculated in an IDE like VFP, where a great part of the development is done with the property sheet, or moving objects around with the mouse?
>
>Of course, I am aware that any definition of how many lines a specific form has is arbitrary, but I would still appreciate any ideas on how this might be handled.
>
>One possibility is to convert the form to text with the class browser. Another is to use scctext.
>
>For reports and menus, the class browser can't generate code, so I use scctext. The results are terribly inflated - that is, a large amount of lines for a relatively simple report.
>
>For anybody interested, here is my current code to count lines. I thought about publishing it in the FAQ section, but I wanted some ideas on the points mentioned above, first.
>
>
>
>* Create statistics (line count) for project
>* By Hilmar Zonneveld
>
>* Because of the commands used - especially project properties - this program
>* requires VFP 6 or later.
>
>* Execution can take a long time for a large project.
>
>* Disclaimer: I consider any intent to count the number of lines in a project as prone to
>* differences in opinion, inaccuracies, or even manipulation.
>* For instance:
>*   Should comments and blank lines be included in the line-count, or not?
>*     A well-placed comment can be as important as a line of "real" code!
>*   What to do about development that is basically not stored in a text-file -
>*     like a form or report where you work mainly with properties,
>*     in the property sheet?
>*   An inefficient project, with lots of duplicate code, where inheritance or function
>*     calls should have been used, will give an impressive line-count.
>
>clear all
>if type("Application.ActiveProject") # "O"
>	MessageBox("Please open the project you want to analyze.")
>	return
>endif
>create Table TmpLines (FileName C(30), Type C(1), LineCount I, Contents M)
>do (_browser)
>local lcTextFile, lnLineCount, lcFileContents, lnFileCount
>lnFileCount = 0
>FOR EACH oFile IN Application.ActiveProject.Files
>	if oFile.Type $ "PKBVMRB"
>		lnFileCount = lnFileCount + 1
>		wait window nowait "Processing File #" + trans(lnFileCount) + chr(13) + chr(10);
>			+ oFile.Name
>		do case
>		case oFile.Type = "P"
>			lcTextFile = oFile.Name
>		case oFile.Type $ "KBV"
>			_oBrowser.AddFile(oFile.Name)
>			_oBrowser.ExportClass(.F., "temp.txt")
>			lcTextFile = "temp.txt"
>			_oBrowser.RemoveClass()
>		case oFile.Type $ "MRB"
>			* Because of the method used, line count is terribly inflated
>			* for menus, reports and labels (see output in memo field)
>			do (_sccText) with oFile.Name, oFile.Type, "temp.txt", .T.
>			lcTextFile = "temp.txt"
>		endcase
>		lcFileContents = FileToStr(lcTextFile)
>		lnLineCount = occurs(chr(13), lcFileContents)
>		insert into TmpLines (FileName, Type, LineCount, Contents);
>			values (justfname(oFile.Name), oFile.Type, lnLineCount, lcFileContents)
>	endif
>ENDFOR
>
>*!*	Codes for file-types:
>*!*	d	Database
>*!*	D	Free Table
>*!*	Q	Query
>*!*	K	Form
>*!*	R	Report
>*!*	B	Label
>*!*	V	Visual Class Library
>*!*	P	Program
>*!*	L	FLL
>*!*	Z	APP
>*!*	M	Menu
>*!*	T	Text
>*!*	x	Other
>
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform