r/programming • • Jan 05 '11

Drupal 7 released.

http://drupal.org/drupal-7.0
222 Upvotes

259 comments sorted by

View all comments

Show parent comments

25

u/UnConeD Jan 05 '11 edited Jan 06 '11
  • Despite being a "content management framework", the core doesn't actually save you from writing code. You still have to write CRUD code, still have to manage validation, still have to define your own themables. That is, unless you use CCK/Views, which is pretty much developer-hostile lasagna and slow to boot. And it'll look like ass, unless you have an ubertalented designer who also knows PHP (i.e. a "themer", a role which doesn't exist elsewhere). And the one part that you would actually want to contextualize, i.e. the content UI, is shoehorned into the node/edit form with zero choice.

  • Despite the promises of the hook system, Drupal lacks the ability to swap out components. If you wish to leverage part of the page generation process for another purpose, you have to reimplement everything that comes after. Alter hooks are terrible tools for building reliable behavior, since they require you to actively fight against other parts of the system instead of just turning them off. If you don't share Drupal's assumptions about user accounts, you're fucked, unless you feel like trapping and erasing UI messages is a productive use of your time. And don't even try to maintain the resulting code.

  • Despite being billed as having a "solid core", Drupal's irreplaceable innards are actually pretty fragile. Form API is near impossible to debug and fails silently at the drop of a hat. The node system doesn't even let you reliably do programmatic saves. The user system is a terrible misdesign that mixes front-end presentation details ($category) with low level data manipulation. The global $user object is actually a useless fake, waiting to trip you up.

  • Entire portions of Drupal were created in a theoretical vacuum and released without any serious working implementations. For example, install profiles: they are executed in an incomplete pseudo-Drupal environment where it's actually impossible to do certain simple things due to static caches and dysfunctional APIs. Another example: Form API process functions with complex datatypes and dynamic AJAX manipulation. Theoretically possible, practically a nightmare.

The problem can be summarized quite effectively: out of the box, it is impossible to make a slick, modern website with Drupal, i.e. something that looks and feels like 2011 rather than 2001. It's only useful if you're already planning to write a lot of custom PHP/HTML/CSS. Otherwise you have to be happy with terribly designed contrib components that are insecure, don't scale and have bad usability. This is not surprising since Drupal has been in incremental-improvements-mode since 2002 (i.e. Drupal 4.0) and the few architectural improvements made since then were designed with only one purpose in mind: to support what Drupal already does, rather than being solid components of a CMF.

Doing Drupal will stunt you as a developer, overburden you as a designer and frustrate you as a user.

waves

1

u/[deleted] Jan 06 '11

Wow really really well written. I've got to save this for future reference. Those are all pretty major shortcomings of Drupal. The most frustrating is getting rid of the stock UI. That crap always finds a way to seep into your design.

Can you clarify what you mean about the node system not letting you do programmatic saves? Or was the key word 'reliably'? If so yeah I'd have to concur.

3

u/UnConeD Jan 06 '11

The problem is really the node_form and how it shapes the code around it. The idea is that you take the entire $node, you turn it into a $form structure with fields, which is then shown to the user. Then the submitted form values are serialized back into a new $node (which is made secure through Form API access control on fields).

This is dumb, because it elevates the form fields from just a UI implementation aspect into meaningful structure. It also means you need a comprehensive bidirectional translation scheme between $node and $form, which in practice means people get lazy and make forms that look like airplane cockpits.

But where it gets really problematic is that many contrib modules (out of ignorance) don't even bother translating back from $form to $node, and hardcore their node_save() callbacks to accept only the $form values. Passing in a vanilla $node will simply not work and result in data loss, aggravated by silent failure and those crazy type casts PHP is famous for.

I actually made a flowchart of this process for Drupal 6 to explain this to a coworker: http://acko.net/dumpx/why-drupal-nodes-suck.pdf

As far as I'm aware, the only way this has changed in 7 is that the $form fields are now automagically combined with the original $node, so that values not present in the $form are not lost. But otherwise, module authors are still expected to grasp MVC-related concepts in a system that has neither the vocabulary nor the grammar to express these ideas fluently.

2

u/[deleted] Jan 06 '11

Thanks for the awesome flow chart and info. I've got to ask about one more thing you've brought up. I've long suspected the global $user object to be a bit, well, suspect. Though it hasn't bitten me in the ass yet, I feel like I'm just waiting for the other show to drop as our program gets more and more complex. Could you elaborate on any known problems or is there anything I should keep in mind when coding to save myself some sanity in regards to $user in the future?

2

u/silvercircle Jan 06 '11

Pre-Drupal-7, global $user is not fully loaded. See the description here

Changed in http://drupal.org/node/347250#comment-1357142

2

u/[deleted] Jan 06 '11

Much appreciated. So Drupal 7 introduces a robust caching system for $user kind of like with $node now?

2

u/davereid20 Jan 06 '11

That issue has nothing to do with the global $user object. It's still not a full-loaded user.