Back at the Zend Framework… finally!

rtfm Warning:  HARD CORE DORKAGE!!!! I hope beyond all the hope that I have obtained the book that will drag me over the learning curve for Zend Framework for real.  The book I am referring to, Zend Framework In Action by Allen, Lo & Brown, was meant to come out in September, but it finally made it.

Here’s the thing about Zend Framework:  you have to know how things fit together in order to do anything, but of course you don’t know anything until after you have successfully done something.  In other words, you just have to jump in without knowing WTF you are doing.   It’s an extensive toolkit, and it’s obvious in the abstract what each module is for.   I read manuals and online documentation until my eyes bled.  I totally implemented the Quickstart and understood everything in it.  But when trying to do anything of my own I was at a loss.  Chances are, paddling alone in swift water, you will hang up somewhere or wreck on a class 5.  This is something where you kind of need the tribal knowledge of the developers to be passed down to you one to one.  Ideally you’d tell your personal guru what you wanted to do and he (they’re all he’s) would say Ah grasshopper, for that you need to initialize the Ajax context using the getHelper method.  Yeah, right that should have been totally obvious.  After all I actually have RTFM!

Well, people such as myself don’t have direct access to the ZF gurus, nor do we have the resources to afford official trainings put on by Zend taught by teachers who have learned at the foot of the masters.   The closest thing I have to a guru is the forum at manning.  I’ve made a few posts there as tixrus.   Rob Allen himself actually has responded to some of my questions  (as long as I stick pretty closely to issues related to the book’s code!) and there are other knowledgeable people there as well. So this book better do it for me.

I’m most of the way through the book, and so far I am liking it, despite a number of first edition errors and oversights.   For one thing they give you a PDF version with purchase of the dead tree version so you can put it on your laptop when you travel.  You can also download all the code examples, and they periodically update them to fix inconsistencies and bugs. But the main thing is that they build a real web app, complete with a lot of the typical messiness web apps entail.  It’s one thing to talk about a class, function, or method in crystalline isolation, but when I see it in use in something I can relate to in the real world, that’s when it clicks for me.  Plus, there is actually ZF functionality devoted to handling those messy “real world” details, such as deciding what stylesheets, includes, and javascripts to load for a particular page.

I also got ahold of a copy of Cal Evans’ Zend Framework book, (published by PHP architect) which has filled in a few chinks, but if I had to pick, I think Rob Allen’s book edges it.

I’m finding ZF a bit verbose at the moment but I’m hoping it’s a front loading thing.  Even if my ZF code ends up being more verbose overall than my legacy code when compared functionality to functionality, I’m hoping that much of the functionality of the original legacy code can be absorbed by ZF library modules, so that the overall codebase that I have to maintain is smaller.  Plus I’m hoping also that some ugly tight coupling that crept into the legacy code will be undone, and that the code will be understandable to any ZF savant, instead of somebody coming in and having to learn all my handrolled legacy framework.

I still have some questions about i18n and exactly how you set up phpunit in the ZF config so you can run any set of tests. Well, it’s time to stop babying myself and get back to work. I’ve been out of the hospital for a week now and I have a clean bill of health going forward, so anchors away!

21 comments to Back at the Zend Framework… finally!

  • Great post, At this moment I’ve got it running, using some ZF component as Zend_DB. But I have to admit that I’m spending a lot of time figuring out what component is not useful. It is for example quite difficult to guess what we don’t need in the quickstart when we start to learn ZF, wanna use ZF only as a backend, and use the best practices as possible. Not really sure how to set up the phpunit in the ZF config. Will get back to you on this..

  • admin

    Hi meetingrooms edinburgh. One thing I have decided is evil is the actionstack. I’ll post about it soon. Do you have access to the codebase from Rob Allen’s book? It’s quite helpful, except for the actionstack part. His chapter 5 has some phpunit where they set it up with the zf config file. I haven’t got it to work yet quite like I want, the problem is running subsets of tests.

  • Absolutely, It’s a nightmare running the subsets of tests.Sorry don’t have the codebase but ask a colleague who I think might do.

    Keep up the good work,and looking forward to reading about the actionstack.

  • @Meeting rooms, I would also appreciate if you can send a sample of the ZF components,I can share my codebase if possible. Thanks

  • @Meeting rooms, You said your running the ZF components asd Zend_db. Can we share some source on this as I encountered difficulties in running mine. Thanks Jerry

  • Interesting post indeed.

    I’ll be interested in learning about actionstack as well.

  • If you come to #zftal on IRC, you will have access to the ZF gurus.

  • admin

    Thanks Bonaparte I sure need them. ZF is not a trivial undertaking and there’s definitely tribal knowledge if u wanna be on the cutting edge. I’m actually thinking of springing for their residential class, it might wind up more cost effective in the long run.

  • Rob T.

    Is ZF the first MVC framework you’ve used?

    I feel it turns out that ZF is a very challenging to learn as a first framework. The design goals and features that make it attractive such as being extremely flexible, allowing use at will components contribute to it’s steep learning curve.

    Unlike other frameworks, there isn’t a lot of prescriptive guidance for fitting everything together, since the designers stress flexibility. Things will get a bit better as Zend Tool, Zend_Application, the resource loader get fully fleshed out. Things will be better in 1.8, and 2.0.

    Without Zend Tool, you Wdon’t have access to the code generator or at a minimum something to generate directory struction that makes frameworks like Ruby on Rails so seductive.

    A feature of Zend Framework is that it is a “later generation framework”. The authors looked at a lot of other frameworks that came before it. What especially impressed them was the lack of flexibility in other frameworks that made getting the last 10% of your application to behave the way you/your client wants it hard or impossible.

    Zend Fraemwork brings with it a lot of bits of current software engineering practices such as software design patterns. If you have no exposure to patterns this can be a bit confusing. The Allen book to it’s credit starts to introduce the patterns at work. However, I think some supplemental reading on patterns is needed for it all to start to make sense.

    I too learned a lot from the Allen, Lo, Brown book and the Manning Forum for the book. The sample code/application did help me get going a lot more quickly. I think reading other application code helps quite a bit.

    I’ve learned a lot from Matthew Weier-O’Phinney (ZF Architect). I recommend reading anything of his you can whether it’s articles, blog posts, or code. If it doesn’t make sense at first, bookmark it to come back to later. I read some of his articles after reading ZFiA and found that the cleared up a number of the questions I had. Matthew’s bugapp/pastebin application were very helpful to me. They are dojo apps, which adds another set of challenges in understanding the presentation layer.

    Do you have Online resources for Zend Fraemwork bookmarked? Lot’s of useful stuff here that should really be on the main Zend wiki.

    http://robertbasic.com/blog/online-resources-for-zend-framework/

    Another good example application to look at is Keith Pope’s store front app that he’s is developing for his ZF book. His book isn’t available yet but the code is on google code. He’s been keeping it current, last I saw he integrated Zend_Application which is coming in 1.8 to make the bootstrapping process more flexible and less redundant.

    http://www.thepopeisdead.com/main/comments/zend_framework_book_example_application/

    Hope This Helps,
    –Rob

  • admin

    Thanks robertbasic for that thoughtful comment. I rolled my own lightweight MVC framework about four years ago when ZF wasn’t really usable yet. And I have fooled around with R on R. So MVC is not a foreign concept.

    I have almost decided to fork out for Zend’s residential training if I can fit one in before we move to Australia. There are so many confounding things here and whenever you see code samples you can’t just use them because “they didn’t set up their bootstrap with an include” or something and soo much new stuff coming up that I have been reading about, i.e 1.8 also, I think you are crippled if you don’t have all the right tools integrated. Too much of what we used to call “tribal knowledge” that’s the unwritten stuff that the tribe all knows.

    Personally, these past 12 months have been a nightmare for me financially, health-wise, and emotionally, let’s just leave it at “a lot of shit went down.” But things are better now.

  • Rob T.

    actually, I’m not robertbasic, I just pointed to his blog entry on zend online resources. I did post a couple of additions to his entry include the list of good example source applications.

    For me the getting starting to grok Zend Controller was the key to make a lot of stuff fit together (controller plugins, view helpers, etc.). One thing that helped was writing my own controller plugin that did tracing and timing. I also did an action helper that did the same thing. It wasn’t as useful as the plugin. Both helped me get a handle on the full cycle.

    Have you seen this?

    http://nethands.de/download/zenddispatch_en.pdf

    –Rob

  • I came across this blogpost looking for a review on “Zend Framework In Action” it was very good summary and liked how you compared it to Cal Evans’ Framework book… the comments have been extremely helpful too. Thanks dorkages!

  • I was looking for a good book on how to use Zend Framework and dropped on your site. Great review given about ZF and the book.

  • It looks like many are using Zend Framework. Thanks for sharing the books link. Hope to learn more about this framework.

  • Haha I love that manning forum.

    Oh yeah.. thanks for the post

  • Came clueless, left worried. Thanks for the post. – Why did you name him Sam? Every Tom, Dick and Harry is named Sam! – Samuel Goldwyn 1882 – 1974

  • I do not accept as true with everything on that website, but you do make some very good things. I’m very excited about this subject and I myself act aa lots of study as well. Anyway it was a well thoughtout and pleasant read so I figured I would depart you a note. Feel free to check out my blog sometime & let me know what u feel.

  • Is it excellent if a vacuum seriously sucks?

  • I am not really sure if best practices have emerged around things like that, but I am sure that your great job is clearly identified. I was wondering if you offer any subscription to your RSS feeds as I would be very interested and can?t find any link to subscribe here.

  • Zend ensures secure coding.
    Zend_Tool opens gates to new ways of scaffolding the application. Building a full stack framework based on Zend Framework would be a nice idea.

  • But when trying to do anything of my own I was at a loss. Chances are, paddling alone in swift water, you will hang up somewhere or wreck on a class 5.

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.