Have you noticed the difference between Good Clever and Bad Clever?
For instance, I recently spent a couple of hours working out to make a Genre model which
acts_as_nested_list work in such a way that when ask one of the trunk genres for its tracks it finds all the tracks associated directly with the trunk or with any of the genre’s sub genres. It’s made doubly complicated by the fact that the genre is related to its tracks through a relationship model, and triply complicated that we’re going to want to be able to be able to search within the basic set of results (because, usually, we don’t want 300 tracks on a page…)
The solution I ended up with runs to about two emacs screenfuls and it’s ugly as hell. We’re having to declare custom ‘select_sql’ for getting the basic collection, and then extending the association with a custom ‘find’ and method_missing, and you can forget about making
genre.tracks.create work because life is far too short.
There’s no doubting that the solution is clever; it took a couple of hours of concentrated thought and experimentation to come up with it. However, it’s definitely Bad Clever.
What is Bad Clever?
What about Good Clever then?
Good Clever delights. Good Clever is modest, only revealing exactly how clever it is when you look more closely. Good Clever has a simple set of Just Stories - the complexity of the problem domain is exposed gradually. Good Clever has the Quality Without a Name. Good Clever is what happens when you have that simplifying insight that turns a bit of ugliness into something that isn’t going to embarrass you.
If only I could achieve it…