by Cesare Rocchi

Writing code in entrepreneur mode

by Cesare Rocchi

Here is it, innocent Ruby code:

t1 = "2015-08-27T11:53:00-07:00"
t2 = "2015-09-16T12:33:36-07:00"

t1 < t2 #true

Some of the DB queries in Podrover involve time. For example: “get all the reviews since yesterday”. During the prototyping phase I always worked with strings and when I came to build that query I still used strings. As long as the format (and the time zone) is the same it should work. If you have a case in which it doesn’t work let me know and I’ll update this post.

This is code written in “entrepreneur mode”. Quick, dirty but working. And I am still proud of it, particularly of the way I cut corners.

But the developer side of me took over for a few minutes and I showed the snippet to Ben Scheirman. It took him probably ten words before saying “gross”. And he is right. It is gross. But it took me five minutes to conceive and write it.

In the end Ben talked me out of it and I spent around 2 hours refactoring my code to move to DateTime, as it should be.

The developer side of me thinks I did the right thing. The entrepreneur side of me thinks I could have spent those hours talking to more customers. Both sides are right. It’s my job to balance them. It’s not easy but I am confident I will succeed.

Some “guides” I keep handy.

  • Judicious Use of Shitty Code
  • “Choose the bugs you want to ship with your release” (heard a long time ago, don’t remember who said it)
  • A coin to flip when I wake up, to decide who should dominate during the day, the developer or the entrepreneur.

If you struggle with similar issues let me know on Twitter or even better write a blog post about it.