Re: Zend Framework...where to start? -- don't.
| From: | Phpster | Date: | Thu, 15 Jan 2009 02:36:02 +0000 |
| Subject: | Re: Zend Framework...where to start? -- don't. | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-286402@lists.php.net to get a copy of this message | ||
Core files are what my plans include too.
Bastien
Sent from my iPod
On Jan 14, 2009, at 9:26 PM, "Kyle Terry" <kyle@kyleterry.com> wrote:
On Wed, Jan 14, 2009 at 6:17 PM, Paul M Foster <paulf@quillandmouse.comwrote:On Wed, Jan 14, 2009 at 01:39:02PM -0800, Daevid Vincent wrote:I agree heavily on the file opening part. I hate having to look through a stack trace of 20 or 30 just to track down why an exception was thrown. We are working on moving our entire framework into less files and more of a core set of files that handles a lot of tasks. --Kyle Terry | www.kyleterry.comNot to start a Holy War (as these "to framework" or "not to framework" debates often turn into), but I personally had a horrible experiencewithusing frameworks. I was forced to use Symfony at my last job and itwas socumbersome and slow to do even the simplest things. The whole MVCthingcan be overkill. Plus the learning curve can be quite steep. Then ifyouwant to hire other developers to work with you, you have to train themandlet them ramp up on not only the framework but also your core projecttoo!More wasted time. The pages are significantly slower than straight PHP by orders of magnitude: [1]http://paul-m-jones.com/?p=315What a great link! I've never seen this kind of comparison before. HTML is 70% faster than straight PHP, and the frameworks (even codeigniter) deliver less than 20% of the performance of straight PHP.The basic problem with frameworks is they try to be one thing for all people. This carries a lot of baggage with it. There's a lot of crapyouend up pulling in that you don't want/need. Plus if you want todeviate atall, you either have to roll your own, or sometimes you simply justcan't.They seem attractive with all their plugins and stuff, but honestly, rarely do the plugins do EXACTLY what you want, the way you want. Itmightbe as simple as trying to change the look/feel of a button orsomethingand you'll find out that you can't -- so now you have this websitethathas this section that doesn't look like the rest of your site. And ifyoufind a bug, you have to try to either fix it yourself and then keepthosechanges migrated into new updates, or submit it to the developer andhopethey implement them (and trust me, you can submit to them and havethemrejected for all sorts of lame reasons -- even though the work hasbeendone and you're using it!) I advise against it. Just follow good practices and use thin wrappersandfunctions. Don't get all OO googlie eyed and try to over-engineer and over-OO the code. OO is great for some things (like a User class) but don't start making some OO page renderer or form builder. Don't fallintothe DB Abstraction trap either -- just use a wrapper around your DBcalls(see attached), so you can swap out that wrapper if (and you almostneverdo) you change the DB. Don't be suckered by something like QuickForms--you WILL run into limitations that you can't get around and are attheirmercy. Don't buy the hype that DIV's are the magic bullet and TABLEsare"poor design" -- Tables are still the best and most ubiquitous way to align things in a browser agnostic way (including mobile phones, etc.)andto layout forms.I agree and disagree. I agree there's waaay too much herd mentality in the programming field. (Fortunately, Linus Torvalds didn't listen to the academics who insisted that microkernels where THE WAY, or we wouldn't have Linux today.) OO is nifty for some things, but it's certainly not the "fountain of reusability" it was originally promoted to be. And I also agree about tables versus CSS. I can render a page very precisely with tables that would take me hours to get right with CSS. And I really don't give a crap about what "experts" say about anything. I find "experts" to be wrong much of the time. OTOH, I just finished writing about 80K lines of PHP/HTML, all by hand, no OO, no classes, no nothing. Each page in one file, except for a few helper functions in a couple of common files. I wouldn't want to go through that again. I've opted for a framework on rewriting this code, just to cut down on the number of lines of code I have to manually write. But I built my own framework, which doesn't call in 20 files for each page load. Very compact. Probably not suitable for every kind of project, but it works for this. Incidentally, I would differ from the reviewer in the link above only in this respect: He maintains that every line of code adds time. While this is true, I believe it's the number of files which have to be opened which drags down framework numbers the most. When I wrote C code, the CPU would blaze through the actual code, but file opens and reads consumed far more time than in-memory code execution. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php