Greed.

Do you live your life by a greedy algorithm?

It’s an idle musing I had this evening after thinking about the way I tend to navigate around London, which is to choose the step that will take the biggest chunk out of my journey in the least amount of time from where I’m standing.  Hence in going from the City to Shoreditch I’ll walk, because I’ve made it halfway there in the time it’d take to furble round a Tube station and find a train.  The Tube would probably overtake, but it wasn’t locally optimal, so it lost.

(Also, I like walking.  But that’s not important right now.)

The nature of greedy algorithms makes them badly suited to problems where local maxima are actually pretty suboptimal.  For example, not getting out of bed on a cold morning is locally very good, but long term very bad thanks to the wonders of unemployment.

Programming, though, offers an interesting variation on this.  In a modern development environment, you can backtrack on your bad design decisions and refactor them out with relative ease right up until release.  Combined with the KISS principle usually (if not always) resulting in the best software, it makes sense to dive right in with the quick solution, because all you’ve got to lose is it not working.

Mostly, though, it does.  And you save yourself a lot of time.

Thoughts?  Any other adherents to the cowboy process?

(This isn’t a suggestion that you shouldn’t adhere to style and quality standards, by the way.  A locally optimal solution that doesn’t satisfy those isn’t locally optimal.)

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s