How many Lines?

Posted By: Germanunkol

How many Lines? - 12/18/09 18:03

Just out of interest: How many lines of code does your current project have?
I'd like to see how large all those indie-projects get...

Lite-C and C-Script counts, as well as self-written C++ or anything else you may have written for the project.
Posted By: Joozey

Re: How many Lines? - 12/18/09 18:28

Around 900, and I can only fill a chat UI component and have a database connection.
This does not include white spaces but does include comments.
Posted By: Rei_Ayanami

Re: How many Lines? - 12/18/09 20:14

i don't want to count, too many grin

around 10 000 i think tongue (or more)
Posted By: Anonymous

Re: How many Lines? - 12/18/09 20:26

~2100 (in 11 files) for DangerStars
Posted By: Tempelbauer

Re: How many Lines? - 12/18/09 22:23

Quote:
How many lines of code does your current project have?

do you mean SLOC (standard lines of code)?
ALL my projects have more comments as code

count it: http://download.cnet.com/Code-Line-Counter/3000-2212_4-10841474.html
Posted By: LarryLaffer

Re: How many Lines? - 12/18/09 22:34

58535 lines. 51 files. Intense X

Btw, just found this: Line Counter
Posted By: TechMuc

Re: How many Lines? - 12/19/09 00:00

ha larry..

actually: 64415 lines (LED) - 239 files laugh
Posted By: LarryLaffer

Re: How many Lines? - 12/19/09 00:22

Damn you laugh

I could include the dll code for the Intense X WED Menus though which bump me up to 98384 lines laugh. But I'm not very proud of that code... Lots and lots of copy pasting. I wish you could have told me how shitty MFC is before I started using it..
Posted By: Germanunkol

Re: How many Lines? - 12/19/09 09:07

O.o
Okay... You definitely win.
I have 24 136 Lines in my projects...

Darn grin

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?
Posted By: Puppeteer

Re: How many Lines? - 12/19/09 11:09

At the moment my chistmas contest game has 11659 lines of code in 58 files. (I started deving it on november 10th (this year tongue )
Posted By: Germanunkol

Re: How many Lines? - 12/19/09 11:52

hats off!
that's a lot of code in less than 2 months....
Posted By: Joey

Re: How many Lines? - 12/19/09 12:34

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:
Originally Posted By: 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:

Originally Posted By: Germanunkol
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.
Posted By: Germanunkol

Re: How many Lines? - 12/19/09 13:06

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.
Posted By: LarryLaffer

Re: How many Lines? - 12/19/09 14:11

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:

Code:
//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...

Code:
//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..
Posted By: Joey

Re: How many Lines? - 12/19/09 14:56

Yes, but writing efficient code and writing readable code don't need to be two different things.
Posted By: LarryLaffer

Re: How many Lines? - 12/19/09 16:49

Well, how about my example above.. Both three lines of code. First one uses less memory while the second one is easier to follow. Both come out with the exact same result.. I come up with things like that all the time, and I do find myself having to choose between code efficiency and readable code.
Posted By: lostclimate

Re: How many Lines? - 12/19/09 16:52

Originally Posted By: LarryLaffer

Code:
//Switch two variables
a+=b;
b=a-b;
a-=b;




wow, that just blew my mind grin i'd never have thought of that.
Posted By: Joey

Re: How many Lines? - 12/19/09 17:22

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):

Code:
a ^= b;
b ^= a;
a ^= b;



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.
Posted By: WretchedSid

Re: How many Lines? - 12/19/09 17:37

7731 lines in 63 files, but this isn't a gamestudio project.
Posted By: LarryLaffer

Re: How many Lines? - 12/19/09 18:11

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 tongue. 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..
Posted By: Quad

Re: How many Lines? - 12/19/09 18:16

but you can always use simple macros to stay away from that but i agree in some points making it 3 lines is better rather than making 1 line in more cpmlex way.

also linecount explain nothing and doesnt make a project better, what counts here is efficency and understanabilty of the algorithms.

i have a project with 3321 line in 9 files, it was around 15k lines in 4 files, and doing the same thing.
Posted By: Pappenheimer

Re: How many Lines? - 12/19/09 18:32

Code:
a ^= b;
b ^= a;
a ^= b;



Joey, what does this sign mean? "^="? Couldn't find it in tha manual and not with google...
Posted By: LarryLaffer

Re: How many Lines? - 12/19/09 19:13

It's the bitwise XOR

http://www.conitec.net/beta/avar-Ref.htm
Posted By: ventilator

Re: How many Lines? - 12/19/09 19:46

Quote:
but that's dangerous practise, because like that a could overflow and produce unwanted results.
hm... at a first glance i think that it should work correctly even if an overflow happens.

Quote:
so why not just create an inline function or a macro performing this task?
XOR swap shouldn't be used anymore. modern optimizing compilers will produce a better solution automatically from the three variable swap.
Posted By: lostclimate

Re: How many Lines? - 12/19/09 21:33

Originally Posted By: LarryLaffer

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..


i agree. I hate it when people do it because it deviates from the standard "look" of the rest of the code, so when reading through it, or even trying to reuse the code there is an unfamiliar convention about it.
Posted By: TripleX

Re: How many Lines? - 12/20/09 11:09

A very difficult topic, but generally i agree to lostclimate / larrayLaffer (Even though I also use 8 different flags in one byte).

Generally I do not see an advantage (in software/game development for modern computers) if a code gets unreadable in favor of very small optimizations in speed. Probably only 20 more vertices on a model can aborb the effect of a little bit more efficient (see ^= or boolean flags) code.

Nevertheless you should never stop optimizing your code if it's possible to accomplish with effect in affordable time. But As a software-developer I can not explain to my customer that the development of a tool took so long, because several code parts were optimized and now run in a time of 100ns instead of 120ns - which included a lot of research work.

This does not mean, that simple optimization should not be done (for example the swawp above, as a define), but if you do now know such speed-ups - this won't be the reason why your program works slow.


For portable mobile-phone games / apps all above is senseless.
Posted By: Joey

Re: How many Lines? - 12/20/09 13:37

In general I'm against optimizations done during the coding process itself. Most of the time there's a straightforward solution which works quite well. Optimizing time-critical code is another question.

But some people don't even code proper "normal" code (not optimized!) which gets lengthened and stretched half-way across the globe without getting to the point.

edit: you're right, Larry, your code will work, given that the overflow and underflow don't throw an exception and are reversible - but in c this should be the case, doesn't it?
Posted By: MrGuest

Re: How many Lines? - 12/21/09 02:55

Originally Posted By: Joey
In general I'm against optimizations done during the coding process itself. Most of the time there's a straightforward solution which works quite well. Optimizing time-critical code is another question.
I'll agree with that, I see too many people breaking projects trying to reduce too many lines of code without rigorous testing to make sure it still does what it did originally.

General rule of thumb:
If code works, don't change it
If it could be changed for the better,
spend more time planning before just crunching,
Use the benefits your've found for your next project

currently working on 3 projects, 102k lines of code
Posted By: EvilSOB

Re: How many Lines? - 12/21/09 04:43

OK, I may be a few posts out of date here but I cant see why
I should be "paid" three times the amount for
Code:
//Switch two variables
a+=b;
b=a-b;
a-=b;

OR

//Switch two variables
a+=b;
b=a-b;
a-=b;



When I can happily use
Code:
//Switch two variables
a^=(b^=(a^=b));
OR

//Switch two variables
a-=(b=(a+=b)-b);



And Im sorry Quadraxas, but I gotta dis-agree with...
Originally Posted By: Quadraxas
...what counts here is efficency and understandabilty of the algorithms.

Why is the understandability important?
As long as YOU can understand YOUR OWN code, who cars if its a bastard for others?
(unless you are writing a tutorial of course)

I myself am in the middle of an entry for the summer retro comp.
(so everyone else may as well give up and abandon their projects ....please?)
And its only at 2400 lines over 9 files ATM, but it would be much larger
if I formatted my code differently. Here is a typical example...
Code:
CAR* retrieve_car(int index)	//retrieve a car (regardless of city-number)
{	if((index<0)&&(index>MAX_STORAGE))			return(NULL);	//invalid index number
	CAR *thiscar=NULL;		if(storage.car[index])		{	storage.count--;
		thiscar = storage.car[index];		storage.car[(index--)+1]=NULL;	}
	for(index=1; index<MAX_STORAGE; index++)	//reshuffle table to remove blanks
	{	if((storage.car[index])&&(!storage.car[index-1]))
		{	storage.car[index-1]  = storage.car[index];		storage.car[index] = NULL;
			storage.city[index-1] = storage.city[index];						}	}
	return(thiscar);		/*return CAR or NULL if not found*/						}


It may seem ugly to most people, hell, its ugly to me, and Im its FATHER...
But, it makes easy sense and readability to me, as I (mentally) break my code up into line-minimised "logical" blocks.
Like so...
Code:
CAR* retrieve_car(int index)	//retrieve a car (regardless of city-number)
{
////------------------------- function validity checking ------------------////
	if((index<0)&&(index>MAX_STORAGE))			return(NULL);	//invalid index number
////------------------------- get data from storage -----------------------////
	CAR *thiscar=NULL;		if(storage.car[index])		{	storage.count--;
		thiscar = storage.car[index];		storage.car[(index--)+1]=NULL;	}
////------------------------- tidy up storage space -----------------------////
	for(index=1; index<MAX_STORAGE; index++)	//reshuffle table to remove blanks
	{	if((storage.car[index])&&(!storage.car[index-1]))
		{	storage.car[index-1]  = storage.car[index];		storage.car[index] = NULL;
			storage.city[index-1] = storage.city[index];						}	}
////------------------------- return retrieved data -----------------------////
	return(thiscar);		/*return CAR or NULL if not found*/						}


It actually looks a hellishly lot more ugly here in the forum than in SED BTW.

Its all a matter of personal preference.
My code ends up as tight (closely packed that is), easily clone-able, largely self-contained "hunks" of code,
which has quite few lines, but lots of code packed in them...

The reasons behind this style of programming lies in the origins of the EvilSOB.
Unfortunately, I began coding professionally back in the early 90's and it was a cut-throat place.
Employers "owned" your source-code, so some coders (like myself) developed our own
coding techniques to "obfuscate" our code.
So if another (see cheaper) coder was employed later to 'enhance' our old code,
they had to be VERY good to figure out how our code did what it did....
Usually it was cheaper for the employers to call US back to update our own code.
With us calling the shots on the paypacket this time...

Thats the coding environment I grew up in, and much of it is still indelibly etched into my soul,
regardless of how obsolete the reasons for it are now...
Posted By: Joey

Re: How many Lines? - 12/21/09 21:05

that's weird. i've actually never seen a person formatting source code like you. i've seen several people not formatting it at all, but this is... interesting ^^. but if it works for you, why not.

i must agree on that. as long as i can read my code, i feel that most programmers can read and understand it in more or less the same time, depending on skill. why? i can read and understand almost every code and its function, some fragments take longer, some less time. since i don't think that i'm coding harder stuff than everyone else out there, nor that i code especially ugly or weird stuff i project my own experience onto others. i also don't comment that much - i'm sure you all know the citation "if you can say it with code, code, else comment".

obfuscating code on purpose might has its use but personally i think it's none of a good or fair practice. and then again it's two keystrokes in a proper de to indent it the way everyone is used to.

if you're counting source code lines (to come back to topic) it all comes down to the skill of the programmer. in big teams this sloc might give some kind of idea, but then again i'd rather not say rasternudel or what he was called here with his force return float4 stuff would have a bigger project on the run and even if it was a TSLOCer.
Posted By: BastovBros

Re: How many Lines? - 12/21/09 21:20

HAHA!!! I am the winner!!! I have...... a you ready?.... 630!!!! Think again about it!! 630!!! LINES!!!
laugh
Posted By: lostclimate

Re: How many Lines? - 12/21/09 21:37

Originally Posted By: BastovBros
HAHA!!! I am the winner!!! I have...... a you ready?.... 630!!!! Think again about it!! 630!!! LINES!!!
laugh

uhhh.... yes you are the winnar! not sure of what, but you are definately a very *special* winner for having 630 lines of code....
Posted By: BastovBros

Re: How many Lines? - 12/21/09 21:41

I'm kidding laugh I know that I am "very special" laugh
Posted By: EvilSOB

Re: How many Lines? - 12/21/09 22:11

Thats cool Joey. Its "personal-use" code that I leave like that.
Its no longer actually "on purpose" obfuscation for me, its habit.
That how the code flows from brain to keyboard.
"interesting" you say... I would have used the word "demented"... wink

If you look at any of my contributions scattered throughout the forum,
you will find easily readable and well commented code (usually blush).
I re-format my coding to a more normal layout when it is for public
consumption, because its usually to try to explain a point or concept,
so I want to make it as plain as possible just in case a newbie gets their
hands on it...


630 lines of code BastovBros? Really? Far better than me then, as Ive deleted
that many lines of obsolete code today. You win.... crazy
© 2024 lite-C Forums