how much does a line of code cost?

Rio de JaneiroThis past week I stumbled upon a nice tool: sloccount. Sloccount was written by David Wheeler and is a set of tools to count lines of code. Wheeler also has some really interesting papers regarding the linux kernel size and its development cost.

After installing sloccount* I immediately started to harvest data on all projects I currently have on my hard drive. I was really impressed by the first results. The costs are too high, I thought. A small project with 2,000 lines of PHP code like the Autoresponder has a development cost estimated at more than US$55k.

After reading sloccount’s user manual and pondering about the Awake Autoresponder I started to change my mind. 2k lines of PHP code encompass a lot more work than the number suggests. A few reasons for this:

  1. The code was updated every time a customer submitted a bug. As you know, fixing a bug does not necessarily imply more lines of code
  2. Out of the box sloccount doesn’t compute HTML, CSS or Javascript
  3. Technical support
  4. Documentation

It took me a few thousand commits, I don’t know how many emails and several hours of night debugging the script on customer’s servers to reach 2k working lines of code. It may sound like cheap advertisement or self promotion but I must say that US$49.90 for the script is a bargain!

* if you are running Ubuntu it’s easy as

sudo apt-get install sloccount

documentation and job transition

san franciscoI’m living a transitional period. One might say that life is always on transitional mode. An eternal deja-vu. Cheap philosophy apart, I’m slowly starting to seek for a new job here in the US. I’m still working for my former employer but since currency exchange rates are not on my side (as of today I need R$1.83 to buy US$1.00) I need an extra income. A part time job maybe? I don’t know yet.

Anyway, chances are I’ll be devoting fewer hours developing for my current employer  so I decided to improve our documentation base.

Documentation includes how to properly setup a working environment, main concepts of the system, shell scripts that do black magic, coding guidelines, etc. I’m also writing down a lot of ideas to improve the current system we have and formating TODO lists that only make sense in my head into prose.

The problem is that part of the system was first developed and discussed only in non-formal meetings. Yes, productive and get to the point meetings. We didn’t have the chance to properly document everything as dictate theory and common sense.

So, right now I’m writing. A lot.

One of my main goals is to make the life of future developers joining the team easier. What are the first steps? What is all that code supposed to do? What needs to be done? How it can be done?

It forced me to stop and look back. Stop being a GTD code maniac and look back at everything that was done in 3 years.

It’s unbelievable not only the amount of things we’ve got done (lines of code in my case…) but also how much we improved. It was crazy, it is still crazy, but we fixed bugs, released updates and new features almost every day. Ohhh… s t a r t u p s.

subversion emailed commits

DonutsAs crazy as it may sound to most people, I like Mondays. The main reason for this is that my mind is refreshed after the weekend and I’m excited to get back to my regular job source code and get things done. Monday is also a good day for novelty.

Well, this morning I did put into practice something that is most certainly not new for you: the post-commit SVN hook. As an experienced developer you can stop reading the post right now.

The post-commit is now active and all developers (the development team is small) receive an email after a commit is done. The email contains the revision number, author, log message and the diff generated by the commit.

I learned about this procedure reading the book Producing Open Source Software.

The goal is to help everyone involved in the code to have a better idea of what is being done. Who is working where and most importantly, if someone is touching part of the code that is of special interest to you.

After a few commits and just skimming through the code you’ll see the benefits.

You start to police yourself to make small and well documented commits. Good.

It’s also easier to comment about code that was introduced/updated by your peers. The diff is right there in your email box and the changes are still fresh in the author’s head. Just hit reply!

Awake Autoresponder 1.4.0

aa_logo_blueI’m writing this time to announce a minor release of the Awake Autoresponder. Version 1.4.0 is now available. Update is free for all 1.3.x customers. This release contains some small bug fixes + one new feature. It is now possible to be emailed when a new Lead subscribes to the Autoresponder.

As noted in a previous post, version 2.0 is now in the main branch of development. The first phase is almost complete and the script is now using CakePHP as a framework. New features will be added in phase 2 ;)

Chromium compiled in Ubuntu

google_chrome_logoIn theory it would be good to test web applications on several different browsers but I must admit that I’m mainly concerned about Firefox and Internet Explorer. Well, now that I have a “Windows Day” during the week I included Google Chrome in my tests. It is such a nice browser and since it uses Webkit I can fool myself and pretend that everything running on Chrome is perfectly fine for Safari users.

Couldn’t wait any longer to have Chrome on Ubuntu so on Sunday night I checked out the Chromium source code files, installed depot tools and all software dependencies, typed hammer and voila! Binaries up and running after a few hours. Gosh, I need better hardware.

I did not expect for it to run at all but I was able to navigate through most of the websites I needed. I was quite amazed by the results. It is more than a plausible promise after all.

Stupid brazilian keyboard

Although I’m no prude I generally don’t write offensive words. I have to make an exception though: Brazilian keyboards are stupid! Die!

I’m a programmer (at least I try to be one) and typing a lot everyday gives me the right to say that.

My previous laptop died in the middle of the night. I needed another computer the next day while I was still living in Brazil. I could only find laptops with Brazilian keyboards for prompt delivery.

p1040940

The first annoyance is the right Alt key replaced by Alt Gr. It makes me feel handicapped.

If I need the ? or / character I need to combine the keys Alt Gr + q or Alt Gr + w. Great. Great idea.

Typing in Emacs is like playing guitar. You have chords. Now I can’t type M-f and avoid physical therapy. Normally I would press my right thumb in the right Alt key (where did it go??) and my left index finger in the f key. If you play any instruments you know what I’m talking about.

Another problem. The Ç character. C cedilhado in Portuguese. The name implies it. It is the same C character genius!! You don’t need a unique key for it the same way you don’t need a separated key for Á, á, É, é, Ô, ô, etc. Just add a dead key for the cedilha.

With the addition of this unnecessary key they moved the location of crucial chars like ‘ and “.

Really? Bear with me. WHAT WERE THEY THINKING?

I could go on and on but I should stop. That is enough for my karma today.

WordPress is a killer app

I’ve been using WordPress for 2 months now. I was reluctant at first to adopt it. My main concern was having a whole system in the way in case I ever needed to code an unusual feature for my website. Then I listed several reasons why I was definitely wrong about not using WordPress in my personal website:

1) Turns out I don’t have time to deal with code in my own website. The shoemaker’s son always goes barefoot.

2) How many times I have to remind you: don’t reinvent the wheel. At the moment you just need a tool to blog. Go for a ready made solution.

3) “Unusual feature“? Really? Please, list one that is crucial! A feature that you need to implement right now! The answer was… duhh…. none!?

4) WordPress is under GPL. If you ever need a fancy feature you can actually code it! … although I doubt I will ever need to do so.

san-franciscoThese should be enough reasons to have WordPress installed. There is one more important reason, though: Plugins.

People should be able to extend the functionality of the software. If you add well documented procedures on how to write plugins and build an environment for people to share them, then you dramatically increase your chances for a hit. A killer app. Programmers and designers will write plugins and add-ons so cool that you won’t be able to live without their functionality. The competitors will have a hard time changing your mind.

That is why it will be hard to leave killer apps like Emacs, Apache, Firefox, etc.

Right now I have only 4 plugins installed on WordPress but they all came out of pure necessity. They were easy to find, install and use. Things that work out of the box? Magic.

Producing Open Source Software

p1040896I have just finished reading a really good book: Producing Open Source Software by Karl Fogel. The text is enriched by examples taken from the Subversion project where the author used to be involved. The book covers a wide range of topics found in Open Source Projects including Technical, Social and Political Infrastructures, Money, Packaging and Releasing, Licenses and etc.

It is a good source of information if you are trying to improve or understand all the processes and overhead demanded by software development. Recommended even if the project you are engaged is not free/open source.