Page 1 of 4

Distinguish Frameworks

Posted: Mon Mar 30, 2009 6:06 am
by mudgil.gaurav
Hi All,

I want to have an discussion regarding the frameworks available in PHP. For my project i am planning to use Symfony but i have a spark of doubt , that every framework offer caching , library and plugin files. So how we can distinguish each framework in terms of development time , performance etc.

Any suggestion would be greatly appriciated.

Thanks

Re: Distinguish Frameworks

Posted: Wed Apr 01, 2009 2:17 am
by jaoudestudios
Frameworks are great once you are confident with them - i.e. almost an expert. But until then it is a difficult and painful process, as documentation is bad.

I starting learning cakephp a year ago for about 6months, I bought all the books and went through all the tutorials, but still it was hard. Decided to change to Zend, as many people recommended it. Zend has the same issues as cakephp in terms of learning. Documentation always assumes so much. Including the books too.

So in the long term it would be good to learn & use a framework, but initially it would be a very slow process with a steep learning curve.

Re: Distinguish Frameworks

Posted: Wed Apr 01, 2009 4:43 am
by josh
Not all frameworks offer plugins. Technically all I need to write to have a framework is a few lines of code that implements inversion of control... Within frameworks theres a vast taxonomy of breakdowns, are we talking frameworks with MVC components, full stack frameworks, data access frameworks, testing frameworks, dependency injection frameworks, silicone chip manufacturing frameworks ( sematech? ).

For web frameworks I generally look at separation of presentation from business logic as a must. Search engine friendly URLs are almost essential as well. 2 frameworks I hear handle this good is Zend and Rails. I'm sure symphony, code ignitor, cake PHP, etc.. all have very similar stuff.

Re: Distinguish Frameworks

Posted: Wed Apr 01, 2009 1:22 pm
by volomike
A downside of frameworks is that developers become biased to only using that framework, or only a couple frameworks, and perhaps not the one you prefer.

Every developer I know uses CI (Code Igniter) and are crazy about it. A few in this forum use something called Skeleton. I wrote my own lightweight MVC framework, my own ORM class, and my own DB abstraction class. Perhaps I might start to use CI eventually so that I can assist on a project already started in CI, or work in a team.

I don't see a lot of fans of Zend Framework, Cake, or Symfony here. But when I do, they are definitely crazy about their framework choice.

Re: Distinguish Frameworks

Posted: Wed Apr 01, 2009 2:27 pm
by josh
Skeleton was written by the people here. That is why you see people mentioning it. I don't think anyone claims any single framework is perfect. I'm personally a fan of Zend. The thing is in reality most projects use only some components of a framework, and often components from more than one framework

Re: Distinguish Frameworks

Posted: Wed Apr 01, 2009 2:45 pm
by volomike
josh wrote:The thing is in reality most projects use only some components of a framework, and often components from more than one framework
Recently I heard of people installing ZF just to get its library of goodies, not using its MVC, and then rolling their own MVC. Seems like a good idea. However, another route is to just download ZF, Skeleton, CI, Cake, and Symphony, and cherry pick (with cut and paste and alter) the best ways to do something out of that and pull into your own classes.

Re: Distinguish Frameworks

Posted: Thu Apr 02, 2009 3:28 am
by josh
I on the other hand use Zend for its MVC, some of the web services they have are great, I use its forms library as well. For data access I started with Zend_Table, started using doctrine, then eventually rolled my own ORM written ontop of zend_select. Some of the stuff in there like ascii art is useless to me.

Yes I remember you showed me your code, it was very well written but also way too lightweight for a serious app in its current stage ( IMO )... I'd recommend building out a sample app in Zend just to learn what it does. I'd recommend playing around with the router, and URL view helper. From what I remember your framework handled viewscripts and view script variables very well but didn't have a lot of scaffolding in place to handle other things I'd expect from a MVC framework
volomike wrote: (with cut and paste and alter)
If the framework is written right you won't have to cut and paste anything.

Re: Distinguish Frameworks

Posted: Thu Apr 02, 2009 11:29 am
by volomike
I'm making two versions of the framework. One is simplistic like you saw. The other is big-boned, including a PDO-based DB class, ORM class, filter class, login/registration/password reset class, etc.

Re: Distinguish Frameworks

Posted: Thu Apr 02, 2009 5:09 pm
by Benjamin
I use symfony. I seriously considered code igniter, but was turned off by the quality of its code base.

Re: Distinguish Frameworks

Posted: Sat Apr 04, 2009 1:24 am
by volomike
CI was not based on PHP5, but PHP4. [Kohana](http://kohanaphp.com/) was a PHP5 fork of it. To me, Kohana is still heavier than I'd like it to be.

Re: Distinguish Frameworks

Posted: Sat Apr 04, 2009 3:12 am
by Benjamin
Well I'm sure I'll catch flac from CI fans, but I'm sorry, 4 or 5, it's just bad code. Just to make a point I downloaded the most recent version:

http://codeigniter.com/download.php

Opened up a random file:

system/libraries/img_lib.php

Line 1:

Code: Select all

 
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
System files should be above the webroot. That solves the security problem and avoids cluttering the code with security garbage.

Line 108:

Code: Select all

 
        $props = array('source_folder', 'dest_folder', 'source_image', 'full_src_path', 'full_dst_path', 'new_image', 'image_type', 'size_str', 'quality', 'orig_width', 'orig_height', 'rotation_angle', 'x_axis', 'y_axis', 'create_fnc', 'copy_fnc', 'wm_overlay_path', 'wm_use_truetype', 'dynamic_output', 'wm_font_size', 'wm_text', 'wm_vrt_alignment', 'wm_hor_alignment', 'wm_padding', 'wm_hor_offset', 'wm_vrt_offset', 'wm_font_color', 'wm_use_drop_shadow', 'wm_shadow_color', 'wm_shadow_distance', 'wm_opacity');
 
This is just not right. These need to be registered with the class automatically, not manually added to an array.

Lines 115-116

Code: Select all

 
        // special consideration for master_dim
        $this->master_dim = 'auto';
 
Not right again, no special considerations, this should be implemented in a way that can be called on and used as required for any circumstance.

Skipping lots of stuff, down to lines 460 - 463

Code: Select all

 
                    if (@copy($this->full_src_path, $this->full_dst_path))
                    {
                        @chmod($this->full_dst_path, DIR_WRITE_MODE);
                    }
 
Using @ is not acceptable in production code. Sorry, just that alone causes me to flag CI as a NO GO.


Now it's not fair for me to say all this without taking a random file from the framework I prefer, so I will.

...

I just went through about 15 random files and couldn't find anything I would improve. Check it out yourself, download 1.2 from http://www.symfony-project.org/installation

I'm not trying to bash any framework over another, all I'm saying is that I'd really prefer that the code I write sit on top of code that is better than mine. If I'm writing better code than the framework my code is running with, that's just not right.

Re: Distinguish Frameworks

Posted: Sat Apr 04, 2009 3:51 am
by matthijs
And what do people think about EZcomponents? It does look like a solid framework, from looking at it's documentation and a brief look at the source (although better coders then me should judge that last one). I don't hear too much about it. But maybe that's just because a few other frameworks like Zend, Cake and CI get more attention

Re: Distinguish Frameworks

Posted: Sat Apr 04, 2009 6:35 am
by josh
astions wrote:I'm not trying to bash any framework over another, all I'm saying is that I'd really prefer that the code I write sit on top of code that is better than mine. If I'm writing better code than the framework my code is running with, that's just not right.
In order to be a framework the code has to sit above yours. And I would probably not judge a framework based on the fact they included a webroot security check. The lack of setters & getters scares me though

Re: Distinguish Frameworks

Posted: Sat Apr 04, 2009 6:39 am
by volomike
astions: Hahaha. Point well made. I'll have to keep this in mind.

Re: Distinguish Frameworks

Posted: Sat Apr 04, 2009 1:33 pm
by Benjamin
matthijs wrote:And what do people think about EZcomponents? It does look like a solid framework, from looking at it's documentation and a brief look at the source (although better coders then me should judge that last one). I don't hear too much about it. But maybe that's just because a few other frameworks like Zend, Cake and CI get more attention
46MB Zip 8O

Where did that come from? Never heard of it before. I downloaded it and the code doesn't look bad at all from what I see so far. I'll take a hard look at it, and I may take bits of the code and use them independently.