akbkhome

Smoking toooooo much PHP



Ouch!
Quite a beatup; but probably well deserved.

I don't suppose you want to do the same to PEAR itself, do you?

That way we can file design bugs and fix 'em where needed.

We just had a Bug Triage Day, and we're looking for firm directions for the next one, I think.


#1 - Daniel O'Connor ( Link) on 26 Mar 2008, 10:19 Delete Comment
Hmm...
I'm in agreement with most of what you said. Lost classes always annoy me: I shouldn't have to break out grep to find a class declaration.

As for "Making simple things complex", these sorts of wrappers do help out when they end up needing to modify the behavior of cookies or sessions slightly; having everything centralized is very nice. It might be over-engineering, but it can be useful.

"Anyone got a good project to nail next?" Those are fighting words, Alan! I'm tempted to volunteer my own, HTML Purifier, but it's not a CMS. :-) (Still, if you could take a look, I'd be much obliged!)
#2 - Edward Z. Yang ( Link) on 26 Mar 2008, 11:41 Delete Comment
Me-ouchhhh ;)
Hey what do you expect when you're trying to COPY Rails.

My personal opinion is that ORM sucks. SQL is a standard, so why not use it. Why rely on generated SQL that may not be optimized.

Cake does minimize development but you spend so many wasted cycles digging thru the code because the "docs" are truly lacking. But to be fair a lot of PEAR stuff also lacks docs.

Version 1.2 has taken so long to release - no idea how long it's been in development. Each framework has it's disadvantages.

Anyway, I suggest that you take the nail to Symfony and then Zend ;)
#3 - Manny ( Link) on 26 Mar 2008, 13:50 Delete Comment
Part of the learning curve
Having developed a number of CMS solutions in the past I definitely see a few holes in CakePHP that I (and probably everyone here) have fallen into, however I think this is all part of a steep (sometimes slippery and oft repetitive) learning curve.

I think your article is well warranted and although not a developer on the project, some constructive criticism would have been helpful for the actual developers.

So before nailing the next project, any suggestions for what direction this one should take?
#4 - Harry Birrell ( Link) on 26 Mar 2008, 15:21 Delete Comment
MidCOM 3?
Hi, Alan!

I'd actually be delighted if you took the time to pick apart MidCOM 3, especially since we're still in such an early stage where things can be fixed. We're trying hard now to fix the main problems in earlier MidCOM versions...

http://repo.or.cz/w/midcom.git
http://bergie.iki.fi/blog/midcom_3_at_a_glance.html
#5 - Henri Bergius ( Link) on 26 Mar 2008, 15:21 Delete Comment
CSS leaking into feed
For some reason some of your CSS is leaking into the feed, which is quite bad...
#6 - Anders ( Link) on 26 Mar 2008, 16:02 Delete Comment
ORM
@Manny: ORM not suck, is very useful and comfortable
#7 - sf ( Link) on 26 Mar 2008, 16:03 Delete Comment
take aim...
This NIH syndrome ("Not Invented Here") seems contagious - from what I can tell, it's infected the CodeIgniter project as well.

I shudder to think of the number of projects that have reimplemented code, such as validation classes, rather than using established ones and feeding any bug fixes upstream.

With this in mind, I'll echo Daniel's invitation that you take a look at PEAR next.


#8 - Ken Guest ( Link) on 26 Mar 2008, 18:01 Delete Comment
Fully agree with you
I could not agree more, and especially the comment on the "Not Invented Here"-syndrome, it's widespread in the php community is just disastrous.

How about taking a look at Symfony, Zend Framework or Code Igniter (the three "large" other then Cake) ? Any of them would make a fitting case to compare against Cake.
#9 - Fredrik Holmström ( Link) on 26 Mar 2008, 19:09 Delete Comment
Dig around in symfony
Dig around in symfony. That would be my pick.

I am so guilty of NIH that I shouldn't be allowed to comment, but honestly its hard to avoid, a lot of pieces of things that should be reusable lack conceptual integrity with the rest of a project and just beg to be rewritten, even if they strictly don't require it.

Doug
#10 - Doug ( Link) on 26 Mar 2008, 20:24 Delete Comment
Me?
> Yes, although Richard quoted me

Me? I don't remember that. But then, I don't remember a lot these days...
#11 - Richard Heyes ( Link) on 26 Mar 2008, 21:05 Delete Comment
C'mon... seriously?
Are you really that stupid, or are you just pretending to be that stupid for the folks at Nielsen?

(1) "My base class is better than yours .... the Object class" - right, because typecasting is relegated to only those elite who've been bred from C hackers. Get real.

(2) "Making Objects out of the built-in features - The 'Array, String' classes" - Right, because native PHP functions will generate UUIDs and let you extract data from arrays using XPath. For God's sake, pay attention next time. You'll make yourself look like slightly less of an ass.

(3) "Lost Classes..." - For the love of all things non-retarded, it's not a user-land class you moron. Show me one code example anywhere that demonstrates directly accessing the ScaffoldView class. I defy you.

Honestly, do I need to go on?

I'm all for constructive criticism, but try to give me something *not useless*.
#12 - nate ( Link) on 26 Mar 2008, 23:31 Delete Comment
ORM 2
@sf,

IMHO, you write more code then there is SQL.

Also, we use a ton of stored procedures! I've never understood how stored proc's fit into ORM theory. Willing to learn though!

Maybe I'm a little jaded because we don't have to support a whack of databases.

#13 - Manny ( Link) on 27 Mar 2008, 02:20 Delete Comment
ORM 3
@Manny: even if more code it's no matter

stored procedures have nothing with ORM so I do not understand your problem too ;)

ORM is cool beacuse your code is more comfortable, not faster, not smaller, using php not sql

1.5 years ago my code was clear sql ;) now is only DAO / ORM

sorry for my english
#14 - sf ( Link) on 27 Mar 2008, 16:14 Delete Comment
View escaping
I completely agree on one highlighted point - defaulting to raw output in a PHP-only template is quite possibly the stupidest thing imaginable - it suddenly adds a completely unnecessary responsibility to the template writer which could easily have been removed using some light filtering on incoming data in the first place. Sure your objects in views might now be harder - but the security risk is a hell of a lot lower.
#15 - Pádraic Brady ( Link) on 27 Mar 2008, 17:01 Delete Comment
Take a peek at Drupal 6.x
Drupal 6.1 might have too large a scope, but I would be interested, as a Drupal user, to see critiques of Drupal as a framework.
#16 - Samir M. Nassar ( Link) on 28 Mar 2008, 07:06 Delete Comment
conference ideas
Very refreshing read Alan, please keep this series up. Judging by the audience participation and heckling experienced during the Framework Shootout talk at the recent PHP London conference I think this (the sober evaluation of "leading" PHP frameworks) would make a great basis for a future conference topic.
#17 - Demian Turner ( Link) on 28 Mar 2008, 17:24 Delete Comment
Well...
I'm a long-time Cake user, and although I can't speak for the dev team, I think the re-implementation of things that have already been done in PEAR, etc is for a good reason.

That reason being the vast disparity between various PEAR libraries. Yes, you have coding standards, but the fact that there's so many different authors working on code means that there's more than one way to skin a cat. By having all the code developed by a small team, you ensure consistency. And that is the main advantage.

Secondary to this advantage is that of licensing. Cake uses the MIT license which I believe is a far better choice than GPL, or even LGPL - purely because it's so much less toxic (watch out, I'm about to get flamed).

I think the core problem here is that you disagree with the very concept of a framework. In my case, and that of many others, Cake has drastically sped up the process of developing websites.
#18 - Stephen Orr ( Link) on 29 Mar 2008, 00:48 Delete Comment
Good Project to nail next?
There's always the "talk less, code more" response to a non-constructive criticism like the one exposed here... If you want a Good Project to "nail" on PHP, you're just wasting your time... Try reading Perl's DBIx::Class and/or Catalyst, and compare them with your own PHP code and documentation (surely there's not much of it)... But hey, you can always shoot your own foot and use whatever you want.

P.D. The checkboxes on the comment submission form are just hilarious... (This is not working yet)... 'Nuff said!
#19 - Johnny Walls ( Link) on 29 Mar 2008, 01:30 Delete Comment
Something is seriously going wrong here
Yo folks, yo Alan.

I must admit this is one of the worst articles I have ever seen written on PHP yet. Yes I am from the Cake camp. No, my opinion is not biased because of that. Let me explain.

"Great way to confuse programmers who do not know PHP inside out..."

--> Do you think you are supposed to do anything like "$something = new Object()" in CakePHP? No it is used for internal logging, error related stuff, attaches a "toString()" method (which outsputs the class name) to all cake objects, and is used for caching objects (by writing them serialized to a file).

It is not at all intended to be used by programmer peeps, so wtf are you talking about?



"Making Objects out of the built-in features - The 'Array, String' classes"

Yes I agree one should not compromise the language's features. However, ever heard of separation from interface and implementation?

Also, what does this paragraph of your article have to do with Cake?

"If you really want a good laugh have a look at cake/conf/unicode/casefolding ... looks like someone missed mbstrtolower().." Constructive criticism anyone?

"ScaffoldView is a class hidden inside the scaffold class (it is in a file and directory that has no direct, simple relationship to the name of the class)"

Judging from the depth of your knowledge I assume you haven't looked much into the code and just got this from the API pages. Yes I agree it should probably not be there, because it isn't intended to be used by peeps. However if you actually looked at the api pages you would have seen http://api.cakephp.org/1.2/class_scaffold_view.html. See the line + file info there?



"Making simple things complex ... Session, Cookie classes"

Wtf? What about checking of a key in the session exists, in order to prevent notices from popping up? Do you always want to do an isset() in front of $_SESSION['someKey'], or rather use $this->Session->read('someKey'), which return false if it is not set? Also with an API you can extend it if needed with your own functionality. How do you do that with your $_SESSION and $_COOKIE approach? Wrapping it all into functions and then ending up with an army of functions so that your code seems more procedural than anything else? How about most of the commenters here can agree with such stupidity?


"Who's been reading the Patterns book to much... Model?"
"..While not a complete relationship, the benefit's of working this way significantly outweigh the downsides of creating abstract model objects for your project along side having a database mechanism."

Did you even bother to look at Cake's Model class with all the relationships?

"And I will not dig too deep into the fact that Cake's layer here is just yet another 'not invented here' redo...."
Whut? Why redo it if someone else found a very good solution? Use it, extend it and the broadcast it as OPEN-SOURCE.. You are kidding us.


"PHP's good at some things, It sucks as a template engine (or install your virus here free)"

You don't even mention Cake here..


Conclusion: The comments on this article just make me sad. You guys should open your eyes and really read what Allan is writing.

@Alan: If this article was intended to be controversial to drive traffic to your site: Great job, well done. If not, you should stop writing anything now.
#20 - DarkAngelBGE ( Link) on 29 Mar 2008, 20:44 Delete Comment
Prado? Joomla?
What are your thoughts on Prado or Joomla's "framework"?
#21 - Anthon ( Link) on 30 Mar 2008, 09:44 Delete Comment
Why?
@Anthon: why do you care to know the opinion of someone who's ignorance (and bias, for that matter) is so painfully obvious?
#22 - nate ( Link) on 30 Mar 2008, 11:39 Delete Comment
Not Quite on the Mark
I dunno, after reading some of your other posts and this, I must say you love to pick on a few things and act as if they mean the whole project is pointless.

I like the idea of your posts, in that you are being critical of existing PHP projects, I just think you need to be a little more thorough in your investigation and a little less quick to write off different approaches.

DarkAngelBGE did a pretty good job of refuting most of your points and making it fairly obvious you haven't really used Cake for anything. It seems more like you glanced over the code and site before writing this post. It is possible I am completely wrong on this account, but that is sure how it seems.

I guess your post also explains why there are so many different PHP frameworks/libraries. With such a diverse group of people using PHP (from noobs to experienced software engineers) using PHP for so many different tasks (from contact forms to web apps and intranets), there are bound to be lots of different approaches and things to focus on.

After seeing lots of discussions like this on the web (for lots of different software topics), I've been sure to spend some time writing rationale and motivations behind adding my own PHP library to the fray. This way hopefully no one will ever come to the site and say, "why the heck did someone make _another_ PHP library with so many out there?"
#23 - Will ( Link) on 30 Mar 2008, 12:18 Delete Comment
Rok on, yo. Is that the School Bell?
Alan, are you taking everyone back to school?

whoa! yours is definitely the most entertaining, and educational site i've discovered lately.

i find it amusing (no, that's the wrong word... sad? alarming? hmm...) that so much of the feedback here is on the offensive. that so many are not humble enough to learn from your illustrations.

(re: Neilson comment -- What is the point of /that/ reference? i mean-- if you're comparing dude to Neilson, then-- WTF? its like you know what's going on, then turn around and ask, "what's going on?")

I'm glad i'll have something, perhaps, interesting to read this week.

Cheers. suds
:-)
#24 - IsleOfBigNipz ( Link) on 30 Mar 2008, 17:39 Delete Comment
Nielsen
@IsleOfBigNipz: I guess my references are a little too esoteric for you. Let me spell it out. Firstly, if you go back and look at my original comment, you'll see I referenced "the boys at Nielsen" as the reasoning for writing this post.

As http://en.wikipedia.org/wiki/Nielsen_Ratings tells us, Nielsen Media Research is responsible for the measurements of television viewership, aka "ratings".

Put another way, one could say that Alan wrote a controversial post for the "ratings," i.e., the traffic. When it comes to writing diatribe of this nature, only two motivations come to mind: either you want to attract attention by starting a fight (or trying to), or you have an axe to grind.

In Alan's case, I think both probably apply. This post has clearly generated some traffic, and as the principle author of DB_DataObject, he has a vested interest in promoting his solution, even though DBDO couldn't stand up to Cake's ORM if it were duct taped to a tree.
#25 - nate ( Link) on 31 Mar 2008, 11:09 Delete Comment


Name
Email
Homepage
Comment Title
Comment
 
Contact me at alan@akbkhome.com