BrainsToBytes

Advice for new developers, or Things I wish I had known when I started programming, Part 7

Yepp, more things I wish I'd known when I started, 7th edition.

You can find the first article in the series here.

And the previous article here

Test your code

Writing tests is one of those things that you appreciate more as you gain experience.

In the beginning, it's hard to understand why we need tests. I know it works, how do I know it works? well, I wrote it so it works!

The experienced programmer has seen enough crashes and bugs to understand the value of writing tests. No amount of testing can indeed guarantee that your code is bug-free, but it can help you find some of the bugs already there. Finding these problems before your code hits production will save you lots of time and money: remember that the closer your code is to production, the more expensive it's to fix it.

Another great benefit of having tests in place is that it helps you improve the quality of your code. With good test coverage, performing big refactorings becomes easier and safer. You are more likely to move things around and re-write some sections of your code if you know that your tests will tell you if you broke something.

Testing code is important, so it doesn't matter if you write your tests before or after (even though I personally think the test-first approach offers more advantages). Invest in this skill and learn how to write good tests.

If you want to take this a step further, learn how to use continuous integration. This is a big topic, but it's one of the best ways of helping you create quality software products.

Improvement takes time

Developing software is hard, and it takes several years of effort to become good at it.

In this sense, it's no different from many other skills, like playing a musical instrument. It takes a good amount of time to master the huge amount of topics that a person needs to create great software. So, have patience and invest in improving your skills. Those little changes will add up and after some years you will become truly excellent at this.

Also, don't trust those 'Learn to program in X days/weeks' products to give you more than a superficial level of knowledge. Real mastery requires patience, effort and time, and those things don't have a replacement. Invest in the craft and in yourself, it's the only way towards mastery.

Sometimes this can be a bit frustrating. After all, you've been working hard at it for so long and you still feel like a beginner. Or perhaps you've been around for a while but feel like a mediocre programmer. It's fine, everyone feels like that at different points of their career, but I assure you it will get better if you work hard at improving.

Good software design is not about perfection, it's about flexibility

I used to think that software design was about building perfect programs.

In reality, software design's goal is not to create perfect code, it's to create code flexible enough to accommodate future changes. Remember that requirements are the force that shapes the functionality of your program. If those requirements are satisfied, the program does what it needs and can be called a success, but is that all we need?

Of course not. Software rarely stays static. New requirements will come and you will need to accommodate them in your code. If your program is well designed then the changes in your code will be proportional to the complexity of the new feature. In a poorly designed program, adding even small features can be extremely painful.

Software design is about keeping your code responsive and easy to extend. If your heavily shaped by the current requirements, you might be overfitting it and adding future changes might be too hard. At the end of the day, a good design is one that balances satisfying the current needs with the possibility of unknown changes in the future.

Oh but I also knew all these things.

It's ok, maybe in the next article, you'll find something you didn't know yet.

Thank you for reading, I hope you learned one or two new things or at least got something new to think about.

What to do next:

  • Share this article with friends and colleagues. Thank you for helping me reach people who might find this information useful.
  • Read the next article in the series.
  • You can find helpful books to continue investing in your carrer in the recommended reading list.
  • Send me an email with questions, comments or suggestions (it's in the About Me page). Come on, don't be shy!
Author image
Budapest, Hungary
Hey there, I'm Juan. A programmer currently living in Budapest. I believe in well-engineered solutions, clean code and sharing knowledge. Thanks for reading, I hope you find my articles useful!