Passing pidget :-)

Re: Passing pidget :-)

by John Papaioannou -
Number of replies: 0
First of all, thank you for bringing this to our attention in the forums!

However, the rest of my post is going to have a negative tone. So I 'd like to say first of all that these are me personal opinions, they have been shaped from experience and not by a flash of light, but nonetheless they are personal opinions. And of interest to developers, mainly.

I greatly dislike such widget-style solutions for presentation. At first they seem good; any web developer knows that at some time you come to the "oh, having to output the HTML for this by hand is killing me" point. Then you start to look for solutions. You find something like Pidget. Now that looks good; especially if you have a preference for "pure" programming, like I do. You think "this is great! look at what I can do without touching HTML at all! my code will be so pure now!" and it seems you 've solved your problems.

But then reality kicks in. You see that for outputting a form with a drop down menu you need to write tens of lines of code. You see that if you need to change the layout in just a small, trivial, but sadly unprovisioned-for by the widget library way, you need to dig into their "virtual layouts", what ever that means. In fact, you probably need to create a new such layout each time. But... why? "I just wanted to make it 50% wide instead of 40! I don't need a specialized 50% wide version!! angry".

And let's not even begin with populating the drop down menu with database results. The data bindings feature that will sometime be available in Pidget looks promising, but aren't we forgetting something? Data bindings to... what? I (personally) and Moodle (as a platform) use ADOdb for database access. I wouldn't have it any other way. So I 'd best pray each night that the Pidget dev team give me ADOdb data bindings that I can use...

What to use, then? Well, my preference is the ADOdb + Smarty combo. Mentioning the word Smarty could lead to a whole new round of the pros and cons and necessity (or lack thereof) of using template engines, and it doesn't take an expert to understand that humanity will always keep arguing on such matters. Using Smarty works for me; I like it; I can support my choice with logical arguments. Unfortunately, so can the opposition. smile

In any case, the result of using ADOdb + Smarty is good enough for me. It sure beats anything else I 've tried. If you want to, you can even build on top of that (Martin's datalib.php is a prime example; if it were a book, it would be "Data manipulation for dummies") to ease development further.

The "disadvantage" of this solution is that you have to know HTML. You have to know CSS. You probably want to be really good at these. If you are a developer who's ashamed of that pesky little word "web" before your title, which seems to imply that your work is somehow inferior to that of "pure" developers, this solution is not for you. On the other hand, if you want to be the best professional you can, there's no other way.

This has gotten so long that it approaches bedtime story length. So it would be fitting to close with the proverbial moral of the story:

Widgets are good for application GUIs in C++. They 're not good with PHP. It's the right idea in the wrong context.


Jon