Despite the title, wunderkraut has not yet branched out to hatmaking:
The "feature hats" we're talking about is our approach to minimize conflicts when using a code-drive development method for Drupal, especially when using Drupal features for storing configuration in code. This configuration is changed by developers by updating features, i.e. exporting configuration in code via the popular features module – a merge-based source code version management alone like git doesn't avoid confilcts here.
The typical code-drive development approach for Drupal 7 involves a combination of an installation profile, exported features, a modern version control system like git and a good use of branches. In this setup, a central development server is optional, and if it is there it is only used for testing purposes. No configuration changes are ever done on a remote server. Every developer has his or her own local development environment and changes are exchanged exclusively via git. All contributors to the project use this workflow, whether they are site builders, themers or hard-code developers.
The features module plays a key role in this setup, but it can also lead to conflicts when two developers work on the same component and change configuration locally which is then exported in code via features. In short, two people simultaneously override the same feature component in their local environment, and whoever exports their change last completely erases other people's changes – or git simply merges the changes together, so the feature appaers as 'overridden', since its git-merged code would've never been generated by the features module. As you can guess, such problems have a tendency to work against an efficient collaboration.
The solution is of course to only have one person working on one feature at a time. Our "features hats" method is just a formalized version of asking around the office "Is anyone working on the feature 'myproject_user_profile' ??? ", with the advantage that it works with distributed teams: A "feature hat" determines who is currently working on a feature, by assigning a "feature hat" ticket to this team member. As with a real hat, only one person can wear the hat at a time. The theoretical hat can be materialized as a ticket in your project management tool. When you start working on a feature, you first check that the "hat" ticket is not assigned to anyone. You are responsible for checking that the feature is in a default state (relative to the master branch) whenever you assign the "hat" ticket to yourself or when you are done with your changes and unassign the ticket from yourself (Bonus 1: You can get a complete overview who works on what features within a split second; Bonus 2: Your ticket system tracks who worked on which feature over time).
While this system seems like a simple extension of common sense, it can save a lot of time in the development of a project. By combining these feature hats with a git rebase workflow, we have been able to reduce the occurrence of conflicts with feature code to almost zero.
Want to try this for yourself? Just create one "hat" ticket per feature in your task-tracking system (we use redmine), and you'll be ready to go!

Feature hat ticket and subtickets in the issue list.

Feature hat ticket (single view), with subtickets and description.
6 Comments:
Niiiiiice. Are certain features components notoriously bad?
Dude, this a great idea! We're just getting into full-on features use, and we haven't so much run into conflicts, but it will no doubt be the case later :)
Oddly enough, I didn't previously consider that merges might create features-incompatible code, but I suppose you're right. Are there any features-integrated modules that tend sidestep (or cause) conflicts when merged, in your experience? For example, it would seem that strongarm would always merge features edits gracefully (though I might be wrong on that).
code-getriebener
Wie gut funktioniert Ihr "code-getriebener Entwicklungsprozess unter Drupal 7" in der Praxis? Was machen Sie, wenn ein Modul den Feature-Export nicht unterstützt?
Was tun, wenn Feature-Unterstützung nicht vorhanden:
Die Frage der Features-Unterstützung hat mehrere Aspekte und Lösungsansätze:
* Bei der Modulauswahl schon Features-Unterstützung berücksichtigen (Module/Alternativen mit Unterstützung von Features oder Exportables bevorzugen)
* Viele Module bringen schon implizite Unterstützung von Features mit, wenn sie den "Exportables"-Mechanismus unterstützen.
* Viele Module speichern ihre Konfiguration nur in Drupal-Variablen (Tabelle {variables}). Oft können deshalb solche Module ohne explizite Features/Exportables-Unterstützung auch verwendet werden, mit Hilfe des strongarm.module
* Fehlt noch "ein klein wenig" Konfiguration in Code, um ein die Konfiguration eines Moduls ohne Features-Unterstützung zu erfassen, bietet es sich an, mit ein klein wenig Code (API des entspr. Moduls u/o direkte Datenbank-Zugriffe) diese Konfiguration in install- oder update-Hooks entspr. zu setzen – in einem eigenen Modul, oder noch besser in einem Install-Profil (das man auch als "Dach" für sämtliche allgemeine Konfiguration verwenden kann).
* Hat man es mit einem Modul zu tun, das keine Features-Untersützung aufweist, keine Features-tauglichen Alternativen hat, und viel Konfiguration in eigene Datenbanktabellen speichert, sollten man sich das Selber-Schreiben der Features-Unterstützung für dieses Modul überlegen. Das ist meist moderater Aufwand, man lernt viel über das jew. Modul und – noch wichtiger – Features, und hat damit die Möglichkeit gleichzeitig seinem Projekt und der Drupal-Community Gutes tun zu können.
* Fehlen in letzterer Situation die Resourcen für eine eigene Implementierung der Features-Unterstützung (was sehr schade wäre) könnte man einen Blick riskieren auf das features_tables.module, das beliebige Datenbanktabellen als ganzes über Features ex- und importiert macht – "riskieren" ist dabei aber wörtlich zu nehmen, denn besonders "by the book" und "Drupal way" wäre das nicht, v.a. wenn man weder das entspr. Modul noch Features wirklich gut kennt, und mögliche Seiteneffekte sind nicht sofort zu überblicken.
Es gibt also gleich einige Handlungs-Möglichkeiten, wenn ein Modul keine explizite Features-Unterstützung beinhaltet. Problematischer sind eher noch Module, die nur eine teilweise oder 'experimentelle' Features-Unterstützung mitbringen, da man sich dann nicht auf ein erwartetes Verhalten verlassen kann.
Beachtenwert ist auch noch die Feststellung, dass Features in Ermangelung einer besseren Alternative zwar als Deployment-Werkzeug einsetzbar ist, aber weder ideal noch ausgelegt ist für diesen Zweck. Zum eigentlich ungeplanten und manchmal problematischen Einsatz als Deployment-Werkzeug und zur Historie von Features gibt es übrigens einen aktuellen (heute ist der 2011-06-13) Blog-Beitrag von Lullabot zu Features.
Can the output format make merge/diff easier?
I'm talking about Views, but I think it applies to Ctools exportables as well... the only thing that separates different exported objects is:
// Some comment
It's indented with two spaces, so git won't see it as a new code block. Is there anything we can do to the exported source code to make diffs and merge more likely to succeed? Perhaps we could use larger phpdoc style comments to separate the exported objects and NOT indent them with two spaces?
/**
* Exported view 'calendar_special'
*/
$view = ...
Great little write up, ran
Great little write up, ran into similar problems with features as a development tool.
The approach I've used is to assign the features hat to one developer, changes to views, content types etc are done all a live dev server by all devs. Then at the end of each day the dev assigned to the features hat takes a full database backup of the live dev site & then updates all the features (via drush normally) with the configurations on the live dev site. It's worked pretty well in the teams I've worked in.
Heard some discussions about features not being designed to be a dev tool but personally I think it fits the job well, being able to see configuration changes in version control is really useful! Communication between devs in key to it working though.
Interested to hear what dev workflows others use :)
Cheers
Tom
A few addendums
Just wanted to add a few points here:
1.) When working in a team unit like this, it is generally best to also utilize a couple of drush make files (this is a good howto on the topic: http://drupal.org/node/1006620) and every feature (and the install profile) should have separate git repositories.
2.) Keep in mind that while the situation described in this article can certainly happen, it only happens when two developers edit the exact same component within a feature. For example, both developers must alter the same view, page, content type in some significant way. If one developers changes a view, and another changes the content type, these sorts of errors are far less likely (though again not impossible).
Other then that, interesting approach... too bad you can't automate it in some way.

