[wp-hackers] Shared Knowledge for Developers
dragonwing at dragonu.net
Wed Sep 5 06:15:06 GMT 2007
Such questions are difficult to answer. There aren't any clear
definitive answers to them. If you do it right (such as WordPress does),
procedural coding can be manageable. That is really the goal, when
coding, write manageable code that can be easily extended and reused.
When either breaks then the code becomes worthless and you will need to
refactor. As such, OOP can also lead quickly to unmanageable code when
bitches choose to use the Singleton design pattern and place as many
methods as possible into a single class.
A class should only have methods pertaining to its specific purpose, and
using other class patterns when needed. Violators should be shot, but
okay, everyone has to learn sometime and I was a big violator when I
started out in C++. However, I think Java naturally moves people into
other acceptable class patterns if beginners choose to model their code
off the standard library. C# is good with this also and also a very
I'm big on OOP, since it allows a more refined control over using
Globals and the mess that can result. I'm not a purist however,
procedural code is beautiful when done right.
WordPress already uses MVC is most places. I think one the worse
violator would have to the administration and I believe the reasoning
behind this is that no one should be editing it except the core devs. As
for a Framework, for my two sense, that is a extremely difficult
decision. Do you choose Zend, CakePHP, EzComponents, etc? When you bind
yourself to one, you restrict the level of other devs who will work on
your code. It is easier for most projects, because the focus should be
on the model and not the controller and view implementations.
One reason for not using them is that you pull in their security issues,
the library bloat, and the added abstraction isn't needed in most cases.
Not really true for the controller, as that should be abstracted, but
the overhead would be less without a template View.
Why use Smarty? PHP is a template engine, smarter people would say that
abstracting PHP is unnecessary overhead. Gallery 2 uses Smarty, good for
them, the model is good stuff. In my opinion, the added complexity of
the Smarty API and adding modules is more than it is worth. If you
really designers that don't know any programming at all, then just use
XSLT. You'll probably find everything faster. However, good luck, my
crappy implementation didn't work out as well as I had planned (even
though, technically, I didn't plan anything), and XSLT from what I've
read and tested, only works on XML.
PHP 5 XSLT doesn't seem to like for PHP in the XML file, and if you can
fix this problem, then please I would like to see the code.
The answer is really based on the decisions of the leads. I would
recommend that any decision be based on the collective technical skills
of the team, since that is what I've read to do. I'm just a massager.
howard chen wrote:
> I agree, but I think that these questions are worth mentioning, and I
> believe some others will give a better answer than me
> On 9/5/07, Jeremy Visser <jeremy.visser at gmail.com> wrote:
>> howard chen wrote:
>>> Some questions out of my head:
>>> 1. Why not using OOP / MVC framework/plattern?
>>> 2. Why not using Smarty?
>> This really isn't a thread about _asking_ bikeshed questions, it's about
>> _answering_ them and compiling them up.
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers