Read the latest web development and design tips at Fred Wu's new blog! :-)
Poke me on GitHub

Zend Framework, where do you want to go tomorrow?

Two weeks ago I started working with Zend Framework at work. I chose to use Zend Framework for one primary reason: Zend. Even though I have plenty of experience with CodeIgniter and Kohana, I simply could not take any risks using them for a rather large project at a company I had just joined.

My experience so far is mixed. Probably because I am so used to the way CodeIgniter and Kohana do things, Zend Framework just appears utterly complicated and difficult to work with (at the beginning).

When Zend Framework was first announced, the developers have promised us one thing: extreme simplicity. I was ‘extremely’ excited, but it turned out that it wasn’t the case. Ironically, Zend Framework is the most difficult one I have come crossed so far. I mean, as complicated as Symfony is, it has brilliant documentation and an active community to back it up.

Initially I was under the impression that the Zend Framework’s documentation is excellent, simply because the documentation site looks very informative (quantity wise). After a few days of using it, I realised that I was wrong again. The documentation is often outdated, sometimes inaccurate (might be typo) and most importantly, very difficult to find specific information. The funny thing is, often than not I still need to rely on Google or some other external sources to find necessary information.

Setting up bootstrap and environment file is a boring job. Fortunately there are a couple of good tutorials on the cyber space. The quick start guide on the Zend Wiki however, is lack in both details and elegance.

Apart from the ‘Zend’ name, there is another reason why I used it for this particular project: Zend_Search_Lucene. The project we’re working on involves a collection of product information, therefore a more advanced search engine would be a highly welcomed feature.

Unfortuantely, Zend_Search_Lucene doesn’t really meet my expectation. First of all is the performance issue. On my local machine at work, a brand new 24″ iMac with 2.8Ghz CPU and 4GB RAM, it takes around 2 seconds to perform a single word search on 5,000 indexed products. Second of all, the search implementation is flawed, at least the default algorithm is. We have noticed quite a number of unrelated search results come at the top of returned result set, and furthermore, the case insensitive search doesn’t even work. So far I am not really impressed by Zend_Search_Lucene. I have tweaked the implementation quite a bit and still couldn’t get 100% satisfactory search results, not to mention the extremely disappointing performance.

I think it is silly to call the current Zend Framework version 1.5. I mean, come on, where are the basic features such as a pagination? I am aware of Zym and Zend_Paginator (which could be seen in 1.6 incubator). After wasting several hours researching and working on 3rd party implementations, in the end I gave up and quickly made one myself. I felt very unproductive and unintuitive. Using a framework is supposed to save time, but Zend Framework at its current state, isn’t doing a good job for me, and it probably won’t be for a while.

Contrary to the ‘awesomeness’ of Rails 2.0 and 2.1, I find Zend Framework extremely ‘boring’. PHP is known for easily make websites and web applications, but it looks like Zend has decided to throw that away and follow Java and .NET.

Oh and I almost forgot to mention the awkward naming conventions that we ‘sometimes’ have to follow. For instance, action helpers must follow the ‘underscore rule’ otherwise they won’t function, but some other parts of the framework don’t necessarily enforce this convention.

At the beginning of this post, I said my experience with the framework is mixed. Well, that’s true. Even though it has its flaws, limitations and glitches, it still is a highly usable web framework. It is especially useful for specific functions that Zend has provided components for, for example the Zend_PDF component.

I wish Zend Framework was a lot more complete than it currently is. An object relational mapper would be nice. (And again, yes I am aware of the discussion of the possibility of including an ActiveRecord implementation.)

As unimpressed as I am, Zend Framework is still my number 1 choice for medium to large sized projects which require team collaboration. For smaller projects I’d definitely use Kohana, CodeIgniter or some other smaller players. And for ‘fancy’ web applications, Ruby on Rails is where my heart is. :)

And that concludes my rant. :)

  • Digg
  • DZone
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter

Related posts

Tags: , ,

Comments Section

17 Responses to “Zend Framework, where do you want to go tomorrow?”

Sidebar might be covered by comments ... consider it a feature! ;)
  1. 1

    I am curious about all the people wanting ActiveRecord for ZF, well, from my experience, it is not possible to create an AR like orm for php 5.2.6. mainly because of static function problems, if you get pass that (of course it would look darn ugly for current php release) then you will need to, for example, send arrays to your finder function to have smth like named args(which after all is not such a big problem), and then people can go to relation mappings, onetoone(hasone,belongsto) is basic to implement, so is onetomany(or manytoone)-either greedy or lazy, but when you go to manytomany(hasmany, hasmanythrough, hasandbelongstomany), hell happens and not because it gets too complicated to hydrate objects, because the language really stays in your way.

    My recommendation in your quest for orm for ZF, checkout doctrine, its shaping quite well as one of the devs likes to say :) and then there is another post on the web about a guy creating automatic zend forms from doctrine models which gives you a prehistoric admin generator :)

  2. 2

    I think the “comes from a small vendor” argument isn’t valid for open source, at least not for smaller systems. You might not want to make major changes to somebody else’s framework, but you can certainly fix bugs and add small features.

    To me, the Zend Framework isn’t a real framework, but is more of a collection of libraries. It doesn’t come with a cohesive strategy for writing applications as much as symfony or rails does. Like the “.net” framework, it’s trying to bamboozle managers into thinking it’s something it isn’t.

    The qualities of the libraries vary from adequate to worse. I was tasked with adapting one of the “web services” implementations to another environment and found that the code quality of the area I was looking at was pretty bad.

    Rolling your own in-house framework is less of a bad idea than you might think. Remember that you can get 80% of the functionality for 20% the work, and having every part of your stack optimized for your environment can give you large gains in EVERY department.

    ————-

    As for ORM in PHP, my suggestion is to build something that works by introspecting the database, that uses external configuration files for annotations at most.

    It probably makes sense to reduce the scope of the ORM problem to produce a product that actually works: that doesn’t promise more than it can deliver. Completely avoiding the formulation of joins wouldn’t be crazy — ORM’s have always been stronger in the “CUD” department than in the R. Complex queries might benefit from an entirely different approach.

    This has happened in the .net world. LINQ applied some brilliant ideas (the language integrated query stuff) to database mappings, but they kept it simple, and didn’t consider anything other than a 1:1 structural mapping between thte database and objects. It’s a great product and people love it.

    The entities framework, however, has had people picketing their headquarters in Redmond because they just can’t figure how to make a product that solves the more general problem that doesn’t make more problems than it solves…

    And that’s what it comes down to. Somebody has to come out with an ORM that has the motto “Do No Harm”. Even if it means the ORM “does less”.

  3. 4

    I always thought that Zend framework gives you the lower part component, standards and naming conventions (witch looks a lot like JAVA’s) And, if one wants to use it he must build his own framework on top of Zend. Where he could handle things like directory structure, test, and so. Zend framework just give you the lower level components.

  4. 5

    You might want to check out Sphinx for your fulltext search needs.

    It is an external MySQL indexer but integrates very well with PHP and has very good performance.

    As for the Zend Framework, it is definitely a larger beast to set up, and it requires more “up front” work than CakePHP or CodeIgniter and the like, but if you are working on a project that has a long-term lifecycle (i.e. not something you “fire and forget” to a client’s webserver), then the structure of something like ZF will save you time and effort in the long run.

    It is similar to comparing something like jQuery to the YUI framework. jQuery can get you up and running in no time and certainly looks very sweet and compact in its code, while the YUI framework is more deliberate and requires more time and more lines of code to accomplish things.

    But developers should be weary of frameworks and libraries that do what I call “magic”. The day you need to do something that strays from the intended operation of that magical easy-to-use framework (and god forbid that day is 6 months after the last time you looked at your code), you are going to move at a snail’s pace in getting it done and might even have to put in some ugly hacks.

    A well-defined, flexible (i.e. no “rails way”), consistent and verbose codebase is a complex long-term multi-developer project’s best friend.

  5. 6

    Well, I have to take responsibility for both the 1.5 naming and the poor state of the QuickStart. Lots of people have criticized the version number, but they always give different examples of what we’re missing to justify a version number of ’1.5′. I honestly don’t know why it matters; we called it 1.5 because it was larger in scope than what we were initially planning for our minor releases. The next release will be called 1.6 because the scope is about right AFAIC. Obviously the QuickStart needs some attention. I actually plan to work on it right after I’m done with this comment, but there’s really no excuse for how long its been in the state that it has. I’m sorry, and I hope you will at least find it helpful once I’ve actually completed it. :)
    Could you please enter issues for Zend_Search_Lucene in our issue tracker? I’ve just created a ‘performance improvement’ issue type. Alex is working on Lucene 2.3 index file format support this week; if you enter an issue and mail the id to me, I will discuss profiling the entire component with Alex so we can identify any new bottlenecks.
    We actually do have an ORM implementation; technically the db and row data gateway patterns are ORM designs. If you’re looking for a more traditional and/or powerful ORM implementation, definitely look at Doctrine or Propel. You should find it easy to use either project with ZF. As far as an AR implementation goes, I don’t think we’ll seriously look at it until we feel that we can bring new value to the PHP community. In general, we try to tackle the areas in PHP that we feel have not been addressed or addressed in a way that we can recommend without reserve to our users. Basically we feel that there’s plenty of stuff to work on without reinventing the wheel. :) That said, Zend_Db_Table is not necessarily our last take on ORM; in particular, we have been looking at what’s been done in LINQ to see what we might be able to add to the PHP community’s box of tricks.
    Could you please add issues for the documentation, as well? Documentation is both hard to write (the implementers often have a hard time see the subject matter from the new user’s perspective) and hard to keep in sync. We could always use more help in this area. ;)
    Finally, I’ve tried to get everyone at Zend to stop using the phrase “extreme simplicity”. Not because ZF isn’t simple, but because it doesn’t provide the kind of ‘simplicity’ that people have come to expect by using Rails and clones. I put that in quotes, because simplicity just isn’t that simple to define. :) I think you’ll find it’s simpler to use ZF with other projects. It’s definitely simpler to use 1 or 2 ZF components without using the whole thing. It’s probably even simpler when you have custom directory structure requirements that buck all conventions. But it is certainly not simpler to set up an initial project with no custom structure requirements and basic things like controllers/models/etc. by convention with ZF components in the main distribution, and this is what most people think of when they hear ‘simplicity’ WRT web framework in my experience. That said, as one commenter noted, ZF is really a framework to build frameworks on top of. In fact, that’s exactly what the ZF team feels it’s doing with each release. We’re building towards that ‘simplicity’ with components such as Zend_Tool, but because we have built layer upon layer towards the most common of use cases instead of down from them we’ll be taking a bit longer to get there.

  6. 7

    @ion gion: Thanks for the comments re AR for PHP. Syntax-wise I don’t really mind, even though Ruby’s syntax does look cleaner. And thanks for the Doctrine suggestion, I’ve tried Doctrine a while ago, it was good (although not as good as Rail’s implementation) but I need to wait for a while before adapting it in commercial projects. :)

    @Paul Houle: I agree with you, that Zend Framework is a collection of libraries / components, which I consider is a good move. Developers are able to plug-n-play those components into existing frameworks / application. However, I still think a base MVC bootstrap should be included for convenience sake. :) As for the idea of using an in-house framework, yes that is what I have planned for (see: http://thislab.com/2008/03/17/.....ications/).

    A lot of ORM implementations are making things more complicated than they should be. Here is a very good presentation on what is wrong with those ORM solutions: http://dave.org.uk/talks/lpm/2006/orm/ I fully agree with the author and reckon ORMs should be intelligent enough to detect relationships and other information from the database/table/field meta data. It seems crazy to me that if I were to model my database in UML, I then have to reapply the same stuff in my code again. This is against the DIY principle and is difficult for future upgrade / maintenance. I’m not entirely too happy with the AR in Rails either, but at least it has a migration mechanism to keep track of changes.

    @RStankov: Agreed. :-)

    @Seb: Thanks for the link to Sphinx, I will definitely check it out! I do agree with you to a certain degree regarding the flexibility factor of a framework in multi-developer projects. But it’s not necessarily a bad thing to enforce conventions. Python for instance is looking to encourage one way of doing things in the upcoming 3.0 release.

    @Wil Sinclair: Thanks again for your comments! Zend Framework is blessed with people like you who really try to get feedback from the community. I would definitely start to submitting tickets (or even patches if I have time). :)

    Regarding the version number. Even though it is only a number I still believe people judge the ‘completeness’ of software by their version numbers. And from what I see, Zend Framework has not reached the golden 1.0 yet. But that’s just a trivia thing anyway. :)

    Back to research on ZF now… :)

  7. 8

    ZF was a huge let down.

    If I wanted to program in Java, I would. ZF brought me back to the days of the bloated behemoth that Java Frameworks were (or small-medium web based apps).

    I looked at it for about 5 minutes, laughed, then forgot about it.

  8. 9

    I have been using ZF extensively since version 0.2.0 and it’s my framework of choice still. However, I feel that since the first official release of version 1.0 a lot of bloat was added and framework development took a turn for the worse. Components like viewRenderer and the Layout view helper were just introducing more levels of complexity and sometime annoyances instead of building on the strong foundation that the framework had.

    I still feel that the framework gives me a lot of production ready components that saved me a great deal of time over the years and helped me form a much more structured application design. The DB abstraction classes are top-notch, the MVC components are overall very good (aside from what I mentioned), Zend_Mail is also useful and the list goes on.

    I think the ZF was an important addition to the framework selection for PHP, as an intermediary between Cake and code-igniter. Hopefully version 2.0 will scratch plenty of what’s wrong with the current version and expand on what works well.

  9. 10

    The last thing ZF needs is a full blown Rails style ORM implementation. Theres enough nievity and downright miss-information out there currently about MVC model implementations without encouraging further confusion within another popular framework. The vast majority of ORM solutions create unwanted dependancies and promote poor practices, they do no favours for PHPs OO progress.

    Equally, since when was a paginator an essential part of a framework? A minor gimick type feature at best – however useful.

    Frameworks should promote and assist with best practice implementations by providing flexible constructs to work within. ZF largely achieves this with its loosly coupled approach.

  10. 11

    @Bill, I think if you spend more time you’d find that ZF certainly do have its advantages, whether or not they’ll justify the use is another story. :)

    @Eran: Thanks for sharing your comments with us! I agree with most of your experience except for the mention of the DB abstraction class. Although that could be my own problem. :)

    @Steve: Thanks for sharing your opinion too, I appreciate it. And it’s good to see comments from different perspective. Although, how you believe a paginator is a gimmick is beyond me. ;)

  11. 12

    The documentation is often outdated, sometimes inaccurate (might be typo) and most importantly, very difficult to find specific information. The funny thing is, often than not I still need to rely on Google or some other external sources to find necessary information.

    Couldn’t agree more.

    I think it is silly to call the current Zend Framework version 1.5. I mean, come on, where are the basic features such as a pagination?

    Again, couldn’t agree more.

    Zend framework is still my framework of choice, though, i’ve never used or tested any other framework. It looks the part, but if documentation continues to be bad it will reflect of the framework itself.

  12. 13

    Interesting post Fred, you’ve identified many of the same issues I did – I was going to use ZF for a personal project but just grew frustrated.

    Many of these issues will eventually be resolved, but the biggest and perhaps most frustrating is the namespacing – I don’t see how this can be fixed/changed without breaking functionality for a lot of people who already use it.

    Cudos to Will for follow all these posts, I think it demostrates his commitment to the ZF.

  13. 16

    I’m working with ZF Lucene componenet for couple months and believe me that mostly speed issues are because of wrong indexing or wrong queries. It is like a SQL – if you write inapprioprate query you can get results in minutes…

    Nex thing is ZF it is a framework to use in your project, not a ready to go product which can produce blog in 10 minutes. It is more component library.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>