37signals logo

This is Signal vs. Noise, a weblog by 37signals about design, business, experience, simplicity, the web, culture, and more. Established 1999 in Chicago. Visit the Product Blog for more information on our products.

Jobs:

See more on the Job Board.

Embrace real constraints, not artificial ones Jamis Oct 24

7 comments Latest by Social Media Marketing Blog

I’ve been doing research for my RubyConf presentation on November 6th, and while digging through one of my old projects, I ran into an interesting bit of code.

The project in question was Needle, a result of a brief love affair with complexity. (This was before I met 37signals, and both 37signals and my wife have since forgiven me.) It was a fun project, but I added features because they “sounded cool”, not because I had any practical need for them.

Adding new features always results in increased complexity. (For some features, the added complexity may be fairly small, but there is not necessarily any relation between the perceived complexity of the feature and its implementation. That, however, is a topic for another dissertation.) In the case of Needle, I wanted (essentially) to be able extend objects on the fly, and I had two ideas for how to do this. In one, you specify an existing extension to append to the object. I called this the “with” approach, since the object is extended “with” another one. In the other approach, you specify an anonymous block of code to extend the object with. I called this the “doing” approach, since the object is extended by “doing” something.

Both sound cool, right? Yeah, man! Extend objects on the fly! Whee!

So I implemented both. The problem was that I couldn’t immediately see how to make both work together. What would happen if wanted to extend an object both “with” something, and by “doing” something? Adding the features themselves added complexity to the project, and I wasn’t willing to further complicate things by making the two features compatible, so I created an artificial constraint: the library would raise an error if you tried to use both features on the same object.

Now, constraints are good, and you should certainly seek to embrace yours. But creating artificial constraints because you’ve painted yourself into a corner is code smell, and the solution is not to accept your corner and wait for the paint to dry, it is to unpaint yourself out of that corner. In the case of Needle, I should have either worked harder to make the two features compatible, or removed one of them. (Or both of them!)

Ultimately, Needle failed because it didn’t fill a real-world need, and so its code is a graveyard full of things like these artificial constraints. Real projects need real applications. But complexity being what it is, eventually you’re almost certain to find yourself heading for that corner with a trail of paint chasing you. When you do, pause for a moment and consider whether this is a true constraint you’re embracing, or whether you can do with less complexity. Chances are, the prospects aren’t as bleak as you thought.

This is all related to a RubyConf presentation I’ll be giving in Orlando on November 6th, entitled Recovering from Enterprise: how to embrace Ruby’s idioms and say goodbye to bad habits. If you’re going to be there, do stop by and introduce yourself!

Looking for a job? Got a position to fill? Check out the Job Board.
Got a web design project in mind? Find a web designer on Haystack. Browse by visual style, portfolio, budget, and geographic location.
Over 1 million people use 37signals' simple web-based software to collaborate on projects, track contacts, and organize their business with an intranet.

7 comments so far

Andrew Brown 24 Oct 08

Did 37Signals build custom software for other companies before Basecamp?

someone 24 Oct 08

Jamis used Ruby before coming to 37Signals, but prior to Basecamp and subsequent products all 37Signals did was design for clients. They never did database work or server-side coding.

Tim Jahn 24 Oct 08

Features lacking a practical need are definitely a problem. As you said, always take a step back and see if you’re just adding more complexity.

GeeIWonder 25 Oct 08

Kudos to you Jamis for revealing a project in your past that you’re apparently not particularly proud of. That’s hard to do, even just to yourself

Praveen 25 Oct 08

Hello,

I tried campfire and created a chat room at http://scientia487.campfire.com, but this is being blocked at DNS level and a site called yeah.com is getting displayed.

This is happening from Bangalore, India. I am a potential customer and my acces is being blocked to your site…

Thanks, Praveen.

Mathew Patterson 26 Oct 08

Praveen, try http://scientia487.campfirenow.com which is the URL you want.

Social Media Marketing Blog 29 Oct 08

Praveen, mathew is right .. you should try … http://scientia487.campfirenow.com

Comments are closed