Zend Framework reached Version 1.5 since the last article about Zend or Rails. Ruby on Rails also did a big step towards version 2 – 2.0.2, too be precise 😉
So, who is my personal winner in this race? Which framework suits best for fast and innovative web application development?
To say things first: My personal favorite is Ruby-on-Rails!
But the burning questions is: Why!
- Ruby instead of PHP: At first it sounds rather loose to cold-shoulder the sweat and tears of learning PHP – and dig deeply into a quite young and a pure object oriented language. But everybody I talked to in the last months who came from Java or PHP just told me the same story: It’s no big deal to learn Ruby – and the benefits are overwhelming. Ruby enables you to write elegant, readable and easy to maintain code.
- Vision-Driven-Community: No matter where you get in contact with the Rails community – at a developers conference or in a mailing-list: The basic mood and vision of the community is friendly, catching, international and productive. It’s all about creating something new, something better and more elegant with the power of the community … take a look at the RailsConf 2007 keynote of David Heinemeier Hansson in Portland.
- Scalability: By now, there are several examples of high scaling web applications with rails. The only con of Rails applications compared to Zend framework apps is the need of a little bit more hardware. But the pros are worth it: faster development and easier maintenance. Twitter, Qype and Xing show it. Especially, the Twitter developers love to twitter about scalability, like Britt Selvitelle auf der RailsConf Europe 2007 in Berlin.
- REST: Version 2.0 is a big step towards the principle of Representational state transfer. Now REST is deeply implemented into the Ruby on Rails framework. This makes it easy to create consistent interfaces to other systems. REST was nearly buried in oblivion but it’s a sophisticated and strong feature based on the http protocol. Find out more by the free PDF-book of b-simple focusing on RESTful-Rails.
- Database-Migrations: Rails offers a powerful script based tool to create and redo database structures called migrations. For projects following the principles of “pragmatic programming” this is a perfect tool to create and improve the whole database schema and fill tables with data. Zend want to have a feature like that, too. There is a proposal for that feature – but nobody knows when this will be implemented and how it will function.
- Test-Driven-Development: Rails still is one of the leaders in TDD by it’s built in creation of test infrastruktur for automated unit- tests, functional tests and integration tests. Zend Framework tries to catch up with its ZFTestManager – but a conclusive integration into the framework is still missing.
- MultiView: Within Rails, content can be presented in different ways according to the type of request. You easily can create different views to show the data as a CSV file, an RSS feed, a classical HTML page or as a special iPhone page. SlashDotDash shows, how easy it is to create a special iPhone optimized user interface for a rails app.
But there are some specific projects, which are not well suited for Rails:
- … if the application has to run on a shared-host-webspace: Rails is developed to create professional web apps. A simple webspace package at hosters like 1and1 or godaddy are not suited for the deployment of a rails app. Shared-hoster like DreamHost are positive exceptions as they offer Rails on their shared hosts. But there is a growing number of specialized hosters which offer hosting solutions suited for everybody – from private to enterprise. And sure, Rails runs perfectly on a dedicated root server. Ezra Zygmuntowicz, one of the founders of EngineYard, Bruce Tate and Clinton Begin give a lot of insights in their new book Deploying Rails Applications: A Step-by-Step Guide.
- … if the application has to run on a Windows Server: Ruby on Rails is optimized for UNIX/LINUX based systems. It’s fast on the common web-server infrastructures like the different LINUX distributions as well as MacOS X. On Windows machines the performance is enough for development but not enough for most deployments: Ruby on Rails is about ten times faster on non-Windows machines. So, deployments on Windows Servers are only feasible for small intranet settings where the IT department insists on using Windows as a server OS.
- … if you only need the actual date on a static webpage. In this case Rails as well as the Zend Framework are way to big.
- … if you as a developer do not understand an English word 😉 There is a lot of information about Rails out there, and there are localized activities, like the German or Spanish user group. But the community is English focused. Not to forget institutions like Peepcode or Railscasts.
My2Cents
Let me get this out of the way first. I am the leader of the Zend Framework project at Zend. So nobody should expect the following to be exactly unbiased. 🙂
Also, I have spent most of my time programming in Java, some time (about 6 months) building a Rails application, and was relatively new to PHP when I started at Zend. I’m also ‘classically trained’ as a computer scientist with a BA from UCB. I’m not saying any of this to boast- at least I don’t believe I am ;)- but rather to point out that where I’m coming from with what the assertions I make below. Obviously, I’m lucky enough to have spent a lot more time than the average PHP- and possibly Ruby- developer learning different programming languages and paradigms. In my experience, many web developers come to projects with much less background in OOP and other programming paradigms and have to learn this stuff as needed for the project.
Allow me take your points one-by-one:
1) Ruby instead of PHP: It depends on your definition of ‘better’, but certainly Ruby has a more flexible, more dynamic object model with advanced features like incredible reflection capabilities and closure. I agree it is a gorgeous language- a language that CS professors can love. And certainly Rails would not be what it is- inarguably an elegant framework that solves many problems well- without taking advantage of many of its capabilities. But there is the performance tradeoff that is related to many of these capabilities. And I would venture to guess that many RoR developers don’t fully understand these advanced OOP capabilities to effectively use them (closure is considered an advanced topic in language design and use). And much of the elegance of Rails is obtained through syntactic sugar in Ruby, which I believe is a double-edged sword as it can obfuscate what is really happening in the language itself and its object model. This happens most prevalently in the configuration and DB migration files, IIRC. Rake also takes advantage of syntactic sugar. And PHP had very different design goals- it gained so much popularity because it was easy to use and didn’t require an formal training to write web applications. While the object model is relatively basic compared to that of Ruby, many PHP developers appreciate the fact that they can still write apps in purely procedural code. My point? Ruby is great at meeting its design goals, and I love using it. But PHP is also great at meeting its design goals, and I love the fact that we have so many useful sites as a result. Working with several languages has also left me with the distinct impression that the language typically has little effect on the final quality and capabilities of the product. Good PHP/Zend Framework developers can write a site that is just as interesting and advanced as Ruby/RoR developers.
2) Vision-Driven-Community: The Rails community is undoubtedly vision-driven, but that doesn’t mean that the ZF community isn’t (I know you aren’t saying this directly- I just wanted to make this clear.). We are not Rails. We don’t want to be Rails, although we certainly have adapted some of its good ideas to the ZF project. W feel we can solve some problems better with a different philosophy. Let me give you a few examples reflecting our vision. . .
We believe in building from the ground up to simplicity and providing useful extension points all along the way. We believe in convention AND configuration- it should be entirely left up to the developer in our opinion so we will continue to provide full support for both. We believe wholeheartedly in opinionated software (who wouldn’t?), but we do not believe in opinionated software frameworks. For example, we intend to support REST and SOAP equally because they are both out there in the wild. In fact, SOAP is common in the enterprise, which is one environment we aim to excel in. Many people have built frameworks on top of ZF, and I find that fascinating. In a sense, we are continually building a new framework on top of our existing framework as we build up to the the out-of-the-box functionality similar to what Rails offers now. But we’ll support any AJAX framework, any web service, any PHP ORM technology on the backend; we won’t define what a model is for every project (right now we don’t have any concrete definition of a model, and this is very much on purpose). All of these are extremely risky strategies in today’s web dev environment. We believe they are what’s right for ZF. To me, ZF therefore represents a very vision-driven project. Whether it’s as vision-driven as Rails is a matter of opinion IMO. 🙂
3) Scalability: There are several examples of large, high scalability sites written in ZF, too. I happen to have the privilege of knowing there are some *enormous* sites that are either in the works or considering ZF. I don’t see this as a point of differentiation in the projects.
4) REST: We also have REST client and server implementations in ZF. I don’t know how they compare to REST support in Rails as of 2.0; I’ve heard that REST is integrated quite well in RoR now.
5) Database-Migrations: We don’t have DB migrations in ZF yet. When we add them they will likely be built on the flexible Zend_Build tooling infrastructure, which is now in the proposal/prototype stage. We think they are important, and we have some opinions about what would be best for our users that differ somewhat from those of Rails. For example, it is unlikely we will build a schema abstraction for migrations since we belive the DDL differences in databases that back ZF applications are too great, plus it may be more obvious to our users to use the DDL that they are already familiar with for their database of choice. FYI, the proposal you link to is outdated and will likely have to be refactored or rewritten to work on top of Zend_Build.
6) Test-Driven-Development: Yeap, RoR is definitely a leader in facilitating TDD. We are currently building out our capabilities here with API’s to test controllers and other utilities, but we have certainly have a ways to go. BTW, all the code written on the Zend team for ZF is done with TDD, and I am a huge believer. I am also a huge believer in agile methodologies, and this may be a direction we go in for future project management; I haven’t figured out how to best implement it in a OS project yet.
7) MultiView: I believe this could be achieved easily in ZF using a combination of view helpers and client detection. In fact, we’ve talked about shipping a device database like dotMobi or WURFL with the ‘fat’ ZF distribution (stay tuned for what that means). This should help our users address different interfaces for different devices with different capabilities. We already have examples of controller actions handling asynchronous requests. I will forward this to Matthew, who is much more capable than I to fully address this issue.
Now for the points at which Rails doesn’t excel as much. I hope it is clear from what I’ve said above that I believe Rails does excel in areas where ZF does not, and I can’t necessarily say much about Rails with respect to the assertions you make. I can say something about ZF’s corresponding capabilities, however.
. . .if the application has to run on a Windows Server: I’ve never tried to run Ruby or Rails on a Windows server. I know that PHP runs well and that Zend distributes a well supported Windows stack called Zend Core. AFAIK, ZF runs perfectly well under Windows, and many of our users are running Windows/ZF in production seeminglywith no more problems than those running Linux.
. . .if you only need the actual date on a static webpage: First off, *every* component in ZF is use-at-will. Even the MVC components. You can easily deliver almost entirely static resources without incurring the overhead of the dispatch loop in ZF. This is the first point on which I strictly disagree with you. ZF is only big if you choose to use a lot of our components, and/or you choose to trade off some performance for maintainability of the app. This reflects our ‘unopinionated software framework’ philosophy.
. . .if you as a developer do not understand an English word: I have some ‘buzz metrics’ that I routinely monitor, and without a doubt Rails is more popular in the states. Our sweet spot seems to be Europe- especially Eastern Europe- and the far east. Of course, ZF documentation is pretty thorough, and we’ve been fortunate enough to have community members give back in the form of documentation translations. Our docs are more or less fully translated in to 6 language, and portions are translated in about 30 languages IIRC. Our international support is not unintentional. Here are a couple of examples: 1) We will avoid facilitating pluralization of models (more or less undefined at this point, as mentioned above) for database tables as English pluralization is irregular and it doesn’t help those who don’t understand English with readability at all. Also, to give you an idea of how much we think about our non-English-speaking users, before I joined some referred to ZF as ‘the Zend Framework’, including some content on our site. I explicitely requested that we standardize on ‘Zend Framework’ because keeping the article would make it very awkward to discuss it in a foriegn langauge. I’m not sure how international the contributing community is in the Rails project, but I can pretty safely say most of our users are non-English-speaking. We don’t have any non-English resources on our site beyond the translated manuals, however. I personally would like to see the entire site localized in several languages, but we can’t do everything we’d like to see done at once.
Finally, I want to make it clear that we don’t see ourselves racing against RoR in any way. The web development community has become *huge*- there is more than enough room for several agile-oriented frameworks. Even if you consider the PHP community alone, there is enough room for ZF, CakePHP, Symfony, CodeIgniter, and any number of other PHP frameworks. The fact is, we all have our strengths, and there will be projects better suited for RoR or Cake- or ZF, for that matter. This is why I really don’t believe that straight comparisons between frameworks without the context of a project’s requirements is very useful. If your project’s requirements can be satisfied with RoR and is unlikely to grow beyond it’s easily available capabilities, I’m likely to recommend it. It is built with simplicity and short ramp-up in mind, and it is a more mature project than ZF. If you’re talking about an enterprise app that must integrate with legacy applications or a complex app that will require many points of extension, you’ll find my recommendation will be different. At the risk of sounding *too* biased, it would probably be Zend Framework. 🙂
Lucky you — you get two ZF developers replying to you today. 🙂 I’m a core developer on the ZF team, and maintain the MVC and server components.
Wil has written a lovely response, but I wanted to respond to a couple of items in particular, item 7, MultiView, and item 6, TDD..
Regarding MultiViews, version 1.5.0 of ZF introduced a new action helper, ContextSwitch. This does basically what you’re describing — based on the request, it can decide what view to present to the user, and can perform a variety of actions, from setting the correct response headers to selecting an alternate layout. We offer, out of the box, the ability to return XML and JSON responses, but it’s extendible, allowing you, the developer, to decide what contexts you want available — and for which particular actions.
Regarding TDD, most contributors to ZF, myself included, use TDD to develop the framework itself. As such, there *are* mechanisms in place for testing your controllers. The problem is that it’s not easy. I’m attempting to address that, and am working up a prototype that will facilitate TDD with your applications — and make it simple. RoR *does* have excellent testing, and I want to foster that same spirit in ZF applications.
Thanks Wil and Matt for commenting my post from the Zend-Framework point of view! I’m honored to get feedback right out of the core ZF team 🙂
One thing I want to point out first: Plurality and competition in the field of scripting languages as well as web frameworks is the best thing that could happen to us! I love that we have the choice what suites best for us – or for the project we want to realize. And it’s great to see the communities growing on both sides.
I’ve got the chance to realize projects in ZF and RoR – so it cleared out that RoR fits best for me. But I only can encourage anybody to digg into both ways … and maybe even try some different frameworks, too.
Thanks for pointing on the capabilities of ContextSwitch – I did not stumble upon, yet.
So, let’s grow, inspire and invision both communities!
Hey Blogger,
It’s been a while since I saw a “non-religious” aproach to a language decision.
While showing your view, you kept a clear prespective of the scene.
Conviced us, readers, that you’ve explored it well and for that particular case, the best option is RoR.
Congrats for this beautiful post.
Thanks!
many shared host do not provide ROR support , also there are few web applications as compared to php + zend is not the only framework in php to work with , but Ruby has got only one , so no choice there ,ruby is not as fast as php, no support for procedural approch makes the learning curve steep + difficult for classy programmers,
It wd be safe to say ROR was a good compitior but now in 2009 php has emereged as winner , univarsially accepted server side scripting language.
@lion21: if you compare the percentage of shared hosts providing RoR support with those who provide php support … you are right – there are more shared hosters with php support. But don’t ask them for support for the zend framework 😉 And yes, there are many great php based web apps like WordPress, written in php – and it is quite easy to put them on your server and use them. But that is not what Ruby on Rails is designed for. RoR is tailored for developers who create new web applications. And here the elegance of the programming language Ruby and the clever designed RoR framework work perfectly together to provide a tool for developers to realize great and maintainable apps in a short timeframe. I absolutely disagree with you that Ruby and Ruby on Rails are hard to learn for devs … looks like you never tried it. And I only can recommend that you tryout RoR. I don’t have to convince anybody whether php/zend framework or Ruby on Rails is better. If you’re not sure – give both a try.
BTW shared hosting support for Ruby on Rails is getting better and better these days, thanks to the Phusion Passenger solution aka mod_rails – it’s built on the Apache webserver and deployment of Rails apps is only a matter of uploading files – so no RoR specific server configuration required for running Ror apps.
Wow. I am very glad I came across this. This has got to be the most sensible discussion (between the blogger and the ZF team) over web application frameworks and technologies that I have ever seen.
I use ZF heavily because it fits my style of development. I do not like opinionated frameworks. I simply want a tool box that lets me use as much or as little as possible. I prefer to code rather than have code generated OR to configure pieces together via XML. For me ZF allows me to have my preference while greatly accelerating my development. RoR just doesn’t quite fit my style but thats not to say its not great for the next guy. 🙂
I actually ended up here because I was going to try one last time to find some sensible discussion on this topic. I also do some Java development and have often wished Java could be as powerfully dynamic as PHP and then I discovered Groovy. My interest in Groovy led me to Grails (Rails for Groovy) but as I said I’m more of a fan of the ZF style of framework. I wanted to one last time get some comparison and contrast on ZF and Rails to see if Grails may be a fit for me or if Groovy would be capable of handling a port of some of my most commonly used ZF components if not the entire framework. Honestly I’d love to combine Groovy/Java a port of ZF and PHP via Quercus into my ultimate toolbox for web application development. IMO this would make for an EXTREMELY powerful platform and toolset.
I’d go with the Zend Framework. RoR is excellent, but with PHP you essentially have 8 or so years of it being the number one web scripting language, and massive support has been built up in that time with the number of libraries, and books etc. dwarfing Ruby. PHP is really not any more “difficult” than Ruby… in fact PHP caught on because it is rather simple. As the poster above states RoR is avery opinionated framework. The ZF is far more flexible in that regard. It really depends on what you want to do, but overall for my purposes the speed of implementation with the ZF is actually quicker.
Great discussion. I used to be a developer but moved on to the operations side but now I’m back programming. Recently I spent some time learning Ruby and once I got past the magic part I found the language elegant and powerful. I still struggle with learning the underlying classes. Additionally, I found it difficult to find hosting (6 months ago), so I’ve been checking out Zend. From my perspective Zend is difficult to learn as they hide all their learning tools. It appears to me that Zend is all about making money now. Ruby has many many great free tutorials to get started (zend has one with piss poor examples (no mysql)).
What I really want to know is which is faster? I felt like Ruby was dragging as my application got bigger. Twitter has moved on so they are frustrated with speed as well.
Zend shows very poorly on the benchmark tests that I’ve found which makes me consider CodeIgniter but that framework lacks an ORM which is important to my upcoming project.
Anyone want to chime in on speed and scalability?
Wonderful post!
I’ve been using ZF for few years not and have done a fair chunk of RoR development prior. I agree with dp10, learning Zend may look difficult at the beginning, because you don’t know where to start. That is the only negative aspect, since there are very little tutorials that will get you 0-60 before you can easily read online documentation and understand whats going on.
I wish ZF team could address this in the future for all “new” developers switching to their framework. I spent about 2 weeks learning this 2 years ago, painful weeks. But now I absolutely love the framework and would not deffer from it.
Keep doing a wonderful job and Zend guys!
P.S. about the scalability and speed, we are running 2 enterprise level solutions on ZF. It really makes things look good.
Thank you very much for this, I will have to consider all this before I start my next big project.
Just as a follow up, does anyone know if the more recent releases, (zend 1.11 and Ruby 3.0.3 at the time of writing this) change any of the origianl points here?
Thanks everyone!
RoR rocks!!
Hi,
There goes the bad guy (me).
I usually use ZF, but i wanted to know if RoR is worth a try.
I am not in love with ZF, but I do not hate it.
And as for RoR, I am still not convinced.
It everywhere the same thing, no one give a right justified bad experience.
So, there is the question:
How hard is it to find a solution to a problem with both ZF and RoR?
RoR and ZF docs suck. I am clearly a Java hater, but their javadoc is more than OK.
While looking for information, especially when I am at work, I do not want a asynchronous discussion in order to find a way to solve something, so posting to a forum at that time is out of question. I want to find the solution in the doc, or at least in a forum.
When that is not possible, I look into the code.
The ZF code is a labirynth that the F3 key in eclipse IDE cannot always solve (abstract classes oh get damn).
The ZF class are sometimes illogic: XXX.php is an abstract class as well as the YYY/Abstract.php
Anyway, sometimes it get on my nerve, and from what I have heard, some ZF functionnalities are undocumented (or very-little-documented) on purpose just to make a company request (and pay for) a ZF expert.
By the way, if ZF Core members are reading this. I often use the Zend_Soap_Server class, which is a big useful wrapper around the PHP SoapServer class. I think your are aware of the following case:
When in a method, you expect a parameter to be a set, if the client send just a set with one item, the structure will be different of if a set of multiple items was sent. (I was on ZF 1.8 at that time).
I know a lot of con to ZF, but it is a useful framework. I just have to apply some skills to “patch” for this, sometime I have to dig up the ZF source code.
If RoR has too a lot of con while debugging, maybe it won’t be a framework for me.
(I already hate the magic tools that create code or sql in your place. But ZF has it own magic too: auto-loading, application.ini, … I just adapt myself)
Sorry if this post was aggressive, but i long to know the cons to RoR.
Thx