«« Hackers and Painters Bloch on Java 1.5 »»
blog header image
First Week

My job has been good so far. My development is in Eclipse with Java and SWT/JFace. I am working by myself and trying to mostly use a test-first development (TFD) strategy with JUnit.

Test-first is getting easier and easier the more I do it. Every time I go off and randomly hack (usually just to "try something") I get way off track and end up at a dead end with crappy code. It's slowly sinking in that this kind of hacking gets me nowhere. I figure I'll do less and less of this as time goes on.

My unit tests have become an integral part of my code. I have supreme confidence in the methods I have tested, and I can't say that about anything else I've ever written. The unit tests are like code-contracts I have to abide by or problems I have to solve. How I do it is up to my creativity as long as I abide by the contract. Now I know why the XP guys love TFD.

The hardest part so far because of the speed I'm cranking out code has been keeping track of "things to do". I don't want to distract myself from what I'm doing right now but on the other hand I don't want to forget what just popped into my head. I definitely don't have time to write a test. Usually I just pop into the code affected by the new idea and write a TODO comment and let those tasks pile up for later.

Here are some stats for my first week at work (approximate because I forgot the paper with the numbers) I added up for fun. Next week's code name will be Yowza.

Codename: Zelda
Lines of code previously: 0

Lines of class code: 965
Lines of unit testing code: 887
Ratio of class to testing code: 92% (this number I remember)
Lines of UI code: 322

Total lines written: 2174

(I'll fix the numbers when I get that sheet back next week)

Since I'm refactoring a lot, a number that would be interesting is some sort of daily/weekly code turnover rate. I don't have a CVS right now, but even if I did how could I figure out that kind of number?

Disclaimer: Counting lines of code is like counting spackles on a ceiling ... it's useless, but it'll help you sleep at night. Especially if you are a manager. :)

Posted at May 09, 2003 at 08:10 PM EST
Last updated May 09, 2003 at 08:10 PM EST
Comments

so the question is... do you have to count your own lines, or can you pull a summary from wherever you're storing it? (You said no CVS, but I'm assuming there is some sort of repository so other people can get at it...)

» Posted by: Peter at May 9, 2003 09:23 PM

Well today I counted my own, but a shell script could count all lines in *.c files in a directory ...

» Posted by: Ryan at May 9, 2003 11:47 PM

If you don't have CVS...just use diff. Backup your files to like "mySourceFile.c.may2" and diff it with "mySourceFile.c.may3" etc...

Also, to count lines, just type
$wc -l *.c
That will output the number of lines in all .c files, so you could pipe your diff to a third file and then wc it.

k, it's ugly. I know. That why they invented SCCS and CVS ;-)

» Posted by: roy at May 10, 2003 04:14 AM

If you don't have CVS up and running and are working in a Win env, you can use something like TortoiseCVS (http://www.tortoisecvs.org/). You don't actually have to have a CVS server running as long as your repository is on a mapped drive. This is what Pete and I used at Passport, and this is the same tool I used at Alcan (but I think that they had a CVS server running...)

Anyways, source control is where it's at. ;-)

» Posted by: JimboJones at May 10, 2003 11:18 AM

Right now I'm just copying my project directory to my network drive (which is backed up) about twice daily. CVS is coming soon.

» Posted by: ryan at May 11, 2003 12:03 PM
Google
 
Search scope: Web ryanlowe.ca