4 registered members (Quad, TipmyPip, Nymphodora, 1 invisible),
336
guests, and 3
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: How many Lines?
[Re: Puppeteer]
#302421
12/19/09 11:52
12/19/09 11:52
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
OP
Expert
|
OP
Expert
Joined: Jun 2006
Posts: 2,640
Earth
|
hats off! that's a lot of code in less than 2 months....
~"I never let school interfere with my education"~ -Mark Twain
|
|
|
Re: How many Lines?
[Re: Germanunkol]
#302423
12/19/09 12:34
12/19/09 12:34
|
Joined: Jan 2003
Posts: 4,615 Cambridge
Joey
Expert
|
Expert
Joined: Jan 2003
Posts: 4,615
Cambridge
|
Some friends of mine coded Tetris in our school's Delphi course. It worked, and when we all had to present our projects in the end everyone was stunned by them, because they scrolled through one huge file showing some thousand lines of code. What they actually did was draw every Tetris block in every orientation in its own function and for every keystroke and every block and (!) every orientation they had a separate function checking the block against the level. This was so plain stupid I hardly fell of my chair when they showed me the code. I want to cite Steve Ballmer: In IBM there's a religion in software that says you have to count K-LOCs, and a K-LOC is a thousand line of code. How big a project is it? Oh, it's sort of a 10K-LOC project. This is a 20K-LOCer. And this is 50K-LOCs. And IBM wanted to sort of make it the religion about how we got paid. How much money we made off OS/2, how much they did. How many K-LOCs did you do? And we kept trying to convince them - hey, if we have - a developer's got a good idea and he can get something done in 4K-LOCs instead of 20K-LOCs, should we make less money? Because he's made something smaller and faster, less K-LOC. K-LOCs, K-LOCs, that's the methodology. Ugh! Anyway, that always makes my back just crinkle up at the thought of the whole thing. Honestly, SLOCs is just not the way to compare source code. I know that you all might think size matters, but it just makes my head ache when I read something like this: But I've written all this code more than once, from scratch, cause it used to be WDL and I ported it... so can I count it twice? If I was interviewing someone for a job and he told me something like that he'd not get the job. What I do find interesting, though, is in how much source files you separate your code.
|
|
|
Re: How many Lines?
[Re: Joey]
#302426
12/19/09 13:06
12/19/09 13:06
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
OP
Expert
|
OP
Expert
Joined: Jun 2006
Posts: 2,640
Earth
|
Just to "defend" myself (and get the fictional job): my sarcasm got lost on that sentence you quoted, sorry about that.
I asked only for number-of-lines in this topic because I was interested in getting an idea of how many lines others write, not because I was going to say "you have more lines you're better" or "you have less lines you're better". As I have no idea what all the lines of code do, that other people posted, I am never going to compare the projects in this way.
I thought it interesting to see that people keep going, even though a lot of this is non-payed, and was happy to see that some of this non-payed work is so large. Big amounts of code means lots of work, which I was interested in. I never said that small amounts of code means less work, and never intended to say so. Personally, I am very fond of every function that does the same thing, more efficiently, with less code. Even if the code's harder to read, i always loved trying to interpret and understand "dense" code.
Sorry, I did not want to make your head ache.
Last edited by Germanunkol; 12/19/09 13:09.
~"I never let school interfere with my education"~ -Mark Twain
|
|
|
Re: How many Lines?
[Re: Germanunkol]
#302432
12/19/09 14:11
12/19/09 14:11
|
Joined: Jul 2004
Posts: 1,205 Greece
LarryLaffer
Serious User
|
Serious User
Joined: Jul 2004
Posts: 1,205
Greece
|
I think you'll have to find your balance between ease of reading and saving resources, and stick to it while writing your whole project. Sometimes, saving 8 bytes of ram, or getting away with 2 less lines of code is not worth the effort if it will make my code less readable, so I'll go for the simpler way. For example, I might have done that on a Commodore where ram is precious:
//Switch two variables
a+=b;
b=a-b;
a-=b;
But with a Pentium Duo with 4 gigs of ram, i'd use a third variable, thank you very much...
//Switch two variables
c=a;
a=b;
b=c;
Sometimes, it may be hard to resist using all these new sophisticated algorithms you've learned, making your code as tight as possible, but sometimes you'll also have to consider other people reviewing your code, or even yourself in 5 years. In big companies, your code will go through at least 1 or 2 more pair of eyes that their job is to 'clean up' your code and nothing angers them more than trying to decipher recursion functions when a single loop would have sufficed. Imo, I don't blame them.. Ps: I'm not referring to anyone in particular, just tossing my two cents..
|
|
|
Re: How many Lines?
[Re: lostclimate]
#302460
12/19/09 17:22
12/19/09 17:22
|
Joined: Jan 2003
Posts: 4,615 Cambridge
Joey
Expert
|
Expert
Joined: Jan 2003
Posts: 4,615
Cambridge
|
but that's dangerous practise, because like that a could overflow and produce unwanted results. and i'm not speaking of three lines but of people who can't code and produce extremely huge SLOCerz. by the way, this one works without overflow (and might even be faster): so why not just create an inline function or a macro performing this task? if you need it often, this would make your code look more readable than by using a temporary variable.
|
|
|
Re: How many Lines?
[Re: lostclimate]
#302462
12/19/09 17:37
12/19/09 17:37
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
7731 lines in 63 files, but this isn't a gamestudio project.
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
Re: How many Lines?
[Re: Joey]
#302467
12/19/09 18:11
12/19/09 18:11
|
Joined: Jul 2004
Posts: 1,205 Greece
LarryLaffer
Serious User
|
Serious User
Joined: Jul 2004
Posts: 1,205
Greece
|
Oh yes, I'm with you, I hate it when people rate your work based on your lines of code. I read somewhere about a university project in delphi where they had to make an ascii tetris game. One group actually made a function for each different tile like that: draw(" * "); draw("***"); etc, and even individual draw functions for each rotation of the tile, and even further separate functions testing collision for each of the tile and rotation functions . Should this guy really get paid more than someone that took the extra five minutes to combine all this into one function using 10 lines? I'm just expressing some frustration over people obsessed with too dense code, just so they can save one or two lines. I believe there's a balance you'll have to find that will work for you, and hopefully for others reading that code as well. Let me give you another example. I see a lot of people use bitwise expressions so that they can use single-byte variables (f.e. a char) to store information for 8 different flags (true or false booleans). I'd rather use an array of 8 booleans to do this, to make the code more readable, even if C's booleans take 8 bits each. But that's just me..
|
|
|
|