Tuesday, January 30, 2007

Joel Spolsky on a good hack :


I think what makes a good hack is the observation that you can do without something that everybody else thinks you need. To me, the most elegant hack is when somebody says, "These 2,000 lines of code end up doing the same thing as those 2 lines of code would do. I know it seems complicated, but arithmetically it's really the same." When someone cuts through a lot of crap and says, "You know, it doesn't really matter."

For example, Ruby on Rails is a framework that you can use with the Ruby programming language to access databases. It is the first framework that you can use from any programming language for accessing databases to realize that it's OK to require that the names of the columns in the database have a specific format. Everybody else thought, "You need to be allowed to use whatever name you want in the database and whatever name you want in the application." Therefore you have to create all this code to map between the name in the database and the name in the application. Ruby on Rails finally said, "It's no big deal if you're just forced to use the same name in both places. You know, it doesn't really matter." And suddenly it becomes much simpler and much cleaner. To me, that is an elegant hack—saying, "This particular distinction that we used to fret over, just throw it away."