This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
tesla1889's profile picture

program name - # lines long!

Started by tesla1889, 02 February 2013 - 06:31 PM
tesla1889 #1
Posted 02 February 2013 - 07:31 PM
why are so many people bragging about how many lines of code are in their programs?

quality is much much better than quantity

take a look at the minix 3 kernel for an example of quality over quantity

it brags about being ONLY 6000 lines

i guess my point is that it doesnt make sense to brag about bulky programs that could probably use some optimization
lieudusty #2
Posted 02 February 2013 - 07:41 PM
I agree with you. Not sure why some people think that a program with more lines is better than a program with less lines.
Luanub #3
Posted 02 February 2013 - 07:50 PM
If the code is clean and the high line count is due to added functionality I can kind of understand it, you think it would be better to brag about the functions rather then the line count though. But to just go off line count alone is a little absurd.
Pinkishu #4
Posted 03 February 2013 - 03:22 AM
Technically you can make any program 1 line long
Mailmanq! #5
Posted 03 February 2013 - 03:41 AM
Lines are a terrible way to count it, for one, what Pinkishu said, as well as the fact that my programs have many empty lines just to make it easy to read. Also if you have a 500 line password lock, is that really necessary, if you can make everything in few lines that shows your skill with how to code and knowing the shorter ways to complete the same task.
Tiin57 #6
Posted 03 February 2013 - 04:18 AM
Yeah, if you use a bunch of ifs instead of a switch, you're just inexperienced. (Does Lua have switch statements? :P/>)
1lann #7
Posted 03 February 2013 - 05:42 AM
Yeah, if you use a bunch of ifs instead of a switch, you're just inexperienced. (Does Lua have switch statements? :P/>)
Nope D: but you could loop through tables or something. Or just use elseif
tesla1889 #8
Posted 03 February 2013 - 05:50 AM
–snippity snip–
(Does Lua have switch statements? :P/>)
god, that would be so nice lol

–snippity snip–
it would be better to brag about the functions rather then the line count though.
–snippity snip–
amen, bro.

actually, a better number to brag about would be the number of functions divided by the length of the program in bytecode

this would force people to optimize everything
dissy #9
Posted 03 February 2013 - 05:55 AM
One of the more annoying sicknesses in the "professional" programming world is to bill/pay by number of lines of code (LOC) - or technically, per thousand lines of code (KLOC)

It started due to inept management who didn't at all understand software, but felt the need to force some sort of measurable metric on it.
If you think about a written report, usually the more words in it the more content it has, and by that metric arguably the "better" it is.

Of course with programming, this does not hold true in most cases, and is out-right reversed in the best cases.

If I can take a 3000 line program and rewrite it to work in 500 lines of code, where it runs 4x faster and removes a bunch of code duplication, by all measures the smaller program is "better" - But how to explain that to a person who does not understand software? Especially when that person doesn't care?
Thus even to this day, LOC and KLOC remain as a metric that some programmers are forced to work under, and the problem spreads from there.

When a person gets paid per thousand lines of code, what incentive is there to make something actually better - as in smaller, more efficient, and with less duplication / less places for bugs to occur?

Once a person gets "stuck" in that mindset, it just becomes one more bad programming habit that needs breaking.
tesla1889 #10
Posted 03 February 2013 - 07:26 PM
^ that is what is wrong with the world of computer science today