Lars Pind

internet software, coaching, and entrepreneurship

Lars Pind - internet software, coaching, and entrepreneurship
Check out Coach TV, my video blog on happiness and personal development for geeks.

LOC

January 19, 2005 · See comments

David has inspired me to look closely at LOC (Lines Of Code), and trying to keep the numbers low. Why? Less code means less code to read, write, maintain, understand, keep in your head, and especially modify when you realize that something else would be better for users or business.

Rails already has a built-in Rake stats target, but OpenACS does not, so last night I wrote this quick shell script to count the number of lines of code:

find . -name \.tcl -print | xargs grep “][#[:space:]]” | wc -l

Current LOC for my CMS project: 9545.

Current LOC for our intranet project: 1146.

I think real project size would account for the CMS to be about twice the size of the intranet, but no more. The rest—7253 LOC, or 75%—would be due to differences in language and platform.

If I ever get a chance to rewrite the CMS in Rails, I would be happy to report.

blog comments powered by Disqus

Comments ↓

  • 1 Mark Aufflick // Jan 23, 2005 at 03:09 PM

    Not that I dislike Ruby or Rails (as one of my recent blog entries are showing), but I'm not sure that's a fair comparison. An intranet project written using Rails, or Maypole or whatever, contains only code for that project and nothing else. In an OpenACS package (even a custom one), you are making use of some very highly engineered sub-systems. While it takes effort to use them, these subsystems give you a lot of power and functionality now, and more in the future. Of course that benefit is not always needed or suitable. Ideally, sets of functionality will be developed for Rails and other frameworks, but it was the drive of ArsDigita that made OpenACS what it is compared to, say, Zope.
  • 2 Lars Pind // Jan 23, 2005 at 03:20 PM

    Actually, this is a pretty fair comparison. I'm only counting LOC in my package, not the whole framework, and what matters is how many additional lines of code it takes to deliver what I need to deliver. Those subsystems, whether part of the framework, or add-ons, should be judged on how easy they make it for me to deliver what I need to deliver. One way to measure that ease is LOC.
  • 3 Mark Aufflick // Jan 24, 2005 at 10:07 AM

    True.

    On a side-topic, one of the things that often amazes me about Java IDEs is how much template code they auto-generate. It doesn't matter how good the framework is, you just need a lot of LOC to get started.

    Another side-topic, by properly implementing inheritance, we cut out a third of the LOC in a client project. Without OO (and multiple inheritance or similar) there would be no easy way to shave off those 20,000 lines. (The language was Perl fwiw).