| home | resources | search | news | join | members: 6963 |
Hiveminds | Thu, 2006-05-11 20:31 tags: Portals, Drupal, Web Developer Web developerIf there is one failing that I have it is a compulsive need to improve on something that I see is not working as simply as it should. This has followed me around from job to job causing me to have to do things like redesign inventory systems and pull the entire wiring harnesses from boats and automobiles. In my mind complicated things should look simple even when the underlying design is so complicated most would not understand it. But if someone decides to peel back the layers then each layer should be as easy to understand as the first. This is the secret. Complication should come in layers of simplicity. This is the only reason I dug into this. I thought that it would be simple. Wrong. Wrong Wrong. No layers here. Just a tangle. Now, looking at Drupals forms API. After a whole day I would think that I would have some idea of the behaviour of the code. Alas nothing. The only thing I have managed to do is to delete several code rewrites in an effort to get consistent behaviour. It's code like the following that makes me crazy.
<?phpLooking at the above code one would think that to gain access to the elements of the arrays you would just loop back through them. This is conventional accepted behaviour in all code languages. But it does not work here. the problem here is that drupal_get_form(). This abomination I will not print here because anyone familiar with OOP would go into shock upon seeing it. It is a bit like that medusa head in greek mythology, one look and you turn to stone. Let's just say that the drupal_get_form() function is the reason for the unexpected behaviour and leave it at that. So now here is the code that releases the checkbox HTML.
<?phpBut wait. What I want to do is load the form elements into a nice table for presentation. In other words theme the output. This used to be so simple in Drupal 4.6. Just load each element into a cell by matching it to an array element. But in Drupal 4.7 this is no longer true. Now you have to do things seperately and matching them is more so difficult I can't explain it. What produces the outcome is is this code.
<?phpWhat that form_render(); is doing I have no idea. How the table melds into the form again I have no clue. It is just one more of those unexplained occurances in Drupals code. These sitings happen a lot in Drupal. Things suddenly appear out of no where. For the end-user it is meaningless but for the PHP developer it is frustrating. So far I have come to one conclusion in the midst of all this. If the person responsible for this code dies tomorrow then no one else will ever be able to work on it. It would be simpler to reverse engineer Windows. While an OOP based CMS like Joomla does have shortcomings and complications there is one thing that is evident when you dig through the code. There are consistent layers that are in keeping with known OOP techniques. If you study the code of the techniques then you will understand in a short while. You can find the reason behind a code event if you put enough time into it. But it is still OOP and it takes time. Drupal has combated OOP by using a procedural technique that has so far proven to be a match for OOP. It is effective in that when you look at the code you are usually only one hop away from the source of the code event. This I think is the reason for the popularity of Drupal. Web devs look at the code and they immediately they can make sense of it and manipulate it to suit themselves. Why Drupal has chosen to move to this old school Perl technique in Form API is beyond me. Especially since even Perl is trying to get away from it. As mentioned in previous blog the complicated tasks involved with Form API will adversly effect the upgrading of modules. Those module with simple interfaces that hold true to Drupals simple table out put will get upgraded to version 4.7. But developers like myself seeking to improve on the usability and layout of user interfaces will get shut down by the fact that Form API is centered on a single immutable function. This article brought to you by the
Hiveminds Magazine - Staff. Contact us if you want to post an article or announcement anonymously |
Web Developers London Hotels
Drupal Laptop Reviews
Silverlight Just Dial International Calls
Drupal Excel Training Courses
PHP excel courses in london
eRuby Data Recovery
|
||||||
NewsletterGet updates on Hiveminds services, articles and downloads by signing up for the newsletter. |
Editor's choiceSome of the better articles, stories and tutorials found at Hiveminds. |
Find moreFind more of Hiveminds articles, stories, tutorials and user comments by searching. |
Picked linksHand picked websites and articles from around the web that provide quality reading. |