[wp-hackers] Shared Knowledge for Developers

Computer Guru computerguru at neosmart.net
Wed Sep 5 17:10:58 GMT 2007


On 9/5/07, Jacob Santos <dragonwing at dragonu.net> wrote:
> 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
> beautiful language.
>
> 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.
>
> Jacob Santos
>
>
> 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
> >> http://lists.automattic.com/mailman/listinfo/wp-hackers
> >>
> >>
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>

My experience with MVCs in PHP has been that they're horridly slow and
bloated - and definitely not worth it for something other than an
in-house project where you have complete vertical control over
everything from the server to the code to what gets implemented and
what doesn't.

I don't know what you mean about XSLTs not liking PHP in the XML, I
haven't had any problem with that... You serve a PHP document with a
file-type header for XML, add a reference to an XSLT file, and you're
done. Server-side PHP code doesn't make a difference, whether it is in
the XSLT or the XML (though it's not recommended to stick it in the
XSLT since most browsers do some really heavy caching in that
department); so long as the *final buffered output* from the server is
pure standard XML, it doesn't make a difference if it was once PHP,
CGI, or C#.

Anyway, just my two cents....

-- 
Computer Guru
Director,
NeoSmart Technologies
http://neosmart.net/blog/


More information about the wp-hackers mailing list