Zend Framework, a Truly RAD Framework!

Like any profession or trade, you can spend years refining your craft; always looking for the path of least resistance; the path of greatest simplicity, which leads to your goals in the shortest time and the least amount of effort. Especially in software development, you try to simplify and automate as much as you can. Not only do you save unnecessary time, but you get to devote your energies to the most meaningful aspects; the areas that bring greatest productivity and satisfaction to you and your client or employer.

What is this technique? It comes down to only a handful of things. These are:

So how do these areas speed up development so much? Easy! They allow for a very clear separation of user interface and business logic. Through using a combination of View, Action, Partial and PartialLoop helpers, we can make a “widget” that we can drop into any view template in our application.

This widget will receive its data via a request to an action of a module/controller somewhere in our application, which for the sake of our example will be returned in JSON format. If it receives valid data, then it will render the output to our template specifications. If not, we handle this gracefully with a suitable user message.

The controller action that it calls will use the ContextSwitch helper to return simple data output. By default, it will return JSON, but this can quickly be updated to provide other formats, such as XML, CSV and TXT amongst others.

This controller action discretely encapsulated the data management requirements we need, avoiding the need to instantiate model classes throughout. Now, there is one spot to update if we need to improve performance, fix bugs, change returned fields and so on. Have a look at the included code to get a hands on understanding.

This example hasn’t taken in to account security or performance considerations; that’s the topic for another post. So next time have a think about taking the path of least resistance, or one of less with Zend Framework and try this technique. Already do it better? I’d love to learn more from you.

You might also be interested in these tutorials too...

Tue, Oct 5, 2010

How to Write a Secure RESTful Service in Zend Framework

So you’re up with the RESTful buzz but you’re concerned about security; as you should be! So what do you do? Well, like all good OOP practitioners, you don’t reinvent the wheel. As Steve Jobs said, “Good artists create, Great artists Steal”, or borrow in our case. So let’s look at the Amazon S3 model and implement that with our framework of choice - Zend Framework to protect your RESTful services.

Tue, Nov 15, 2011

Rename uploaded files with Zend Framework

Recently I was asked how to rename a file with the Zend Framework that used a Zend Form and Zend File element. They key requirement was that it should not be a hack or a kludged solution. So I thought I’d write a quick post to provide a simple example on how it was achieved.

Wed, Nov 9, 2011

The Zend Framework Bootstrap made simple (Part 3)

Ok, we’ve established that with the Zend Framework, we need to do a bit more work than some of the other frameworks to get up to speed - but that’s not necessarily a bad thing - right?! But it can be a bit tedious and it’s something as professional developers, we want to automate away. So we’ve been addressing in this series how to do just that with a custom, extendable bootstrap class.

In the first part of the series we laid the foundation of our custom bootstrap class by creating a custom class directory structure, adding its namespace to the application ini and modifying the default application bootstrap so that it extends from it and had a look at the first component - caching.

Then, in the second part of the series, we built on the foundation laid in part one by creating plugin resources for the routing table, application navigation and the database connections - these being some of the most common tasks, usually, associated with a web-based application.

In this, the third and final part of the series, I’m going to finish up by looking at application placeholders and surprise, no not logging as originally promised, but pagination. As an added extra, we’re going to be using a key feature of Zend Application to make it a breeze.

Want more tutorials like this?

If so, enter your email address in the field below and click subscribe.

You can unsubscribe at any time by clicking the link in the footer of the emails you'll receive. Here's my privacy policy, if you'd like to know more. I use Mailchimp to send emails. You can learn more about their privacy practices here.

Join the discussion

comments powered by Disqus