CMS code base comparison
Drupal
Source: Drupal statistics at Ohloh.
Joomla!
Source: Joomla! statistics at Ohloh.
Wordpress
Source: Wordpress statistics at Ohloh.
Plone
Source: Plone statistics at Ohloh.
(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.
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 - 07:13There 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 - 07:30What 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 - 08:07Over 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 - 08:35I 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 - 10:30IMHO, 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 - 08:07Code 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 - 18:56Another 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 - 09:12There 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 - 10:03I 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 - 12:22Maybe another conclusion: almost half of the Drupal's code have been written this year?
July 20, 2007 - 13:42I 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 - 07:56Ohloh 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:
Codebase: 20,207 LOC
Effort (est.): 5 Person Years
Cost to hire a team to write from scratch: $254,326
Codebase: 161,650 LOC
Effort (est.): 41 Person Years
Cost to hire a team to write from scratch: $2,237,980
Codebase: 63,495 LOC
Effort (est.): 15 Person Years
Cost to hire a team to write from scratch: $850,836
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:
So the monetary cost of these badges are a bit misleading because:
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 - 18:02"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 - 10:47Was 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 20, 2007 - 22:38Ohloh 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 - 06:54Drupal 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 - 06:35The 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 - 10:04I 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 - 15:56Drupal'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 - 20:17What 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 - 17:49Ohloh 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
August 7, 2007 - 11:50X=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;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 - 02:12Hi. That comparison is interesting. Would it be possible to add TYPO3 to the comparison?
August 22, 2007 - 21:24I 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... ;)
October 17, 2007 - 00:53One 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...
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 - 09:09Post new comment