Page 2 of 2

Re: How to choose framework for PHP

Posted: Thu Dec 30, 2010 11:47 am
by alex.barylski
Just took a quick peak at Lithium, I have to ask Christopher, what made you feel it's "modern"? I seen a lot of static method invocation and namespaces. I think the Zend/PEAR style of naming classes to map to directories essnetially solves the namespace issue head on (you can never have duplicate class names if you follow convention - as you cannot have two of the same file in the same directory). And statics, well, we all have our opinions on statics but abundant use of them is usually an indicator of inexperience in true OO development - if being dynamic is truly a side effect of proper OOD?!?

As for verbose class names when following the Zend/Pear convention, I don't buy it, occassionally they can be a bit of burden, in which case configure your service locator/registry to use aliases, or extend the long winded class in question with a shortened alias name if its that important to you - you as in anyone reading this and wishing to bite down on the verbose class name argument... :)

Cheers,
Alex

Re: How to choose framework for PHP

Posted: Thu Dec 30, 2010 1:38 pm
by Christopher
PCSpectra wrote:Just took a quick peak at Lithium, I have to ask Christopher, what made you feel it's "modern"?
I think this is the way things are going ... and not just in PHP ... whether you and I like it or not. ;)

Re: How to choose framework for PHP

Posted: Thu Dec 30, 2010 2:20 pm
by alex.barylski
I think this is the way things are going ... and not just in PHP ... whether you and I like it or not.
In what regard, the use of static methods? :D

Namespacing is something I am not terribly familiar/comfortable with, so perhaps it's time I change my perspective, I see them as solving two problems for the price of one, which is ideal.

In what other ways do you find Lithium to be leading the charge?

Cheers,
Alex

Re: How to choose framework for PHP

Posted: Thu Dec 30, 2010 2:53 pm
by Christopher
PCSpectra wrote:In what regard, the use of static methods? :D
Well yes that ... I think what we might think of as procedural style programming ends up being really handy for a lot of things (who knew! ;)). But modern languages are all OO so there are these ways to do procedural but take use of all the loading and packaging support for classes. PHP is doing a double U-turn in this regard.
PCSpectra wrote:Namespacing is something I am not terribly familiar/comfortable with, so perhaps it's time I change my perspective, I see them as solving two problems for the price of one, which is ideal.
I see them as solving one problem for the price of two, but they are coming and there is not much that can be done about it I think. The hipsters love them for some reason. I have ask several times whether people actually like working with this new 5.3 style PHP code but have not got an answer yet.
PCSpectra wrote:In what other ways do you find Lithium to be leading the charge?
Certainly the use of closures. And stemming from that its concept of filters is an interesting solution to extensibility.

Re: How to choose framework for PHP

Posted: Thu Dec 30, 2010 3:09 pm
by alex.barylski
Well yes that ... I think what we might think of as procedural style programming ends up being really handy for a lot of things (who knew! ). But modern languages are all OO so there are these ways to do procedural but take use of all the loading and packaging support for classes. PHP is doing a double U-turn in this regard.
Not sure I would agree 100%, although there certainly seems to be a trend in PHP to use statics as well as singletons. I think that is a result of more and more intermediate developers jumping on the PHP bandwagon.

Statics are interesting and I understand their appeal. In a single line, you gain access to an object *anywhere* in an application (Model-View-Controller-Templates-Scripts-Wherever). I also understand their dislike by others, especially those heavily involved in BDD. I prefer a mockist style of testing and therefore (more and more) I tend to lean towards dynamic programming techniques and thus move away from statics. I still have one singleton, the front controller, but that is it.

Long class names certainly make the use of statics far less appealing, so that is probably partially responsible for the push towards namespaces and possibly statics, IMO.
I see them as solving one problem for the price of two, but they are coming and there is not much that can be done about it I think. The hipsters love them for some reason. I have ask several times whether people actually like working with this new 5.3 style PHP code but have not got an answer yet.
I have nothing against namespaces, per se, I guess I just don't see the benefit out-weighing the biggest negative and that is hosts not supporting PHP 5.3 yet. If namespaces can be used similar to long class name prefixes and map to directory names, the switch for me is moot.
Certainly the use of closures. And stemming from that its concept of filters is an interesting solution to extensibility.
I often wonder if it is possible to utilize closures in PHP like jQuery did for javascript, a brilliantly simple solution to framework design perhaps?. :) Can you offer any examples/insight in how closures are intelligently used in Lithium?

Cheers,
Alex

Re: How to choose framework for PHP

Posted: Thu Dec 30, 2010 5:20 pm
by Christopher
PCSpectra wrote:Not sure I would agree 100%, although there certainly seems to be a trend in PHP to use statics as well as singletons. I think that is a result of more and more intermediate developers jumping on the PHP bandwagon.

Statics are interesting and I understand their appeal. In a single line, you gain access to an object *anywhere* in an application (Model-View-Controller-Templates-Scripts-Wherever). I also understand their dislike by others, especially those heavily involved in BDD. I prefer a mockist style of testing and therefore (more and more) I tend to lean towards dynamic programming techniques and thus move away from statics. I still have one singleton, the front controller, but that is it.

Long class names certainly make the use of statics far less appealing, so that is probably partially responsible for the push towards namespaces and possibly statics, IMO.
I think I am not talking so much about statics and Singletons -- which is looking at it from the implementation side. I think there has been a sense over the last decade that many of the "objects" that you need in a program don't need to maintain much if any state in the way an object can and does. Whether they are helpers or filters, they are just things that you put values in one end and something comes out the other (your FC may be an example of this ;)). That's why neo-procedural constructs like anonymous functions (closures) have crept into most languages. They want a function to be an object (anonymous functions are object in PHP too). Then functions have the "pass around" qualities of objects, but without the verbosity. Good for all those one-method classes (e.g. helpers, filters, etc.).
PCSpectra wrote:I have nothing against namespaces, per se, I guess I just don't see the benefit out-weighing the biggest negative and that is hosts not supporting PHP 5.3 yet. If namespaces can be used similar to long class name prefixes and map to directory names, the switch for me is moot.
Well 5.3 will be old someday ... so it is just a matter of time. I PHP namespaces just add more code to every file with little benefit to most programmers -- except to feel like we are big boys and girls using a grown-up language.
PCSpectra wrote:I often wonder if it is possible to utilize closures in PHP like jQuery did for javascript, a brilliantly simple solution to framework design perhaps?. :) Can you offer any examples/insight in how closures are intelligently used in Lithium?
As I mentioned ... their filter system is really interesting and provides some AOP type functionality.

Re: How to choose framework for PHP

Posted: Thu Dec 30, 2010 9:31 pm
by josh
Lithium's example app shows tons of business logic in the view. I can't seem to find anything like a form library, which comes standard with every other framework.

The fact that lithium uses closures certainly does not differentiate it from Zend. Same with namespaces. With Lithium though I get the sense the author's are more concerned about showing off that they are using the new PHP features, than showing how to use their framework (Zend Framework has really extensive "reference guide" with example code in most cases).

So far the only comments I have is if you *just* want MVC, lithium is a lot sleeker than using Zend, however it seems to be even lower stack than Zend (and the #1 complaint with Zend is its "too low stack"). For example Zend takes the user's locale into account when validating dates. (d/m/y VS m/d/y). From skimming over Lithium's code it looks like it'd just tell your foreign users they wrote the date wrong, for example. Zend is higher stack. Lithium's documentation is non-existent unfortunately.

I also agree it uses a lot of static methods, which is the other #1 complaint I have heard people make about Zend (including you Christopher).

Re: How to choose framework for PHP

Posted: Thu Dec 30, 2010 9:33 pm
by alex.barylski
I think there has been a sense over the last decade that many of the "objects" that you need in a program don't need to maintain much if any state in the way an object can and does.
Ahh yes, that I agree with. My own development preferance is to use OO concepts for code organization, but objects don't usually maintain much state at all. I try and keep most objects to a single member, prefering a functional programming methodology, helps keep objects dead simple.
Whether they are helpers or filters, they are just things that you put values in one end and something comes out the other (your FC may be an example of this ). That's why neo-procedural constructs like anonymous functions (closures) have crept into most languages.
Absolutely, thats functional programming, at least my understanding.
except to feel like we are big boys and girls using a grown-up language.
Haha...thats part of I think, yup. Earlier I said namespaces address two problems for the price of one, because they prevent long winded class names; Which is not an issue for me as I would just create a local alias by extending the class. Other than that I see little practical use to namespacing.
As I mentioned ... their filter system is really interesting and provides some AOP type functionality.
I'll have to investigate closer. I have (for years) facilitated AOP in my own high-level framework (I decomposed the framework into two distinct layers) not using filters but similar ot Drupal hooks. It's a beautiful way to keep concerns organized but adds complexity in understanding the code because all components can hook into other components.

Cheers,
Alex

Re: How to choose framework for PHP

Posted: Tue Jan 04, 2011 11:18 am
by quest13
Hi

I have a plan to build a website in PHP framework and my content is related to web hosting, domain registration and web services. Can someone throw some light on selecting the suitable framework that may make my life easy ( or better !) ?

Thanks

Re: How to choose framework for PHP

Posted: Tue Jan 04, 2011 11:32 am
by jankidudel
Well, I think cake php will help you, because it isn't hard and has lots of extensions.