Tag: smarty

A step back?

Like most of you know I’ve been interviewing with a few companies lately and during one of the interviews the interviewer expressed something to me that i thought I was the only one thinking. My thought, “wow i totally know what you mean…but i shouldn’t agree with you because you might think im kissing your ass to get the job”. We were talking about the Zend_Form library of the Zend framework.

The Zend_Form component allows developers to use helpers to create forms. This is much like the form helpers for Ruby on Rails. It has a selector helper, password helper and all the form types that someone might eventually use in a form. With all these positive tools what on earth might be my grip with the Zend_Form? Easy, html/xhtml shouldn’t be handled why a backend developer. With this component we basically take a step back from keeping html/designers away from the backend and backend developers away from taking on another responsibility, creating dynamic forms.

Smarty, Savant, and the basic mvc pattern was set up to facilitate the need to keep such separations intact. HTML coders wouldn’t want to deal with PHP code, so nice looking template libraries such as Smarty and Savant were created to hide these tags from HTML. Now with the introduction of Zend_Form, this idea goes out the window. I’m not implying that Zend_Form isnt a good thing, but is it a necessary component? As developers, we have already crossed this delimma in the architect web road. The outcome? We realized that separation is best.

Could the Zend_Form library have been created to compete with Ruby on Rails?

Armando Padilla

Poormans PHP Architecture

This is a proof of concept. Im using APC, memcached, and Smarty.

Smarty
I’ll be leveraging the Smarty front end caching engine for the fictitious application. The smarty engine caches all compiled templates and only updates if it identifies any updates to the page.

APC
Will be used to store compiled PHP code. Since PHP has to compile down to opcode we can take away this overhead by storing opcode somewhere for the server to hit. Note: some test indicate that EAccelerator out performes APC. Might use that as a substitute instead of APC.

Memcached
Will be used to reduce the number of hits on the DB. With the data initially pulled from the DB and stored in memory we dont have the overhead of opening a connection and quering the DB.
I will test out this set up on one of my applications and see how well it does.

Armando Padilla