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

5

u/Ergomane Jan 06 '11

and frustrate you as a user.

... and core developer

5

u/CritterM72800 Jan 06 '11

For those wondering, UnConeD is Steven Wittens, the 10th person to ever register on Drupal.org and a former core committer (of which there are very very few). He had a huge impact on Drupal core development until somewhere around 3 years ago, when he left.

3

u/the_exa_boy Jan 06 '11

Not surprised, ive had my run-ins with the code team.

→ More replies (4)

5

u/davereid20 Jan 06 '11

Steven, we appreciate your early work to Drupal which helped shape the community and software. But this just comes off as bitter remarks from someone who is no longer involved rather than an honest critical review. Step up and help us fix things we can fix. File issues. Come to DrupalCon Chicago and hash it out with us.

→ More replies (2)

9

u/CritterM72800 Jan 06 '11 edited Jan 06 '11

Hey, it's Steven! Thanks for that. Here are a few responses:

unless you use CCK/Views

That is pretty much a given. In fact, CCK is even part of core in D7. Commenting on Drupal sans-CCK/Views is sort of like commenting on a car without its tires (bad analogy, I know).

which is pretty much developer-hostile lasagna and slow to boot

The first part is vague and the second part screams for benchmarks.

And it'll look like ass, unless you have an ubertalented designer who also knows PHP

Is this really so different than every other system? WP requires themers know PHP to do anything useful in a theme. ExpressionEngine uses its templating system which is basically just a different looking version of PHP. I'd be interested to see what you think is so different about Drupal here.

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.

Not really sure what you mean here, but if you're just saying that it's difficult to customize the node's output, then you might checkout the contemplate or display suite modules.

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.

This is a legit point.

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.

What's the difference? You can turn things off with alter hooks. What's an example of a system that has a preferable behavior here in regards to overriding core behavior?

Form API is near impossible to debug and fails silently at the drop of a hat.

This is just an opinion. I've never had much trouble with FAPI.

The node system doesn't even let you reliably do programmatic saves.

Same as above; I've never had trouble with node_load() and node_save().

The user system is a terrible misdesign that mixes front-end presentation details ($category) with low level data manipulation.

This sounds like a nitpick to me. Does this really affect your programming or make any difference in your day to day work? Or does it just bother you on principle?

The global $user object is actually a useless fake, waiting to trip you up.

I'd be interested in more details here too. For example, it's fairly common to grab the uid from global $user, and I've never really hard any complaints about global $user before now.

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.

Certain things like what? I only have a small amount of experience with install profiles, so this is a curiosity question.

Form API process functions with complex datatypes and dynamic AJAX manipulation. Theoretically possible, practically a nightmare.

I'll agree here. That said, D7 has made some huge strides in improving the AJAX DX.

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.

By "out of the box" do you mean without any contrib modules? If so, then I'd agree, but that's sort of beside the point. You're supposed to take advantage of contrib modules, that's sort of the beauty of Drupal. And as for requiring a lot of PHP/HTML/CSS, I'd say that HTML/CSS is pretty commonplace in any CMS, and the PHP really just depends on the use case (you can do many many crazy things with Drupal/contrib modules without any custom code at all).

Thanks for that well thought out and well written post. It's well to see such a well reasoned critique of anything, including Drupal.

7

u/UnConeD Jan 06 '11 edited Jan 06 '11

That is pretty much a given. In fact, CCK is even part of core in D7. Commenting on Drupal sans-CCK/Views is sort of like commenting on a car without its tires (bad analogy, I know).

CCK is only good if the UI provided by CCK suffices. If it doesn't, then the added hassle of having to deal with procedurally generated objects, types and tables quickly becomes a nightmare. I've found it much, much easier to just write a simple ORM mapper and do the rest myself, and not for lack of trying either.

It's not just me who goes without it: the Ægir hostmaster system that stores all its data in node types also chooses not to use CCK. Go look at the people who made that and tell me they don't know Drupal.

Incidentally, you're talking to UID 10 on Drupal.org. Long story.

The first part is vague and the second part screams for benchmarks.

You must be unaware of the layers of indirection that are taking place here. Also, views is terrible on the inside. It's a nightmare of handlers, plug-ins and uncaught errors waiting to happen. There's also the fact that using Views requires you to structure your code very differently and in a remarkably un-drupal-like way. For example, you cannot ship views templates inside an associated module's directory (unlike regular templates), they have to go in a theme. Unless you implement hook_theme_registry_alter() to undo it, yay.

Other people apparently feel the same.

My latest Views project was trying to hook up an external data source to Views 3. It's absolutely terrible and that's with example code to model it off (apachesolr).

Is this really so different than every other system? WP requires themers know PHP to do anything useful in a theme. ExpressionEngine uses its templating system which is basically just a different looking version of PHP. I'd be interested to see what you think is so different about Drupal here.

How do I get rid of the colon after form field labels? The answer is not to tweak a template of HTML-with-sprinkles but to dive into hardcore PHP code. Shall we mention theme('table')? Or perhaps the $node->content array of doom?

Not really sure what you mean here, but if you're just saying that it's difficult to customize the node's output, then you might checkout the contemplate or display suite modules.

Actually I meant the node editing form. It's the most basic part of a CMS, and Drupal sucks at it. Vertical tabs or not, the idea that everyone should edit all sorts of content through the exact same UI is madness. It also ignores the fact that you don't create an end-user oriented UI by hiding parts of the developer-oriented UI and calling it a day.

What's the difference? You can turn things off with alter hooks. What's an example of a system that has a preferable behavior here in regards to overriding core behavior?

The proper answer is to use inheritance to override behaviour rather than to undo it, e.g. using MVC to separate concerns and OO to allow for selective code modification.

Go and try to make it so that people can log-in with their e-mail address instead of their username. I'll wait while you figure out how to get rid of the error messages that no longer make sense.

Or perhaps you would like to replace the godawful password recovery page with one that actually looks like something a real web service might use? Unfortunately, the code that verifies the security hash is intricately tied with the part that displays the UI so your only option is to menu_alter out the entire page and reimplement it.

This is just an opinion. I've never had much trouble with FAPI.

Have you ever defined a custom element type? Used #after_build or #process functions? Used #ahah/#ajax? And done so without ever encountering a random type error deep inside form.inc? The menu system suffers from the same affliction: if you accidentally forget the array() around the 'access arguments' for example, you'll end up with some cryptic error deep inside menu.inc. The only way to debug these errors is to insert trapping code at the reported location, which incidentally is a whole cache refresh and page request later than the offending bug.

Fact is, Form API is undocumented and untested for the things it was supposedly designed to do. Do you know the rules around form caching and $form_state['storage']? When $form['#cache'] is needed? Or that your form element IDs will get broken if you trigger a form rebuild inside a page request? Yay. Still broken as far as I know.

Same as above; I've never had trouble with node_load() and node_save().

Detailed here: http://www.reddit.com/r/programming/comments/ewoub/drupal_7_released/c1bl1cl

This sounds like a nitpick to me. Does this really affect your programming or make any difference in your day to day work? Or does it just bother you on principle?

Have you looked at the signature for user_save()? You cannot simultaneously modify two properties that are situated on different user profile tabs. By design. If you do any work with hook_user(), this will bite you in the ass. User objects are also unique in Drupal in that they will store custom properties for free. Incidentally, this has lead to many contrib modules polluting the users table because they don't expect it. Like the legal.module, which pushed the entire terms of service into every single row in the table.

I'd be interested in more details here too. For example, it's fairly common to grab the uid from global $user, and I've never really hard any complaints about global $user before now.

Passing the global $user object into user_save() will result in data loss if you have any modules that extend the user object. Simple as that.

Certain things like what? I only have a small amount of experience with install profiles, so this is a curiosity question.

Just one example. There are many, because of how much of a clusterfuck install.inc is. It tricks Drupal into thinking it's already installed to bootstrap it, and then pretends nothing's wrong when it installs all your modules and themes (which then fails when they do anything complicated on install).

You're supposed to take advantage of contrib modules, that's sort of the beauty of Drupal.

Except for the part where they are insecure and have terrible usability. Like for example the Single Sign-On module, an authentication module that let you steal UID 1 access from an admin with a single click. Or the Services module, where an elaborate fix for a reported security issue was itself insecure and spoofable. If you look at the security reports for Contrib, you find that they are the same vulnerabilities over and over again, in different modules, over several years. People are not writing better modules.

I have yet to encounter a situation where I can actually drop in a contrib module and have it satisfy my professional requirements. It just doesn't happen. I have to review their security, fix the interaction flow, get a designer to make it actually nice... and that's assuming there isn't some DB-server-destroying query in there.

If I have to audit every single contrib module I want to use, and the reward is a module that's kinda crappy anyway, I'll pass. It's just not worth it.

2

u/CritterM72800 Jan 06 '11 edited Jan 06 '11

Incidentally, you're talking to UID 10 on Drupal.org. Long story.

Yeah, sorry about that. Right after I posted, I realized it was you. I wouldn't have dumbed it down if I had. Anyways, thanks for the replies.

→ More replies (1)

2

u/davereid20 Jan 06 '11

"How do I get rid of the colon after form field labels?"

Gone by default in D7.

→ More replies (5)

3

u/mikey_p5151 Jan 06 '11

As I responded to the comment below, I'll just save a few point for here. I don't know how much you've been following Drupal 7, but this really reads like a laundry list of complaints of issues that have been addressed since you were working on Drupal.

I'm not even going to take the time to go over where I think you're wrong and which issues have been fixed. I'm sure you think that anyone that still uses Drupal has their head in a microwave, but complaining about the problems that were there in the releases you worked on instead of discussing the fact that people stuck around to fix many of them, is just poor taste.

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

This should read: "Doing any single (framework|cms|platform) will stunt you as a developer

2

u/fewpeople Jan 05 '11

Well said.

3

u/dlundy Jan 06 '11

Get out of my head.

Just about everything you've said here is what led me to quit a job writing reasonably complex stuff in Drupal. I could never articulate it this well, though.

I will admit that there is a certain sweet spot where Drupal can be helpful and productive, but if your codebase morphs into something outside of Drupal's comfort zone, then all I can say is good luck.

3

u/_jamil_ Jan 06 '11

What do you use now instead?

3

u/[deleted] Jan 06 '11

You are my new god. You've succinctly put to words everything I've been feeling over the past few years I've had a Drupal project on my plate.

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.

5

u/mikey_p5151 Jan 06 '11 edited Jan 06 '11

While this does perfectly describe the problems with previous versions of Drupal, I think quite a bit has changed since you have been around and committing. Any entity that properly implements field_attach_* hooks has a consistent data structure that can be loaded, modified in place, and saved without concern over whether the $form fields match the structure that the saving function (and ultimately field_attach_insert and field_attach_update) expect. It just works. Seamlessly.

As to mapping form field to entity fields, of course that will never match and any system that claims to integrate those items ends up being what Drupal was, not what it is now. field_attach_form and field_attach_form_submit are what glues these two items in a default way, but keeps the data structure of the object 100% separate from the values of the form itself. I'd suggest anyone that has fought this code in the past, write their own entity module that is fieldable, and use these functions to understand how they actually work and how the data structures work.

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.

This is just silly. We aren't talking about 4.7 and 5.x contrib modules. We're talking about Drupal core, and it's changed alot. Not to mention nothing prevented users from writing Drupal 5.x or 6.x modules that DID NOT have this problem. Project module (for all it's cruft) actually does an awesome job of putting it's metadata in consistent, repeatable, and sane places that work whether it's getting a form value or a $node object.

Nothing is stopping (other than lack of time and motivation) fixing the node preview issue once and for all, the object I get back from field_attach_form_submit() has all the fields in the exact same place they are when they are returned by entity_load() and field_attach_load().

6

u/UnConeD Jan 06 '11

I've actually dug through quite a lot of D7 code. And noticed all the "Fix this in D8" comments that show the issues I've raised are still there.

Besides, you're focusing on the minor complaints and ignoring the big ones I started out with. But since you insist, take a look at node.pages.inc:90-99 ($node being stateful, in direct contradiction with how Form API is designed) and session.inc:106-127 (global $user is a fake) and tell me these are the hallmarks of a well-designed system. None of these things matter for vanilla stuff, it only comes out when you try to push the system into more advanced ways of interaction. You know, doing experimental development, pushing the edge, what Drupal used to pride itself on?

As for core vs contrib...as the rest of this thread shows, you can't look at Drupal core in isolation. In practice, the vast majority of people do rely on contrib modules, and Drupal.org does not make any effort to suggest doing otherwise. It is dishonest to pretend that the ultra strict principles of Drupal core, which only arise as a result of a strict vetting process, will spontaneously radiate outward to contrib modules and the sites that use them. It has never happened, and it won't change any time soon.

As for your accusations about "poor taste"... I'm posting technical arguments in response to a direct challenge about Drupal weaknesses, on a site that isn't Drupal.org. If that somehow offends you, tough luck.

→ More replies (1)

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.

2

u/chu Jan 07 '11 edited Jan 07 '11

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.

It's no problem to do that kind of pseudo-MVC (as used in most web frameworks) in Drupal as it's effectively Hierarchical MVC/PAC in any case. Rich models containing all business rules implemented OO in include(s) with a clean API (able to use complex data structures, unlike being tied to an ActiveRecord-based framework), module/menu as controller/router, template files as view - job done. Nice part is that you get AOP baked right through into the bargain. Architecturally it's a hybrid but that doesn't make it a bad design.

→ More replies (1)

1

u/chu Jan 07 '11 edited Jan 07 '11

Disagree with your summary, having been involved in modern big sites with near zero code required. (Though obviously you are going to write full HTML/CSS on any serious site, otherwise there's WP.)

You have clearly identified in detail coding/design issues that you find problematic on a project where you were a major contributor. Have you moved onto a different framework that you think is better and somebody had already done this work? And why not tell us about this better alternative instead of just 'Drupal sucks'? The issue list you have compiled is clearly useful for anyone working on Drupal 8 architecture in particular, but I'm sure you're aware that it's not usually a problem to find a contributor to talk about why any framework x sucks (though maybe not so much in a public forum) as they are intimately familiar with all the expediencies and inconsistencies that were required to create useful software in a useful timeframe. I've heard similar tales of WTF-ness (albeit it lower level like those frameworks) from Zend and Rails camps for example. (I've also seen Drupal do far more complex integrations far more easily than other frameworks.)

2

u/UnConeD Jan 07 '11

Why speak up? Because people should know what they're getting into. If Drupal works for you, great. But Drupal folks need to realize they are at the center of a giant reality distortion field that conveniently papers over its flaws in favor of an almost cultish feel-good vibe. It's a huge community, arguably the biggest OS community in the world, and what comes out is a product that is meh and doesn't look like anything that is exciting on the web today.

There's also the fact that I've observed these processes at work up close, for years, and don't believe Drupal will change any time soon.

But it's not like I'm on some crusade to discredit Drupal. I've barely written anything about it since I left. I merely saw an opportunity to speak up and did so. Given the response, it seems like it was a good idea.

→ More replies (1)