Advice for a guy who is finally FED UP w/ the Zend Framework

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Advice for a guy who is finally FED UP w/ the Zend Framework

Post by Luke »

I have been trying to use the Zend Framework for our projects for quite some time now... and I have finally come to the conclusion that it is basically useless. It has some decent components, but the framework as a whole feels like it has no direction. I cannot find any decent examples of "good use of the Zend Framework". There is no decent way to validate input, and no decent way to render a form. There is no decent way to easily create links to other controllers / actions that can tell if the user should have access to them. There are basically no view helpers that are helpful whatsoever, in face their view layer is pretty lame overall. The db abstraction layer is terrible and counter-intuitive. The guys writing it seem to have no interest in doing things the way their users want it done. I'm done with it. I'm moving on to a framework that actually helps me write applications faster... instead of simply hindering me. In case you haven't noticed... I am now of the opinion that the Zend Framework is a complete waste of time.

I've heard good things about:

CodeIgnitor
CakePHP
Symfony
Prado
Akelos

The reason I liked the Zend Framework is that it didn't force me to use any certain component. I could replace a component easily with something home-baked or third-party if I liked. I also liked it because it was very extensible (although maybe not easily extensible due to retarded design decisions on their part). If I were to switch frameworks now, I'd need to be able to easily port my work over to the new framework. With all of that in mind, which of this should I look into? Any that I missed? What do you guys think? Feel free to discuss the lame-ness of the Zend Framework also.

EDIT: After looking at all of those frameworks, I've come to find that the Zend Framework is exactly the kind of framework I'm looking for. If it were written well, with clear direction, I would love it. Unfortunately, it isn't. I really wish I could find the freedom that I've found in the Zend Framework, but not so lame.
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

Here's the thing. Zend is a "glue" framework.

You're right it doesn't require you to use it a certain specific way like Cake. But that means eventually you'll end up writing your own "Cake" like wrapping for it. You have to write the base structure before you can write your application. So if you were to write the "base" and I were to right the "base" chances are our code would probably end up being nearly the same. So what's the point in using ZF?

If structure and speed are what you need you're probably be better off with a more rigid framework like Cake, Code Ingnitor, Solar .. etc.

I'm working on a project to create my own "base." Once that's built then the multitude of functionalilty in ZF will mean something.
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post by jmut »

I don't really agree with db abstraction layer..I find it pretty intuitive....perhaps you are used to some other approach.
Key points I like about ZF is:
- zend - being something to do with zend have some more potentional I think
- php5 - I think other major frameworks have migrated too....but I don't think code is that obvious and modular...
- unit tests - they are very important requirement

I think ZF is still young..they had they stable couple of months ago... I would rather it stays like this as core...and some extensions pop up in time to provide this specific handy functionality like other frameworks do.

Maybe don't have such extensive experience in using frameworks like you do...but thats how I feel about situation now.
wei
Forum Contributor
Posts: 140
Joined: Wed Jul 12, 2006 12:18 am

Post by wei »

It also depends on what sort of application you wish to build. If you want to build complex forms go for Prado, you will love and loath the viewstate and the page life cycle :).

The following are some screencast of how some of the things work in Prado.
http://www.pradosoft.com/docs/movies/bl ... ml?movie=0
The contents of the screencast follows the detailed blog tutorial
http://www.pradosoft.com/demos/blog-tutorial/

The easist way to get started is to play with the VMWare image
http://sourceforge.net/project/showfile ... _id=118087

The approach taken in Prado is different to other web frameworks in PHP, it is more similar to ASP.NET/Tapstery/Java Server Faces in that it builds upon the idea of components (e.g. composible GUI).

Cheers,Wei.
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

After looking at all of those frameworks, I've come to find that the Zend Framework is exactly the kind of framework I'm looking for. If it were written well, with clear direction, I would love it. Unfortunately, it isn't. I really wish I could find the freedom that I've found in the Zend Framework, but not so lame.
You see the dilemma then? ;)

You want a glue framework - but the only good one in PHP has technical flaws left, right and center. I'm sure a couple of us will commonly be found blasting large bits of the framework :). The main problem really, is getting the ZF setup. What I would suggest is that you get rid of the main cost of developing with a glue framework - the setup. If you can write a very lean setup you can buy a lot of reuse from ACL, standard controller parents and layout, etc. The second thing is to consider dumping immature/second rate elements.

I absolutely hate the Zend_Db component with a vengeance - it's overly complex, unintuitive, and a pile of steaming parts which belongs in the stone age. I'd invest a little time into a simple ORM/DataAccess layer which sits on top of PDO and be done with it - iteratively add features only if needed. Filtering/Validation is a lost cause - the DevnetStore had a pretty lean API suggested which would re-use the component filters/validators but separate from the array focused API at present. The View Layer is quietly getting a boost in the Incubator but I've pretty much retreated from it personally - it was basically me proposing (a very practical proposal IMHO) and everyone else and their dog implementing it a dozen ways until I finally little real involvement. The ZF proposal system is literally Anti-Agile/XP - so the "best practices" marketing talk is a very big bluff. Any mention of tools, scripts or console helpers is shot down as a result.

So my thoughts are that it's relatively good glue framework, but with big flaws ;). The great thing is you are not bound to any one component outside the V and C - replace as needed. I use Swiftmailer, Propel or a really tiny Data Access layer for PDO, my own filter/validator setup, and of course a souped up View layer.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

I can't remember the phrase, something like a Harvested Framework (?) i.e. just carry on working and collect components along the way, reusing them where necessary.
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

I tend to agree that the Zend Framework has flaws, but I think that with anything you use, you will find some things "wrong" as every programmer has their own method of doing things. You would probably find yourself with any of your suggested "replacements" hacking them a bit to get them to work the way you like them. Layout to me is one of the main things the ZF is lacking but then the parts I am looking at are only a small part of the whole. Another fundamental thing missing is a meaningful tutorial.

I sometimes wonder if it wouldn't be an idea to have a meaningful developed application using many of the ZF pieces maintained by the developers to show where things just don't work (have to be developers different from the people who designed each component :wink: ). This application could then be used as the baseline for any tutorials.

I seem to remember lots of discussion on this forum about trying to develop a pet shop application but I don't think it got very far, I would guess, partly for the reasons already mentioned. (apologies to anyone if I do you an injustice when I say that).
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

What I would suggest is that you get rid of the main cost of developing with a glue framework - the setup. If you can write a very lean setup you can buy a lot of reuse from ACL, standard controller parents and layout, etc. The second thing is to consider dumping immature/second rate elements.
I actually started writing this. It's just hard to find time to write it at work when I'm being asked about my progress with this project and that project and all I've got to show him is a "framework" I built out of a "framework". That's hard to explain to a boss. :(
I can't remember the phrase, something like a Harvested Framework (?) i.e. just carry on working and collect components along the way, reusing them where necessary.
yea I think every body does this... I've got me some Swiftmailer, some sha256, some HtmlPurifier, a few things I've built here and there...
I seem to remember lots of discussion on this forum about trying to develop a pet shop application but I don't think it got very far, I would guess, partly for the reasons already mentioned. (apologies to anyone if I do you an injustice when I say that).
I completely agree that there should be something like that, and you're right, arborint, Maugrim, and several other people were working on something like that.

viewtopic.php?t=66007
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

Zend_Db is seriously lame. It's almost like these guys have never written a web app before. Zend_Filter_Input - completely useless... totally unusable. Zend_Db - counterintuitive and way over complicated, the module / controller set up... completely overcomplicated, the validation and filtering - way too tedious... this framework seems to be built by people with no interest in speeding up the development process... what the hell?? Isn't that what a framework is for?? :?
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

er, Rails?

*ducks to avoid flying pie*

Seriously though, learning Rails will only serve to make you a better programmer. It's chock-full of good practices.

Also, Ruby is simply hawt.
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Nay, Django ;)

I think the point is don't use Zend_Db - there are alternatives to messing around with it. A simple ActiveRecord implementation can give you a lot of mileage even. As I remember there are two alternatives to Zend_Filter_Input. Ed Finkler and Bryce Lohr both wrote working code. Bryce was actually proposing to the framework but I think it was essentially decided to use the current version to make the release deadline. I made my own arguments over and over but it was basically like attacking a brick wall - useless.

Maybe see if CakePHP or Symfony work better for you? If nothing else might provide some inspiration about how to bend the ZF to your will.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

To me, exceptions seems like the PERFECT thing to use for 404 when you can't find an id or something... what do you guys think?

Code: Select all

public function viewAction()
{
    if (!$id = $this->getRequest()->getParam('id'))
    {
        // takes you to a 404 page
        throw new Http_404_Exception();
    }
}
wrong use of exceptions?
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Perfectly valid use of exceptions. They are for use in exceptional circumstances for breaking out of the current process. A Bit like a student raising his or her hand in a class when they find a problem, rather than waiting until the teacher asks them if all is ok.

Finding that a document does not exist is an exceptional circumstance, so break out of the process. :)
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

seems like something that should be in the framework. I think django does this.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

I guess that makes sense if you send back 404 errors. But that raises the question of whether a framework should return a 404 error if it finds an error. They are pretty unhelpful for uses. Certainly a programmer implementing a Front Controller can be smarter than that about giving the user useful information and getting them into the site. I never return 404s.
(#10850)
Post Reply