Skip to main content

Don't Build it Yourself

This post discusses the whether to buy or build software components needed for your application. The title should give you a clue as to which side of the discussion I land on.

Someone Else's Code

One of the behaviors that I've noticed is significantly more often exhibited by junior developers versus more experienced ones is the tendency to build everything from scratch. While I can appreciate the enthusiasm for wanting to create something better than has been done before, this is often simply a waste of time. For many of the software tasks you will want to accomplish, someone will have made a library of framework that does 95% of what you want out of the box, lets you configure or extend it to do another 4.9%, and you come to realize that 0.1% remaining wasn't all that important anyway. In fact, with the proliferation of open source software, many of these software packages are 100% customizable because you have access to all of the source code and can change it at will.

Using someone else's code (in compliance with the license agreement) is one of the best optimizations you can make in terms of efficiently getting a software product out of the door or even getting an automation script for your own purposes up and running. I have learned this lesson the hard way, and it took me several experiences to really begin to grasp the concept. Here are a few case in point examples:

Case Studies (or Mistakes I've Made)

Android Game Development

Using code from a book as a starting point, I once implemented significant portions of a game engine to run on Android for a school project. My team ended up with a sort-of-working, clunky-looking version of the classic game Breakout. Another team used an existing game engine framework, and produced a really polished platform game starring a cute little penguin. Their game looked like it could have been put in the Google Play store and actually made some sales. Ours looked like garbage that people would have demanded a refund for even if they had acquired it for free.

They had the same amount of time to develop their game as we had, and while I don't know for certain, I strongly suspect they expended little to no more effort than we did and did not have significantly greater skill than we did. Much of their success was gained by starting much further along by building on someone else's framework.

Matrix Multiplication in Python

I've filed this in the really stupid ideas folder. I implemented matrix multiplication and some other statistical functions in Python. It was very challenging to get it right, and I spent many hours doing it. I am sure there are still some inputs for which the code I wrote will break. You should never do this, especially not in Python, which has a huge standard library and over 100,000 packages that can each be acquired with a single command. If you ever need to multiply matrices in Python, just install Numpy and be done with it.

Synchronizing Animations with Music for Mobile Apps

To code synchronized animations with music, I used basic 2D drawing methods to draw different frames in a cyclical animation. I set up my own timer to fire off events at intervals I manually calculated based off of the beats per minute rate of the music. The code was brittle and inefficient. It worked sometimes until a change needed to be made, and then it would break, requiring hours of debugging and rework to get it running again. Again, don't do this. Use one of the many frameworks available for 2D animation.

Buy Instead of Build

As much as we learn these lessons over time, that charm of creating from whole cloth is often still lurking. We're software developers, and we take pride in our abilities and in our work. We're often tempted to think we can build something from scratch to better suit our needs and do it as well or better than what is readily available.

Often this is a fallacy in and of itself. Really, think about it! There are companies that are wholly dedicated to building a given library, framework, backend or middleware product. They have dozens, sometimes hundreds of developers working on these products full time for years. The company itself may have decades of experience building similar products such that they have learned what works and what doesn't and all of the pitfalls to avoid because they have fallen into them before. Do you really believe that you, or your small team, will be able to create something better given that it is only going to represent a small portion of the overall product you are trying to build, and that you only have a proportional amount of time and resources to spend building it yourself?

Some Math Worth Doing Yourself

You also can't justify building it yourself economically. Your time is valuable; you should value it. Let's say you are a developer making $50 an hour. Perhaps there is a library that will be very useful to your application. You can invest 500 hours, or about 3 months of work, developing it yourself from scratch. The cost of this would be $25,000. Conversely, you could spend 175 hours, or about 1 month, configuring and integrating a third-party library to do the same job. This will cost $8,750 plus whatever you must pay for the third-party library. For a library of this scale, you can probably find it for free. Even if not, it is extremely unlikely you would need to pay in excess of $1,000 for it. The bottom line is that your time is the expensive part. The ready-made software is cheap.

This is because the cost of software is allayed by distribution. Developing software is far more costly than we would often like to admit, but distributing it is extremely inexpensive compared to other products. When you develop your library for $25,000, your product is the only benefactor, so the cost for your product to consume the library is $25,000. When someone else builds the library, they can distribute it to many different users at almost no additional cost. If it costs them $75,000 to build the library, but they distribute it to 10,000 users at $10 each, they are money ahead. You will also be money ahead if you buy and use their $10 product rather than spending $25,000 worth of your time to build your own version.

The Bottom, Bottom Line

Focus on the aspects of your project that are unique to your project. If you find yourself spending a significant amount of time writing utility code or the like that has a more general flavor to it, spend a little time searching to see if someone else has already done the work for you. You can save yourself thousands of hours over the long run by doing this.


Popular posts from this blog

When All Else Fails, Use the GUI

In this blog post, I show you how I automated entering credit card transactions in QuickBooks using the PyAutoGUI package for Python. Automating routine tasks is a great way to save yourself a lot of time. Whenever I spend a significant amount of time doing a partiuclar task on a computer, I ask myself if there is a way to automate it. Generally, as long as the input to the task is located on the computer, the answer is yes. The kinds of tasks that evade automation are those that have some kind of physical medium as an imput. While there are technologies that could help automate those tasks, it is much more complicated and difficult to do so. For tasks that can be automated, my favorite language for doing so is Python. Python has a wonderfully readable, expressive syntax, and there are an astoundingly large number of libraries and packages available that make the job of automating jobs much easier. One of my favorite simple examples of how Python saved me a lot of time is when I

The $10,000,000 Question

Neal Ford posed a question on Dave Rael's Developer on Fire podcast. He asked whether if you were offered $10,000,000 on the condition that you could never write another line of code for the rest of your life, would you take it? I'll leave it to you to go listen to the podcast if you want to hear Neal answer his own question, but you can have my answer here. Why Take the Money For me, and probably a lot of other people, the purpose of accepting the money would be to gain freedom. Having a sufficient amount of money with which one could live out the rest of one's life comfortably changes one's perspective and position considerably. With $10,000,000, I would no longer need to work. That's probably obvious, but considering how much of our time is spent working in and on our careers, that's an enormous gain. All of that time comes back to me because I am no longer compelled by necessity to go out and earn a living through labor. The Value of Work The difficu

Books That Have Influenced Me and Why

A mantra that I often repeat to myself is, "Don't abandon the behaviors and habits that made you successful." I believe this trap is actually much easier to fall into than most people realize. You can sometimes observe it in the context of a professional sporting event such as American football. One team might dominate the game, playing exceptionally well for the first three quarters. Then, as they sit with a comfortable lead, you see a shift in their strategy. They start to play more conservatively, running the ball more often than they had. Their defense shifts to a "prevent" formation, designed to emphasize stopping any big plays by the other team while putting less pressure on the short game. The leading team often looks awkward in this mode. They have switched their perspective from that of pursuing victory to that of avoiding defeat. They have stopped executing in the way that gained them the lead in the first place. I have seen more than one game ult