+1I agree. But that is not the same as code released and supported by the project itself. And many of these ZF sub-projects go unsupported after the initial few releases. Most people using ZF build their own base app specifically suited for their needs. That is actually one of ZF's key attractions.
MVC Frameworks?
Moderator: General Moderators
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: MVC Frameworks?
Re: MVC Frameworks?
I don't know what you mean by "takes" but many of those classes are stand-in for each other, they are not used at the same time but are invoked depending on context and the developer's preference (much like database adapters). It is more than completely justified, many consider it the correct approach to software design, instead of condensing all the functionality into single classes and loading those all the time.ZF is not light weight. it takes 40 classes for the contorller and another 40 for the view. this is completely unjustifiable.
First of all, I think any decent develop should concern himself with design aspects. At some point you would need to know how things work, and better to ease into it slowly while developing and not at crunch time when you can't figure out how to get something done. Second, getting a ZF application up and running is not that difficult, I mean, really, it shouldn't take a capable programmer more than a couple of hours the first time only. Unless you don't intend to ever work with that framework again and the entire project is measured in single digit hours, that is not a major consideration, in my opinion.This is true, but then again, one of the reasons behind using a framework is to make things easier by virtue of not having to concern yourself with design aspects, focusing strictly on getting things done.
Re: MVC Frameworks?
Code maintainability... It's not about the # of classes, or even the # of classes involved in a single request, its about having the seams you need to get your job done. Zend is even more bloated then CI then people think if they count test code too, does that make it bad also? 
Re: MVC Frameworks?
Why do framework threads always turn into battles? The truth of the matter is that different frameworks all have their strengths and weaknesses and each of these come to bear only in the light of a particular project. To say that ZF of CI (or any other) is the best framework is a rather narrow-minded approach. It all comes back to what you are trying to do - if I'm trying to build the pyramids then I wouldn't hesitate to deploy a ZF solution - I'm not the biggest fan of ZF but when it comes to large, enterprise level demands where I'll have virtually unlimited resources at my disposal its one of the best tools for the job. That said, when my church asks me to design them a web site that's easy for anybody to edit I don't deploy ZF or CI - I download Joomla! and handroll whatever extra components I'll need that I can't download for free. If they don't need to be able to edit the pages often and/or don't need insane flexibility ala Joomla! then I have a shake'n bake MVC that's super-lightweight (< 50 lines of code), will scream like Usain Bolt down an Olympic track, and lets me prototype a fully-designed site in under an hour.
Re: MVC Frameworks?
ZF should not be used for anything.
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: MVC Frameworks?
LOL...you are persistent, if anything, I will give you credit for that.ZF should not be used for anything
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: MVC Frameworks?
I would have used a less fruitful word.PCSpectra wrote:LOL...you are persistent, if anything, I will give you credit for that.ZF should not be used for anything
@blueyon: you do realize ZF was not written by the Zend developers, it was an opensource community project.
Re: MVC Frameworks?
Dude I read your thread on sitepoint its full of nonsense. You seem to be just full of spite. If you can code a cache package in 5 minutes better then ZF, then do it. And I don't mean untestable code coupled to the file system like http://www.sitepoint.com/forums/showpos ... stcount=36blueyon wrote:ZF should not be used for anything.
I also agree with Mr. Spectra on this post: http://www.sitepoint.com/forums/showpos ... stcount=77
If you want an untestable coupled class, you are entitled, but that doesn't mean you know what's best for others.
For example you missed:
- tagging cached objects
- different cache backends - maybe I don't want to "solve" a load problem by writing to my disk queue, maybe I want to use memcache
- How do I set an expiry time on your class?
- etc... you are just stultifying the problem and arguing from fallacy
Everyone who posted in your SP thread said you don't know what you're talking about. You really need to take this post to heart.
And I see about 5 files for the controller, not 40. I have an Action.php, an Exception.php, and an Interface.php. Plus 2 more if you count the helper broker and helper interface.
Show me a single file that has no use case. And if you want you can disable the helper architecture, but why would you?
Re: MVC Frameworks?
I'm going to go out on a limb here and guess that this is a grossly misinformed opinion.ZF should not be used for anything
Re: MVC Frameworks?
Here's an example of where Zend was not "bloated enough" for my needs:
the isArray flag on elements is used in several places, including validation, to determine the cardinality of the value. I was extending the Zend_Form_Element class. In my custom element I passed data in arrays, so I set isArray to true so that it renders the element with "[]" suffixed to it, so the multiple html elements get posted.
However, the isArray flag, as you can see here is in this validate method, triggers a separate branch of the conditional. I had to override the whole method just do delete that block ( which duplicated the surrounding code).
Had they have added more "bloat" in the form of more switches and flags and conditionals, it would have actually saved me about ~30 lines of un-needed copying (that will have to be merged whenever they update that method now, until they add more "bloat" allowing me flexibility)
All those getAllowEmpty, autoInsertNotEmptyValidator, getAllowEmpty, zfBreakChainOnFailure calls/flags/switches aren't bloat, theyre the override points Zend is literally bursting at the seams with. No pun intended.
Code: Select all
/**
* Validate element value
*
* If a translation adapter is registered, any error messages will be
* translated according to the current locale, using the given error code;
* if no matching translation is found, the original message will be
* utilized.
*
* Note: The *filtered* value is validated.
*
* @param mixed $value
* @param mixed $context
* @return boolean
*/
public function isValid($value, $context = null)
{
$this->setValue($value);
$value = $this->getValue();
if ((('' === $value) || (null === $value))
&& !$this->isRequired()
&& $this->getAllowEmpty()
) {
return true;
}
if ($this->isRequired()
&& $this->autoInsertNotEmptyValidator()
&& !$this->getValidator('NotEmpty'))
{
$validators = $this->getValidators();
$notEmpty = array('validator' => 'NotEmpty', 'breakChainOnFailure' => true);
array_unshift($validators, $notEmpty);
$this->setValidators($validators);
}
$this->_messages = array();
$this->_errors = array();
$result = true;
$translator = $this->getTranslator();
$isArray = $this->isArray();
foreach ($this->getValidators() as $key => $validator) {
if (method_exists($validator, 'setTranslator')) {
$validator->setTranslator($translator);
}
if ($isArray && is_array($value)) {
$messages = array();
$errors = array();
foreach ($value as $val) {
if (!$validator->isValid($val, $context)) {
$result = false;
if ($this->_hasErrorMessages()) {
$messages = $this->_getErrorMessages();
$errors = $messages;
} else {
$messages = array_merge($messages, $validator->getMessages());
$errors = array_merge($errors, $validator->getErrors());
}
}
}
if ($result) {
continue;
}
} elseif ($validator->isValid($value, $context)) {
continue;
} else {
$result = false;
if ($this->_hasErrorMessages()) {
$messages = $this->_getErrorMessages();
$errors = $messages;
} else {
$messages = $validator->getMessages();
$errors = array_keys($messages);
}
}
$result = false;
$this->_messages = array_merge($this->_messages, $messages);
$this->_errors = array_merge($this->_errors, $errors);
if ($validator->zfBreakChainOnFailure) {
break;
}
}
// If element manually flagged as invalid, return false
if ($this->_isErrorForced) {
return false;
}
return $result;
}
However, the isArray flag, as you can see here is in this validate method, triggers a separate branch of the conditional. I had to override the whole method just do delete that block ( which duplicated the surrounding code).
Had they have added more "bloat" in the form of more switches and flags and conditionals, it would have actually saved me about ~30 lines of un-needed copying (that will have to be merged whenever they update that method now, until they add more "bloat" allowing me flexibility)
All those getAllowEmpty, autoInsertNotEmptyValidator, getAllowEmpty, zfBreakChainOnFailure calls/flags/switches aren't bloat, theyre the override points Zend is literally bursting at the seams with. No pun intended.
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: MVC Frameworks?
Bang...WOTD peoplestultifying
I can honestly say I have *never* heard anyone use that word, ever, not that I remember anyway.
At first read, it sounded like 'slutifying' only after my second pass did I realize it was an actual word and dictionary.com'ed that bad boy
Cheers,
Alex
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: MVC Frameworks?
Though I think Josh used it backward. blueyon did not stultify the problem; josh was attempting to stultify blueyon's argument.PCSpectra wrote:Bang...WOTD people
(#10850)
Re: MVC Frameworks?
I meant to write stupifying, typo... i guess if you make enough typos eventually you're bound to brute force some real words... ironic it fit the context.. lol
but yeah, he wrote a cache class that can write to a file, and compares it to a cache package that can write to a file, as well as 5 other backends, and a plethora of other features... thats dumbing down the problem
but yeah, he wrote a cache class that can write to a file, and compares it to a cache package that can write to a file, as well as 5 other backends, and a plethora of other features... thats dumbing down the problem
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: MVC Frameworks?
//Continuing off topicjosh wrote: i guess if you make enough typos eventually you're bound to brute force some real words... ironic it fit the context.. lol
That was a great laugh
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: MVC Frameworks?
ROFLMAO...thats hilarious...and really weird. Cause the word fit the context of the sentance/conversation I thought. Still funny as hell.I meant to write stupifying, typo... i guess if you make enough typos eventually you're bound to brute force some real words... ironic it fit the context.. lol