Hacker News new | past | comments | ask | show | jobs | submit login
Clojure 1, PHP 0 (briancarper.net)
28 points by mqt on March 17, 2009 | hide | past | favorite | 21 comments



Wordpress is the best example of spaghetti code I've ever seen.

You can compare any code you write yourself to it and you'll find your code better.

Last year I gave a conference talk at our local PHP web developer conference analyzing technical details of WP, Joomla and Drupal. I found WP a piece of spaghetti, Joomla a bloatware and Drupal somewhat cleaner than the other two and with some interesting ideas.

However if you look at the UI, you have to admit that WordPress really shines there. I haven't yet used anything that easy to publish a blog.

Taking all this into consideration I think the article title is greatly misleading. It really should be "Compojure 1, Wordpress 0". And the value of reading that article for me was zero.


Wordpress code is amazingly awful, but Wordpress is also a general-purpose blogging/publishing platform meant to be installed anywhere, be extended by plugins and themes, and serve the needs of many, many people. If you write your own blogging platform that does just what you need without worrying about drop-in installation, plugins, themes, or anyone else, and you don't end up with a "pretty nice reduction in code", you're in sad, sad shape.


It is easy to allow plugins, themes, and easy installation without resorting to Wordpress' horrible architecture.


No kidding. My point was that the line count difference is probably not principally a matter of Wordpress being terrible or PHP being inferior to Clojure, but mainly of having a radically simpler feature set.


Yes, definitely. Now that I think about it, your point is especially relevant in light of the examples the article chooses.


This is pretty much incoherent. The author is really comparing Clojure to Wordpress.

His concluding segment is literally called: A Brief Comparison: Clojure vs. Wordpress.

Clojure is a language (dialect) and Wordpress is an application. This is worse than the common mistake of comparing a language to a framework.


Well in the end, he was actually comparing compojure to wordpress, which is still wrong, but a little better. Clojure is a pretty nice language and if you need to do anything related to concurrency, it's probably the best fit. For example, I recently wrote an app that would handle a request, and executed heavier background tasks in a java executor pool using just 20 lines of clojure in compojure.


You can treat WordPress as a PHP based content management framework, and that is in fact what many people do. Also he is in fact using a Clojure web framework- Compojure. In anycase, contrary to what you are saying, his point is coherent.


Clojure is definitely better than PHP, but this article does not show that. The two code snippets compare two different things -- the Lisp calculates the tag cloud, while the PHP declares some configuration options for the UI. How could comparing those two completely different problems tell you anything?


I don't think it is fair to compare loc on an application that needs to support the needs of many thousands of individuals with an application that needs to support 1.

The more users of something like wordpress that you have the more edge cases you find. I can write a blog in 1200 lines of PHP but I don't think I could convince myself it has anywhere near the features, considerations or polish that something like wordpress will have.

As for the cloud plugin I haven't looked at it but it appears as though the boilerplate is just a way to add an easy method for customization something his lacks.

So we end up with less code but less features and more difficult to get up, keep up or customize. I fail to see how this is a point for Clojure.


Wordpress doesn't have polish. It has some HTML that looks nice, but doesn't perform well and is completely unmaintainable.

FWIW, I am also writing a real replacement for Wordpress: http://blog.jrock.us/articles/Ernst,%20Angerwhale,%20the%20F... (that article also rambles on and on and on about unrelated things).


Wordpress has a lot of features that most people overlook when implementing their own blog platforms. I'm not saying it is a great system to develop with but it handles a lot more use cases than most systems I see people comparing it with. People regularly compare things like the Rails demo blog with wordpress as an example of why PHP/wordpress is bad.

It could certainly be better but it's understandable as to why it's not pretty under the hood. Trying to be everything for everyone usually results in ugly systems.


If wordpress is unmaintainable then why do they keep releasing new versions of it? How come so many people use it?

And you're writing it in Perl? Sounds maintainable!


Some people like hacking things, making them work, and then leaving it even more broken for the next person. I don't, which is why I can't work on Wordpress. Every time you change the code, it should be cleaner than it was before, especially if the code is a project that you expect other people to be able to easily start working on.

As to your other point, nice troll.


But other people work on Wordpress all of the time. The sheer number of plugins, themes, etc. all testify to that. And if it's so broken, then why do so many people deploy it day after day?

Can you cite specific examples of where it is broken?

Or why don't you say what you really mean: Because it's written in PHP it must be junk.

And, seriously, who is trolling who? You posted how broken it was, and that you're building something new and better, but don't provide any examples of how Wordpress is broken exactly.

I can have Wordpress installed and working in under 15 minutes. I'm not sure how that is broken.


Like I said, it's easy to hack anything to do exactly what you want. The hard part is making your hack work with other hacks. How many Wordpress plugins can you install before things randomly break? How do you detect breakage, anyway? (Do all plugins have test suites? Can you compose these test suites to ensure that two plugins don't break each other?) How are variable and class namespace conflicts handled? How are conflicting database schema changes handled? Is there a way to request similar information from the database in two places without doing two queries? Is there a cache that can consistently share pieces of data between two plugins?

I could go on and on, and the answer to most of these things is no. Most of the time, it doesn't matter because the plugin is "too simple" to break things. But simplicity has its limits -- there are a lot of features that Wordpress is missing that I trivially implemented in my Angerwhale prototype (cleanly).

As to the number of extensions, it's simple. Wordpress is the only blogging solution out there, and there are millions of PHP programmers. (OK, there is MT also. But MT killed itself with weird licensing, and lost all of its mindshare. Oops.)

Those two factors combine to create a huge ecosystem. But it doesn't say much about the design of Wordpress, other than "it works well enough for people with simple needs, and rewriting a whole blogging engine would take a little more time than hacking Wordpress for this one site."

Anyway, sometimes good enough is good enough. Sometimes it isn't.


I still don't think you know what you are talking about.

We modified the shit out of wordpress to use it as a makeshit CMS to power a large portion of the marketing generated content on our site. We even added workflow to it.

It wasn't that hard. The codebase for wordpress isn't that messy. It's not ideal, but what OSS project is?


I especially didn't like the rant about the "horrible boilerplate array declarations at the top of the Wordpress plugin". That array looks like it provides some declarative information to the backend on how to display the configuration UI. So the 226 lines of PHP code plugin does incredibly much more than his ~25 lines of code: It has runtime configuration settings and it provides a HTML UI to set said configuration options.

All that in addition to the actual functionality.

I would even go as far as to say that rebuilding all the Wordpress functionality in Clojure would not take significantly more or less lines of code than what WP already has.

Or in other words: If I only need a small defined subset of Wordpresses functionality and if I have the time to actually write a blogging engine from scratch, then it will always have significantly fewer lines of code than WP - regardless of language.

Once I add features, the line count will increase - regardless of language.

This article is comparing apples to oranges: It's comparing a small, custom-built solution to a configurable out-of-the-box solution designed to satisfy the needs of the whole blogging community.

Of course that's more complex.

But it spares you the procedure the author later describes as "When I find a bug, I SSH in, re-attach to screen, fix it in Emacs, hit C-c C-c to recompile just the functions I need to update, and then detach from screen again.".


Regarding a glaring XSS vulnerability in the comments, Wordpress 1, Clojure 0.


Trying to give clojure some expojure starting a flame war?

Nice try...


I've noticed something really interesting about articles that criticize Java or PHP. The comments defending Java or PHP are always attacks, they are never technical arguments. (This is a perfect example. It's clear that the parent is a PHP fan, but can't think of any technical grounds to argue on.) This is really sad -- if you like something, you should know why. You should also like things for reasons other than "it's the only thing I know".

(As for Java, I wrote an article about things I don't like about Java on my blog, and all of the comments were either "I agree" or literally, "U are the dumbest person in the world." Maybe, but at least I can spell "you".)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: