Page 1 of 1

How to boast about amount of code written?

Posted: Mon Oct 22, 2012 1:09 am
by Callan S.
A bit of a light hearted topic. And it's not so much boast, but how do you sort of say you accomplished something today, re coding, as much as others might say they got the shopping done? The number of lines in code, is it representative? For good formatting you have spaces in between in many places? And some lines are short echo statements, while others are nuanced logic management.

What do you think, indie-resource? :)

Re: How to boast about amount of code written?

Posted: Mon Oct 22, 2012 1:29 am
by Jackolantern
Whenever I want to measure what I have done, I usually look at the problems I solve, some kind of complex processing or some complicated output to the screen. I don't know why, but I have rarely ever considered how many lines of code I have written. You touched on the fact that C-style languages are kind of verbose when it comes to lines of code compared to languages such as Python or BASIC (mostly due to curly-braces and white-space freedom to make things more readable). So line counts are really kind of relative :cool:

Re: How to boast about amount of code written?

Posted: Mon Oct 22, 2012 1:52 am
by Callan S.
I guess when I'm coding a game, most of the time I don't feel I'm solving a problem. Sometimes when I can't get it to do what I want, it becomes a problem - but you don't really want those times to occur (certainly the better you get at coding, the less often they occur - and if you spend several hours typing code but have no problems - well, did you do nothing? Surely not?). And when they aren't occuring, I don't feel like I'm solving a problem that needs solving as I'm writing a game.

Not that alot of TV shows or movies don't exactly need to be made as they don't solve any particular problem.

Re: How to boast about amount of code written?

Posted: Mon Oct 22, 2012 2:56 am
by Jackolantern
I guess "solving a problem" was a little vague, because I meant it in the computer science terminology. Kind of like how everything that does something is a "solution", that solution is the solution to the problem of not having it. Kind of odd, I know, but in that way, every major piece of functionality you need is a problem or a "requirement". Solutions solve requirements. So basically, when you write a level editor (or possibly even a smaller part), you have solved a problem. :ugeek:

Re: How to boast about amount of code written?

Posted: Mon Oct 22, 2012 9:56 am
by Cayle
Measuring your progress by lines of code is problematic. The metric that I use is bug free unit tests.

Sometimes I’m in a groove and write a lot of code quickly. That quickly written code often gets thrown out and replaced by something more efficient and smaller. Lots of code can mean spaghetti code. On the other hand, overly concise code can be just as spaghetti-like in its own infuriating way. If you are careful and write easily readable/understandable code that you’ll easily understand when you revisit it a year or two later, you’ll inflate your line count. If you are a defensive programmer who does lots of error checking and writes in lots of try/catch blocks, your line count will explode.

But lots of lines or few, the real measure of a method, clad or module is its ability to survive being beat on by unit tests that are designed to push it to its limits. Your test harness is possibly the most important piece of code in your project. :ugeek:

Re: How to boast about amount of code written?

Posted: Mon Oct 22, 2012 1:08 pm
by hallsofvallhalla
I measure my progress by how many villages I raided and dragons I slayed in the day....

hehehehe actually for me it is internally set milestones. I guess I kind of set some goals for the session and see how much i have done and how much I have learned. I could get nothing donw but spend the day fighting a problem and learn a ton and feel more progressive than writing a ton of code and not really learnng anything.

Re: How to boast about amount of code written?

Posted: Mon Oct 22, 2012 3:08 pm
by vitinho444
I like to see the lines like, you have a project with 10k
I think you should be happy if all works like you want :)

In my code i usually do like this (php and c++)

if(halls == "cool")
{
//Infinit Loop :)
}
else
{
//If you reach this part, you are not talking about the same halls as i am :D
}

Re: How to boast about amount of code written?

Posted: Mon Oct 22, 2012 5:48 pm
by Cayle
Ohhhh... now we can have a coding style holy war! AWESOME!

I find opening curly braces on their own lines breaks up the code too much and makes it less readable. So I do this.

Code: Select all

if(halls == "cool"){
    //Infinit Loop 
}
else{
    //If you reach this part, you are not talking about the same halls as i am 
}
These are the two main competing styles in curly brace languages. Naturally, civilized people use Python instead and there are no curly braces to argue about. :mrgreen:

Re: How to boast about amount of code written?

Posted: Mon Oct 22, 2012 6:01 pm
by hallsofvallhalla
hehe i am more a fan of

if()
{

}

than

if(){


}

Re: How to boast about amount of code written?

Posted: Mon Oct 22, 2012 10:22 pm
by Callan S.
hallsofvallhalla wrote:hehe i am more a fan of

if()
{

}

than

if(){


}
Very zen!