Neutered Nodes: CCK's Dark Secret

Update 2 (march 1st, 2007)

Thanks to numerous improvements in CCK itself, and drupal 5.0, I now officially disagree with myself in this article. My criticisms last October no longer apply -- CCK now makes everything easier, and I've personally had an easy time pushing changes from development, to stage, to production using CCK. Consider this article a historical curiosity. (More info...)

Update: this is a fairly contentious claim, so be sure to read the discussion in the comments

When planning the development of a drupal site, be wary of using the content construction kit (CCK). While its one of drupal's most powerful modules, its also probably one of the most inappropriately used.

In general, I'd only recommend using CCK when:

  1. The client being able to define their own content types is a top priority.
  2. You don't need to alter the node forms.
  3. You won't be needing to integrate the nodes into other modules.
  4. And overall, you won't need to do anything special with the nodes.

As I see it, CCK nodes have one, and only one advantage: you don't have to build a module. Ironically, that advantage happens to be CCK's biggest weakness as well.

I haven't used CCK for a project in many months. The reasons are straight forward:

Code Is Actually VERY Useful

Even in cases where I have to define more than 5 content types, I'll always use the custom module route. In particular, here are just a few reasons why I'd rather have a custom module:

Full Control Over the Database Schema

Its nice that CCK builds database tables, but at the same time, you'd be suprised how easy the .install files make it laydown, and change the database -- its a lot easier than say -- trying to write custom queries for the CCK database .

Hard Coded Node Types == Control && Less Things to Worry About

If you've ever had to push changes to CCK node types to a production server, than you'll know what I'm talking about.

CCK is still BETA

And the developers of the module aren't calling it beta for kicks. It doesn't work perfectly, and the developers are the first to admit it.

CCK Node Types Cannot Invoke Drupal Hooks

This is without a doubt, the number one reason to avoid CCK nodes. When you move to CCK, remember all of the hooks that your nodes will never be able to see.

I use CCK as a last resort, because I can't live without the power of the hook system. If you learn these hooks, I promise that you'll find improvements in the speed, ease, and quality of what you develop. Here's just a few hooks that tend to be useful in my node modules:

Until, CCK node types can invoke these hooks, its hard for to not stand by my opinion that they are "neutered" nodes, and should generally be avoided when the requirements go beyond some quick phptemplate theming.

Note that non-web developers should ignore everything I just said. For you, CCK is probably a great module.