War Story: Software Engineering a Startup

Disclaimer: I totally disagree with the post below, and I’ve written a response to it here.

I’ve published two serious websites: helpd.org and cellarspot.com. Each has a similar success story (there isn’t one), and they were both developed in very different ways. The code we wrote for Cellarspot is super scalable and robust, and the code Eric Fisher wrote for helpd is inline. I wanted to share my thoughts on which engineering approach I think is better and why.

Helpd
The code written for helpd is all inline PHP – the same, single PHP file has SQL queries, HTML, and AJAX request logic. There aren’t any classes, and there are only a few functions to simplify SQL queries. All the engineers out there are probably saying to themselves, “What are these dudes thinking? Idiots.” No. Eric wrote all of helpd in 90 minutes, which let us very easily and quickly test the helpd idea to see if it would take off. It didn’t, so only 90 minutes were wasted (we’re going to try to rework the site, so those minutes weren’t actually wasted). Inline PHP allowed us to throw something up insanely fast to see if the idea would work. Eric and I are both students making websites in our free time, so we want to get things shipped as fast as possible to see who they’ll do.

Cellarspot
The code written for Cellarspot is exquisite and is written in JSP using Spring MVC and Hibernate. We have a data access layer, a business layer, a search framework, and an index framework, etc (see the end of this post for references). We pursued Cellarspot in a software engineering class at the UW, so it was our job to write robust code. We definitely succeeded, but it took five of us three months to complete the site. Five people working an average of about 10 hours a week for three months adds up to 36,000 minutes. That doesn’t even include the first version of Cellarspot I worked on and the newest version I’ve been working on.

So what are the lessons learned here? First, I don’t regret spending so much time on Cellarspot, and the reason why is because I learned a whole lot about software engineering, design patterns, and teamwork by pushing for awesome code. I’m super glad that I learned these skills. However, I’m also super bummed that I invested so much time in Cellarspot only to see it not do well. I’ve thought up two different cases and what I would do in those cases if I were you:

Personal Project Startups
If you’re spending your free time on a project, then your time is valuable. If you’re looking to learn about engineering, then spend time writing awesome code. If you’re looking to create a website that could potentially make you millions, then write something quick and don’t worry about the code. Keep in mind that if your project turns into a 300+ person company and you chose to write shitty code, then the chances of having to rewrite most of your code is high. I suppose there are worse problems, though, like spending hours upon hours on a project that doesn’t go anywhere ;). I think you should also consider your future when deciding on how you’re going to engineer your code. If you’re planning on being an engineer in the future, then spend the time to learn how to write awesome code. If you’re planning on being a PM or someone else more business oriented, then write inline code so you can get your product off the ground quickly.

I think that I should also touch on programming languages. Languages like PHP and Ruby on Rails are great for getting a site up and running quickly. Languages like JSP are great for learning about engineering, but that’s not to say that PHP and Rails can’t be used for good engineering practices.

Funded Startups
If there are more than a few programmers at a funded startup, then write good code. Your peers will appreciate it, and the programmers that will use your code in the future will appreciate it even more. If there are only a few programmers at a funder startup, then you can probably get away with writing bad code, but be prepared to improve it later. I think that if you’re getting paid, then there is no reason why you shouldn’t spend a little extra time to write good, robust code.

I’ve spoken to a few Redfin engineers, and most of them are insanely frustrated and annoyed with the terrible code that was written by some contractors back when Redfin was first started. We’ve had to refactor over and over again at Redfin because of that shit-ass code. I’ll save contractor work for another post, though.

I think that I approached helpd and Cellarspot in the right ways. My first project taught me great programming practices, and my second project made me realize that you shouldn’t always write good code. It’s up to you to decide how you want to engineer your startup.

Software Engineer Resources

Update: I removed the “disgusting” adjective from Eric’s inline code. I suppose that I view all inline code as disgusting, even though his inline code was beautiful. The other advantage to writing inline code is that you can avoid dealing with multiple files.  Eric also wanted me to be more precise and say that inline code is great for prototyping, which is exactly what we did with helpd. Sorry about that, Eric!

  • http://www.interactivefish.com Eric Fisher

    :^P love you too alex

  • http://dontexplain.com Clint Tseng

    I’ve tried to write the first sentence of this comment too many times, so I’ll just scratch the thing and be direct: I strongly disagree.

    I don’t believe that funding is the most critical issue in the development method that should be chosen for an individual project. There are too many factors to list, but I believe the most critical criteria differentiating the two projects you have listed here is scope; helpd is a far less complex app than cellarspot as far as I can tell, and I don’t imagine cellarspot would have done well coded in inline php. Poor coding or design choices will come back to bite at exponentially increasing degrees as the time spent on a project increases.

    In addition, the framework used in constructing the project is a critical factor; in what little I’ve seen of JSP, it’s far more time consuming to write and far easier to create terrible code for than a framework like Ruby on Rails, which is great for far more than prototyping (barring a number of performance issues).

    Overall, I don’t think sacrificing code quality in favor of super-agile development is ever worth it unless the project in question is extremely small-scale.

  • http://www.alexloddengaard.com alex

    I think you have a good point, Clint. I agree that a large difference between helpd and Cellarspot is their scope, but I still think that Cellarspot should have been developed with less complex code. I think my post is very black and white with regard to coding practices (inline vs. very layered), and I think that there is some gray area where a project of Cellarspot’s size would fall into if I were to pursue one in my free time. I also think that my opinion would change if I understood Ruby on Rails better, but I admit that I’ve never developed in that framework.

    I suppose my main hope was to get people thinking about time consumption and the reality of certain projects. Presumably funded companies are going to last a while, making good code much more valuable. Presumably personal projects probably won’t last a while, which means one of two things: either you learn how to write good code from the project or you get a prototype out fast so you don’t waste your time writing code that you’re not interested in learning from.

    Thanks for the feedback!

  • http://amitonstuff.wordpress.com alevy

    http://video.google.com/videoplay?docid=6297126166376226181&q=web+framework&pr=goog-sl

    Check out this video. I think that this guy, Sean Kelly. He talks about developing applications and the difference between UI development and otherwise.

    In the video he compares & contrasts some web frameworks (concluding that J2EE sucks… even with hibernate). The main take away for me is that the most important property of a UI framework is it’s ability to facilitate rapid deployment and, more importantly, rapid *re-deployment*.

    I think this is important.

    Should python/ruby/php/java code be written well always? Yes, but that doesn’t contradict fast development.
    Is python/ruby/php less robust than java? Yes, but it probably doesn’t matter.

    I have more to say, but this is probably too much for a comment. With the blessing of the congregation I’ve been inspired to continue my response in my *first post* in my blog…

  • Pingback: Better Web Application Development « Obfuscated Signals

  • Pingback: Alex Loddengaard’s Blog » A Second Look at Software Engineering a Startup