Writing software is hard. Writing it well is even harder. I have been rolling some ideas around in my head on how to make software that is better for the people creating it and the people using it. Software has some distinct (and not-so-distinct) phases that it goes through as you work on it. The first of those phases for developers is the design phase. Here are some ideas on making better software during the design process.
If you start with “you know what would be cool?”, kill the idea.
OK, so maybe that’s a little harsh, but that’s my knee jerk reaction when I hear a “you know what would be cool” idea. Let me rephrase my suggestion; stop and think. You may be wondering what I have against doing cool things. Nothing. There’s nothing wrong with doing cool things. The problem is that we developers gravitate toward using a cool piece of technology for the sake of using it rather than finding the best fit for our problem. We often attempt to solve a problem either using a cool new piece of technology in a way that it wasn’t intended for, or new language features when an alternative would have been better suited. Redis, mongodb, rabbitmq, Python, Ruby, Clojure, Scala, Node.js are all great technologies that meet various needs in their own ways. Sometimes they may be the best fit for your problem, but not always. Just think twice when you think you’re about to do something “cool”. Developing software is less about being cool and more about building something that works well.
Aim for simplicity.
Software developers have a knack for building and stacking and inheriting and composing until the original simple solution is unrecognizable in a mound of clever engineering. When you’re thinking about the next piece of code that you’re going to write, start simple. Don’t build something in your mind that is more complex than it has to be. You should always use the simplest thing that works, except for when you shouldn’t. Next point.
The simplest solution isn’t always best.
Sometimes the simplest thing just won’t cut it. Sometimes you need that really weird class hierarchy or a really tricky algorithm or something that really hurts your brain to even think about. Usually this is going to happen on the second iteration of a problem. You should still always start with the simplest thing. If that doesn’t seem to hold up, go on to something more complicated, but keep the complexity to a minimum.
Don’t build more than you need.
It’s often tempting to try to build a solution that handles every contingency or meets the needs a user doesn’t even know what they have yet. When you are tempted to design everything into your application, think twice. Don’t design what you don’t need. If you can come up with a good reason for designing it in, then go for it. Otherwise, don’t bother. Build just what you need and no more.
I’ve seen so many developers (including myself) focus on getting something working now and neglect foreseeable issues with maintenance and deployment (which are the two major areas that this impacts). When you are thinking about the next piece of code that you are going to write, take the time to make sure you are focused on the long term solution. This may sound like it contradicts my previous idea of doing the simplest thing possible, but I think these ideas can co-exist. Start simple. Get something working. But don’t plan on getting it “justworking”; plan on getting it working so that the next generation of developers that work on it will be happy you made the decisions you did rather than having them curse your name.
These aren’t new thoughts. I’ve heard them stated by other experienced developers in various ways. And they’re not immutable laws of nature. I think they’re good guidelines, but the world won’t come crashing down on your ears if you do something different. But I do believe that your experience of designing software will benefit from it. And as a result, your software will be better for you and your customer.