CMS code base comparison

Drupal

Code history drupal

Source: <a href="http://www.ohloh.net/projects/3189/analyses/latest">Drupal statistics at Ohloh</a>.

Joomla!

Code history joomla

Source: <a href="http://www.ohloh.net/projects/20/analyses/latest">Joomla! statistics at Ohloh</a>.

Wordpress

Code history Wordpress

Source: <a href="http://www.ohloh.net/projects/3192/analyses/latest">Wordpress statistics at Ohloh</a>.

Plone

Code history plone

Source: <a href="http://www.ohloh.net/projects/70">Plone statistics at Ohloh</a>.

(These graphs depict statistics for the core of each project, and do not include contributed modules, extensions or third-party plugins.)

Conclusions

  • All projects have been growing in size. No exceptions.
  • Drupal has, by far, the smallest code base. It's lean and mean. Joomla!'s code base is about 8 times bigger than Drupal's. Even Wordpress's code base is larger than Drupal's.
  • Of all tools, the Wordpress code has the fewest code comments. Drupal and Joomla!, on the other hand, have the best documented code.

Comments

fgm (not verified):

A significant difference in size may come from the fact that Drupal is actually recorded as two separate projects: one for core, and one for contrib, while there doesn't seem to be such a distinction for Joomla. The contrib code base is measured by Ohloh at 1.7M code loc.

July 20, 2007 - 09:13
Dries:

There are more than 1800 Joomla! extensions available for download from http://joomla.org. These extensions are not part of the Joomla! core and, as such, are not part of the graph. Please double check your facts before making claims.

I don't claim that these graphs explain all the (subtle) differences between these projects. We're only looking at the main download or the main distribution of each of these projects, so make sure to interpret these graphs in the correct context.

The number of contributed modules or extensions is not relevant to this post, but might actually be worthy a blog post of its own. For example, it shows that Drupal's contributed modules repository grew by 300% last year.

What's interesting about these graphs is that it might shed some light on the maintainability and agility of these projects. From a technical point of view, a smaller code base often has advantages over a larger code base ...

July 20, 2007 - 09:30
Nicholas Thompson (not verified):

What I think is interesting is the SHAPE of the graph.

Wordpress has quite a steady graph implying consistent growth.

Plone and Joomla have a similar shape with a sharp initial growth which is starting to level out.

Drupal, on the other hand, started off slowly with steady growth but has recently had a growth explosion!

July 20, 2007 - 10:07
Dries:

Over the past years I learned that every time we release a new version of Drupal, Drupal attracts more users. In other words, making a better product translates to a bigger install base. A better version of Drupal, does convince more people to use it. Every major Drupal release asserts this observation. It took me a years to realize that it was actually that simple a formula.

It's no surprise that the code base grows as you improve the product. If a code base stops growing, that might actually be a bad sign. So funny enough, there might actually be some correlation between the size of the code base and the size of the install base.

July 20, 2007 - 10:35
Arto Bendiken (not verified):

I also noticed the very distinctive shapes. Joomla doesn't have enough history in the graph for any conclusions, but to me WordPress looks like unchecked linear growth (a clear sign of featuritis) whereas Drupal's slope appears more controlled, perhaps moderated by the desire for elegance & simplicity and the resulting constant code refactorings which help keep the complexity in check.

Dries, might I dare suggest that another most interesting statistic, and perhaps equally telling of code quality, would be the number of discovered core vulnerabilities over time in these same projects...

July 21, 2007 - 12:30
themegarden.org (not verified):

IMHO, the most important info from those "code statistics" is a comments/code ratio. The bigger ratio means the code is better documented, and that is very important for good development.

Additional thing: Joomla was born as a "fork" of Mambo, so the "tilt" in about mid of 2005 doesn't mean rapid development. Joomla "inherited" the code base of Mambo.

July 20, 2007 - 10:07
David Eads (not verified):

Code documentation can also take different forms. When I'm writing a Django site, I'm not doing a lot of code commenting inline, I'm writing a lot of doctests and/or unit tests. In this scenario, it would be facile to say that because I'm not writing a lot of comments inline that the documentation is somehow worse for that fact. I like doctesting because it allows me to keep the comments in the actual codebase pared down to only the most salient features of the code, which (imho) increases code legibility (at the cost of having to look at the doctests).

July 30, 2007 - 20:56
Roel De Meester (not verified):

Another interesting thing: the number of BLANK lines.

Drupal has actual a very small percentage of blank lines.
Joomla's blank lines is half the number of comment lines
Wordpress and Plone's blank lines are a multiple of the comment lines.

You could say this is completely irrelevant (blank lines don't do anything), but too me this is another sign that Drupal coders tend to keep their code clean.

I don't know about the other projects, but Drupal has some clear coding standards (http://drupal.org/coding-standards) which make the code clear to read by all contributers. A side effect of these standards is the small number of blank.

As a result, that small fraction of blank lines could be seen as a measure for the good adherence to those standards!

Keep it clean and lean!

July 20, 2007 - 11:12
Olivier (not verified):

There is one thing that has bothered me in Drupal code for a while. That is the fact that drupal offers both db_fetch_object and db_fetch_array. This leads to inconsistent code, functions and hooks. More here: http://drupal.org/node/158115.

With a growing code base it becomes even more important to have consistent code and consistent function signatures and keeping those two functions available makes it hard to reach that goal.

Here http://drupal.org/node/124141 is an example of a hook gone completely berserk. Sometimes objects, sometimes arrays, no documentation of when which is passed. This also causes modules to behave differently on different hook calls.

July 20, 2007 - 12:03
pm (not verified):

I think Roel has a good point about blank lines. They're irrelevant, but at the same time, they are a measure of the coder's strictness. From my experience (and I've built sites with Joomla, Wordpress and Drupal), the coding in Drupal is lighter and more or just as powerful as the other two.

July 20, 2007 - 14:22
Anonymous (not verified):

Maybe another conclusion: almost half of the Drupal's code have been written this year?

July 20, 2007 - 15:42
sepeck (not verified):

I would think that the addition of color module, the new administrative area and the content construction kit code hitting core at the same time had more of an effect.

July 21, 2007 - 09:56
Kent Bye (not verified):

Ohloh offers a badge widget that attempts to show the relative value of an open source project. But it calculates a monetary value depending upon the number of lines of code and how much it would cost for X number of developers to write the code over the course of one year.

Take a look at these estimated costs:

  • Drupal
    Codebase: 20,207 LOC
    Effort (est.): 5 Person Years
    Cost to hire a team to write from scratch: $254,326
  • Joomla!
    Codebase: 161,650 LOC
    Effort (est.): 41 Person Years
    Cost to hire a team to write from scratch: $2,237,980
  • Wordpress
    Codebase: 63,495 LOC
    Effort (est.): 15 Person Years
    Cost to hire a team to write from scratch: $850,836
  • Plone
    Codebase: 235,828 LOC
    Effort (est.): 61 Person Years
    Cost to hire a team to write from scratch: $3,345,505

So looking at just the cost can be misleading because:

  • Drupal is only worth a quarter of a million dollars
  • Joomla is worth 9x more
  • Wordpress is worth 3x more
  • Plone is worth 13x more

So the monetary cost of these badges are a bit misleading because:

  • The more elegant you are, the lower the monetary value of the project.
  • Functionality vs. cost isn't really taken into account so you don't know if a higher or lower monetary value is better.
  • It's operating on the assumption that it would only take five a year to develop a CMS as good as Drupal from scratch.

On the other hand, if I were on the market to buy a CMS product and were comparing these four costs vs. the functionality, then I'd say Drupal is a steal.

July 20, 2007 - 20:02
Arto Bendiken (not verified):

"Drupal is only worth a quarter of a million dollars"

And herein lies the problem of taking COCOMO models at face value: the cost of development is not isomorphic to worth or value.

That someone spends 100 man-years developing software A does not guarantee the end result will in any way be superior to 10 man-years developing software B. It is quite possible, in many situations probable even, for the first team to simply waste (say) 90 man-years; it hardly matters whether it be on overstaffing, overdesign, undercompetence, bad tools, bad design, feature creep, spurious complexity, or all the aforementioned.

July 21, 2007 - 12:47
Steve Truesdale (not verified):

Was this Joomla 1.0 or 1.5? It would be interesting to see the difference since 1.5 is supposed to be a complete rewrite.

July 21, 2007 - 00:38
Dries:

Ohloh tracks the trunk of the Joomla! repository (http://joomlacode.org/svn/joomla/development/trunk) so this would be Joomla 1.5, I think ...

July 21, 2007 - 08:54
theBorg (not verified):

Drupal even leaner than the other big player on this game:

Ruby on Rails
Codebase: 93,344 LOC
Effort: 23 Person Years
Avg. Salary: 55000 $/year
July 23, 2007 - 08:35
Gunnar Langemark (not verified):

The cost of weeding out excessive code? How many man years has it cost to make Drupals code base so lean?

Reminds me of a comment made by Danish Nobel Laureate Niels Bohr after speaking for an hour on the national radio: "Sorry I took so much of your time - I had too little time to prepare".

The perfect code is small footprint for same functionality. Everybody understands that. Don't they?

July 23, 2007 - 12:04
Spacemonkey (not verified):

I think another factor in here that isn't getting enough attention is the type of architecture involved. To implement a full-blown CMS using OO techniques and follow MVC simply requires more code. Joomla 1.5 has undergone a significant change in this regard, producing a system that is easier to work with and extend - but at the cost of having more code.

I've seen WordPress and Drupal, and used to be a Plone homer -- so it is easy to see how Joomla and Plone have more SLOC than WordPress or Drupal; and although some may say that is bloat, others may say it is extensible, modular code.

One man's treasure is another man's trash, it would seem :-)

I most certainly agree that SLOC doesn't determine the value of a work, it just determines a reasoned guesstimate of the cost of implementation.

July 23, 2007 - 17:56
morphir (not verified):

Drupal's peak truly reflects drupal.org's downtime and performance issues. However, I find this problem very welcome because now Drupal is being put to the benchmark that many other high-performance/enterprise CMS's have been trough before Drupal. And I have great confidence that we will work this out gracefully. :)

July 23, 2007 - 22:17
TC (not verified):

What do people think about the site: http://www.cmsmatrix.org/. I compared @ 50 CMSes
feature numbers-wise: Typo3: 126, Plone2.5: 100, XOOPS: 98, Drupal5.1: 97, Joomla: 90, Wordpress1.5: 42. I then looked for books, videos, podcasts, conferences, tutorials. I felt this reflected the community of users. Next I realized PHP has a greater install base: http://www.ohloh.net/wiki/articles/php_eats_rails. Plone was a great contender but python made me pause. Listening to PHP podcasts, PHP programmers spoke poorly of the code in Joomla multiple times. Also I heard the creator of Wordpress argue against PHP5 compatability. Lastly seeing http://www.drupalsites.net made me more confident about my choice.

It never occurred to me to compare lines of code. But I don't believe in grading papers by weight. I've seen pages of garbage vs. short, concise perfection.

July 24, 2007 - 19:49
elmuerte (not verified):

Ohloh ignores the .module, .engine, .theme files.
Only the following files are inspected:
php, inc, js, html, xml, css, txt

The following shell script in the drupal dir gave over 55k lines
X=0; for I in `find .`; do TEST=`file -b -i $I | grep "text/"`; if ! [ -z "${TEST}" ]; then Y=`cat $I | wc -l`; X=$(( $X + $Y )); fi; done; echo $X;

August 7, 2007 - 13:50
frando (not verified):

What elmuerte says is true - Ohloh reports about 22,000 LOC for Drupal, while in reality the number of LOC in HEAD is, depending on what you count as a LOC and what not, between 50 000 and 75 000.

The number of non-empty LOC of all .module, .theme and .engine files is as of today's CVS HEAD 27351, so Ohloh is ignoring half of Drupal's code.

I opened a forum thread: http://www.ohloh.net/forums/11/topics/505

August 8, 2007 - 04:12
Braulio Solano Rojas (not verified):

Hi. That comparison is interesting. Would it be possible to add TYPO3 to the comparison?

August 22, 2007 - 23:24
Anonymous (not verified):

I did not find the download statistics page you showed at drupalcon, so I post this here:
http://www.blogsweek.com/en/joomla-vs-wordpress/
Interesting, though not even including Drupal.

The above discussion is a fun race. Playing quartet card game. Now the small opel can eat big lamborghini because using less fuel and being lighter... ;)
One should see it in a sportive way. It's a much too common practice to deprecate another system to make your own look better. We Drupalovers are no better. But as sportsmen we would have been long into relegation if we wouldn't...

October 17, 2007 - 02:53
Lisha (not verified):

This is interesting! Drupal is even smaller than Wordpress? Now I have something to respond to my friends who ask why I use a swissarmy knife (Drupal) for a simple blog. :) My general answer: Cuz I like it and I use it all day at work so I know it. Now I can also say, 'My swiss army knife is smaller than your single-use toy.' Muahahahaha! (oops! Was that evil laugh out loud? :) )

Do you have the current statistics for the code size now that Drupal 6 is out?

June 12, 2008 - 11:09
Seutje (not verified):

funniest thing about these graphs is that both drupal and wordpress went down a stunning 1K+ lines of code between jan 05 and 06

even funnier is that in the drupal graph, there is like a year (half of 04 -> half of 05) where the code has a little bumb that goes away after pretty much exactly a year

god I love graphs ^^

August 7, 2008 - 11:36
MerryBuu (not verified):

Sorry, but this analysis is complete nonsense. Number of comment lines gives no indication how well code is documented. It's like to tell how good is a programmer just by how many lines of code he/she writes.

Take for example, Joomla. It has utter number of completely useless comments in both method headers like

// Method to set the article id
on top of the Article class setId() method

and inside methods like

//Trigger OnBeforeContentSave
$result = $dispatcher->trigger('onBeforeContentSave'

These comments give you no extra information or in worse cases, give you false information. They just make code harder to read.

March 5, 2009 - 10:41
Anonymous (not verified):

Agree with MerryBuu, as someone who has used all 3 CMS, I can say that WordPress is the best documented by far. Its documentation manuals are easily searchable, and there are tons of tutorials out there on the Web.

Drupal *claims* it has an active, helpful community. But I found them arrogant, obstinate, and unhelpful. If I wanted help implementing some or such other feature, they'd say: "why do you want that instead of using some plugin that we already have but doesn't do what you really want to do?". The WordPress community didn't have such prejudices. They help you do what you need to do, exactly what you need to do, and nothing more and nothing less.

Joomla, forget it. Because most of its good plugins are not free, you end up spending easily over 1,000 USD on a relatively simple website. Or code your own. Yawn.

WordPress all the way.

January 8, 2011 - 13:50
Light CMS (not verified):

Anonymous has some good points.

A lot of open source CMS can be great because they are free but you definitely need help in figuring things out if you're not a coder and sometimes the communities aren't as helpful as they could be. There are all alternatives to be big 3 but not everyone knows about them.

Wordpress is great but sometimes updates will break your plug-ins and you gotta spend time fixing them. Some people may not think it's worth it, especially if they're running a business and don't have hours and hours to go about troubleshooting.

February 8, 2011 - 19:44

Add new comment

© 1999-2014 Dries Buytaert Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License.
Drupal is a Registered Trademark of Dries Buytaert.