Get your FREE 30 page Developing SOLID Applications guide!

Learning Zend Framework: A Case Study

Out Of Date Warning

Languages change. Perspectives are different. Ideas move on. This article was published on March 18, 2010 which is more than two years ago. It may be out of date. You should verify that technical information in this article is still current before relying upon it for your own purposes.

Recently I’ve been immersed into a Zend Framework project in a way that I’ve never been immersed before. This immersion experience has brought out a few thoughts and lessons that I’ve learned through the process about how to get into a framework, how to start a new project using a framework you’ve never used before, and the best way to learn without losing your sanity. Here are my findings.

Don’t fight the framework.
Various frameworks out there have varying degrees of integration with one another. While an argument can be made as to whether or not tightly integrated frameworks are better or worse than loosely integrated frameworks, when starting a new framework it’s best to accept it lock, stock and barrel (in other words, accept it completely).

This isn’t always easy for developers. They have a particular problem they want to solve and often times solving it with a framework they haven’t used requires a lot of setup, a lot of learning, and a lot of banging their heads against a wall. I know for me this is true whenever I start working on a new framework or product. But this is an important component of using the framework. When we try and go around the framework, when we fight the framework, we ultimately end up doing a lot of the things that the framework is aimed at keeping us from having to do.

Embrace the framework. Once you’ve learned it and mastered it, you can go around it, fight it, and ignore it if you want. But until that point, ignoring it will only lead to more headache and frustration – especially when you discover the framework was doing something you were trying to do all along.

A little knowledge can be very dangerous.
When I was starting to get in depth with Zend Framework I felt pretty good. I was getting a good grasp of how it worked, and I was mastering the idea of MVC, Zend’s way. I felt like I had learned the basics of Zend Framework, and I figured I had at least graduated to intermediate.

Until I realized I hadn’t done anything interactive with GET or POST. Whoops!

Having just a little bit of knowledge in a framework can be very dangerous. Thus, it’s important to be careful when developing, to make sure that the level of development matches the level of understanding. Don’t start with your most advanced, most difficult logic when starting with a new framework. Do something easy – like display the publicly facing portions – rather than something hard. You’ll find that you learn at just about the same pace without having to rewrite your application when you learn about better practices.

Learn when and where to ask for help.
Chances are good that any framework has a strong community around it. If it doesn’t you should consider one that does. Chances are also good that the documentation isn’t the best. That’s ok. Just learn when and where to ask for help. Learn who is willing to talk you through things, and have good questions ready for when you’re talking with those individuals.

For me, Matthew Weier O’Phinney answered a lot of questions. So did Matthew Turland. Both of them were great helps, and there are lots of other great members of the Zend Framework (or Symfony or Cake or…) communities out there, ready to give you a hand.

A word of caution: when asking for help, be sure to thank and respect those who help you. Most of the time they’re doing it for free, even if their day job is to consult on these products (or build them, in MWOP’s case). They don’t have to help you, and if you act entitled, they simply won’t.

Have patience.
Learning a framework is much like learning a new language. Have patience for it. The reward is great – framework knowledge can be reused over and over again. Being patient and taking the time to learn means that the knowledge will be valuable, rather than being bits and pieces of a hurried experience (which is far less valuable). A holistic understanding of the framework will serve you well, as a developer.

If you decide to endeavor on your own journey with a framework, good luck! It’s a challenge but it’s well worth it. Learning a new skill has it’s own inherent rewards, and you’ll thank yourself later.

Learning design patterns doesn't have to suck.

Design patterns open a whole new world of possibilities. So why are you avoiding them? This brand new book will help you finally understand these wonderful programming techiques!

Learn design patterns TODAY »

Royston Olivera (@royston_olivera) wrote at 3/18/2010 1:36 am:

Nice post!

yes, little knowledge can be very dangerous especially if your using a framework for a big/complex project.

The first few steps that you take when starting a project are bootstrapping and stubbing out the entire application. Having little framework knowledge at this point of time would lead to a lot of future re-work and a patchy implementation.

-Royston

Aleks wrote at 3/18/2010 4:30 am:

Love those kinds of blogposts!

I feel the same way with frameworks, and ZF :)

Maarten wrote at 3/18/2010 6:30 am:

nice read, am learning ZF myself and had the same experiences. The hard thing with ZF imho is that are alot of conflicting tutorials on how to handle certain tasks, partially because its evolving in a fast pace, partially because its looser coupling of components.

Jake Smith (@jakefolio) wrote at 3/18/2010 12:13 pm:

Brandon, I just released my first “real” project with ZF. I can tell you certain aspects were very irritating, but it is simply growing pains with the framework.

Have you dealt with “Form Decorators” yet? If not, I would definitely jump into it….the configuration can get very complex.

Brandon Savage (@brandonsavage) wrote at 3/18/2010 12:15 pm:

Jake, I’m liable to get into forms soon. I’ve been poking around them and I want to get into them because I know I’ll need them.

Edd Twilbeck (@dubsar) wrote at 3/18/2010 4:17 pm:

Great article, Brandon! You really hit on some key elements for dealing with frameworks, and your advice is solid for anyone approaching this aspect of development. Have to say I had a very similar “initiation” into the world of Zend!

Leonard Dronkers (@leonarddronkers) wrote at 3/22/2010 2:44 am:

Hi,

I agree that one must learn a framework inside-out before introducing other/additional code to it. I have seen a few developers that haven’t made the effort and are writing work-arounds for things that already exist. But, leaning the Zend Framework is hard. The reference guide is not the best resource because it doesn’t look at the big picture. I mean, a lot of people are having a hard time putting it all together.

Besides the access to great resources (people you mentioned) have you had any trouble putting it all together?

Brandon Savage (@brandonsavage) wrote at 3/22/2010 7:25 am:

Leonard, I’ve certainly had my share of struggles. Zend Framework isn’t easy, because it’s fairly extensive. It has some components that are similarly purposed or would seem to do one thing and do another (Zend_Auth and Zend_Acl, or Zend_Translate and Zend_Locale, for example). That said, I know that the team I’m working with is slowly learning and that’s been without the resources I mentioned, so I know it’s possible.

James S (@tkstudios) wrote at 3/25/2010 2:06 pm:

I’ve been working with ZF for about a year now, and this article is absolutely true. Once you really get into learning it, it can make life a lot easier. My first big web application—listy.us—is based on ZF, and it’s been a pleasure to work with, once I got a good handle on it.

One thing about ZF is that once you really get into it, you come up with interesting uses for it. I repurposed Zend_View & Zend_Layout to render text & html templates for sending out automated emails.

Another thing is you can’t be too eager to adopt new changes: Zend_Markup is new to ZF 1.10 and looked great, but it froze up once I got it to production servers. Thus followed a day of “AHHHH!” and finding an alternate solution.

Kahlil N (@syl_kn) wrote at 4/11/2010 8:08 am:

Great post! I can relate to most of what you’re saying.

I need to learn and stick with a Framework. I’ve tried Cake, Symphony, CodeIgniter, Smarty, Drupal and a few others. I start them and then get frustrated because I discover another Framework or I don’t feel that it’s flexible and I fear that I won’t be able to do exactly what I want to, the way I want to. Part of that is my lack of understanding, it’s very annoying.

I’m at the early stages of learning Zend and I’m taking your advice, “Embrace it”! Thanks.