Archive for the ‘Developer’ Category

Oct 20th (day 8): Programming as artisanship

by Hang

It’s been noted before by many people that programming should be thought of as craftwork, not manufacturing. The economics of programming is such that the cost for each incremental unit is 0, so it makes sense to view development as a source of revenue generation and not a cost to be contained.

The most visible manifestation of that seems to be the Google style perks that seem to be de rigeur now among web 2.0 companies. Basically, the equation boils down to more perks means happier programmers and happier programmers mean the most number of feature points per hour.

But if programming is artisanship, then I think creature comforts are merely the most rudimentary of what we could be doing and it’s instructive to look at true artisanship in other field. In particular, when we look at examples of the truly haute in couture or cuisine, one of the things which is most striking is that they revel in their stunning inefficiency and that this is what makes them special. There is no attempt to streamline or rationalize or redesign for efficiency purposes. If a suit jacket can be made even incrementally better by individually hand stitching each seam so that the stripes are aligned, then this will be done as a matter of course. Sure, you could get a suit for half the price with a barely indistinguishable drop in quality but this doesn’t matter because what artisans are striving for is not efficiency but quality.

So what does this mean for programmers and programming shops? What would happen if we abandoned efficiency as the primary goal of the organisation? What stunningly inefficient paradigms could we embrace?

The first that comes to mind is pair programming. Maybe pair programming works, maybe it doesn’t, I don’t know. I’ve not seen that many people talk about it outside of the hardcore evangelical XP community and it’s easy to see why. No matter how you manage to slice and dice it, two developers working on a single machine are just not going to be able to produce as much code as both of them working independantly and XPers trying to sell you that it does start stretching for increasingly absurd arguments. To any organisation, the idea of pair programming sounds like an extraordinary extravagance which would be impossible to justify under any budget.

Another thing which seems curiously missing is the concept of a “stage” or sabbatical or any other form of dedicated educational experience. In haute cuisine, chefs will stage at each other’s restaurants all the time to pick up new skills or gain different perspectives on food. Why is it that no company offers a 6 month, paid time off so that their employee can go work at Google or Facebook or any other place doing interesting things? What would happen if people were regularly allowed to drop out for a few months at a time to do pure research?

Even in the most enlightened companies right now, programming is still viewed as a fundamentally productive activity (in the sense that the goal of it is to produce things). It’s a very tough sell to propose anything which doesn’t demonstrate an increase in function points/hour/dollar. But if we truly believe programming to be an artisanship activity, then we should consider optimising for something else, optimising for quality so that even the most extravagently inefficient touches are celebrated because they make the product better. Could this work economically as a model for commercial programming? I honestly don’t know yet…

Oct 19th (day 7): Rails Rumble done

by Hang

Discovered a rather unpleasant surprise. I assumed Rails Rumble was ending at midnight PDT, turns out it was actually midnight GMT which meant we were scrambling over the last 8 hours to get everything done. Anyway, a somewhat function version of the site is up at:

http://dontsendit.r08.railsrumble.com/

Site is definately very barebones and lacking in decent design/features at the moment.

September 16 2008

The tribulations of success

by Hang

So we launched www.aminormalornot.com to the outside world today. We did a limited friends-and-family style launch 3 days ago in order to get some feedback and make sure there were no glaring bugs and in general, we got a lot of positive feedback. Given this, we decided to push it on the social news sites reddit and digg.

What we weren’t expecting was how quickly our relatively cheap and wimpy server got crushed under the load. I think getting swamped by a massive surge of traffic is every little startup’s dream but it was a bit pathetic when it happened with only a few hits a second.

After looking into the matter, it turns out that the 256MB of RAM on our VPS was much too small for serving a Rails app with the configuration we had. What was happening was that each new request was spawning a new apache and ruby process which would push an old request out to disk. When the old request started up again, it had to pull it back into memory and then push the other request to disk. We spent roughly 0.3% of our CPU time actually serving files and 99.7% shuttling files back and forth.

After upgrading to a larger slice, we’re back up and serving requests again at a tolerable pace. We’re about 10 minutes into getting the server back up and we’re already at 340MB of RAM so I’m going to keep an eye on this and see what we can do about reducing memory usage.

What are the lessons learnt from this? I don’t quite know. I’m sure there’s a huge amount of inefficiency we could wring out of the code that would decrease memory usage dramatically. But I still think to prematurely optimize this would have been foolish. The chances that we we’re actually going to be a big hit with this site is still low. We managed to get this site from concept to first alpha in 10 hours and from alpha to ready-to-release in 4 days. The only reason why we decided to play around with this was because we knew the cost in time for doing it was so low. Now that we are starting to get traffic, we’ll look into optimizing some stuff.

Also, much props to our host, Slicehost for their prompt support and super easy admin tools which helped us get up and running as soon as possible.

More stuff to come as I get to grips with this…

August 21 2008

Universal undo

by Hang

Why is universal undo supported by so few text editors? When I close a file, the text editor erases my entire undo history. Being able to undo a file all the way to the very first keystroke I typed in would be a really compelling feature to me.

In fact, what I want source control to be still is a giant unified universal undo for my project. Don’t bother me with releases and versioning, just log my actions on a per keystroke level and let me revert back to the second before I fucked up.

I understand the technical challenges of implementing this and how more formal version control scales better to more complex projects but I still crave the ability to mark a folder as being under universal undo with a super lightweight mechanism.

August 19 2008

Rails 2.0 + SWFUpload + RESTful authentication

by Hang

Just a note on changes in Rails 2.0 which messes up a couple of tutorials on getting SWFUpload working with restful authentication.

The gist of it is that Flash cannot send cookie data so if you’re using a cookie based authentication mechanism, it will fail. The solution is to insert the session id into the query string and then hack CGI::Session to set the session id. A lot of tutorials have you insert this snippet into either environment.rb or lib/ but this no longer works with Rails 2.0+. Instead, you need to put it in the config/initializers folder.

Knowing that would have saved me about 5 hours worth of frustration.

July 29 2008

Decent text editor with .rhtml/.erb syntax highlighting?

by Hang

It seems odd to me that many of the major text editors still have such poor ruby on rails support. I’m currently trying out a bunch of different text editors and the none of the three I’m using now have any form of rhtml support.

So goodbye Editpad Pro, UltraEdit and SlickEdit. It looks like there’s only a meagre handful of editors with actual decent rails support on Windows so I’m going to see if I can find me a new favourite editor.

July 28 2008

Recursive grep that ignores svn

by Hang

grep is a nice little tool which oddly doesn’t have the -R argument like every other linux utility to recursively search through sub directories. Google reveals that it’s possible to couple find with grep to simulate recursiveness however, a major annoyance with using recursive grep on a SVN project is that you get duplicates from the .svn folder.

This little alias creates a recursive grep that ignores the .svn directory.

In your .bashrc, add the line:

alias rgrep="find . -follow \( -name ".svn" \) -prune -o -print | xargs grep -Hn"

Logout and log back in again and rgrep foo should find foo in the current directory and all sub directories

Copyright ©2009 BumblebeeLabs — Theme designed by Michael Amini