vLent.nl

Practicing software development

Lines of code revisited

| Filed under: , ,
(Image by Flavio Takemoto)

(Image by Flavio Takemoto)

After a comment by Matt Hamilton on Twitter about the lines of code in my website project I listed in my previous weblog entry, I decided to dive in a bit deeper.

First of all, I think I should start by explaining better what I measured. Both my Plone website and the current Django site are managed via buildout. So when I wanted to count the line numbers of the files under source control, I started by checking out the buildout, and making sure there were no files related to the version control system (.git or .svn directories). Then I simply ran “find . | xargs wc -l” from the buildout directory.

So what I'm counting here is, in the case of the Plone site, the stuff needed for the buildout and my own products to customize the way Plone or installed add-ons behave or look like (basically a policy and theme product). In case of Django that translates in applications that provide the blogging functionality, configuration of the Django project, the templates and CSS and, again, buildout related files. In both cases I've removed unneeded files (like HISTORY.txt, LICENSE.txt, et cetera) and stuff I didn't use anymore.

The score now:

  Plone Django
Files
98
83
Lines of code
1927
2234

Wow I didn't see that coming. So first of all there apparently was was more cruft in the custom code for my Plone site than I figured. And in Django I need more custom code to end up with only the functionality I actually used.

That last conclusion isn't surprising actually: I decided to build the blogging related code myself on top of Django, instead of reusing a ready-made application.

So my conclusion now is that Matt's comment was an understatement: I wrote more code and ended up with less…

Comments

Now you just need to upgrade it to Plone 4 and do the memory and performance benchmarks again. :)
Wow, that is surprising. I was not expecting that result either. Every time I do a project in Plone and think 'maybe this would have been quicker in a basic framework' I remember how much you get 'for free' in Plone. Things like authentication and workflow which I inevitably end up needing in any project.
You are absolutely right: I also take for granted all the things Plone offers out of the box. Even when writing a small blog. :)

However, I do want to place this in the right context. As stated above, the code I used for Plone was 'just' a policy product and a theme. I used Scrawl and QuillsEnabled for the blog entries, the related views, the tag cloud and latest entries portlet. The base of my theme was plone.keepitsimple. I only needed to customize everything a bit.

In Django I wrote the blogging related functionality myself. I could also have used one of the many blogging applications and reduce the custom code, but chose not to.

So this is only a comparison of *my* project, based on the choices *I* made. It's not a general Plone vs Django comparison.