5 months ago 🥁 for day 130, 2021 with 468 words.

Debugging

Exercise: Walk around WalMart (& Michaels)
Piano Song of the day: James Bond Theme (much better)


A lot of developers seem to think that learning the latest frameworks, or learning the latest features of their favorite language makes them a better developer. Using code formatters to make their code adhere to some pretty standard. Watching endless videos, or reading endless articles.

After decades of writing code I'm here to tell you it isn't. The best way to get better at writing code is to write code. But that is only really a small part of it. You have to show your code to other people, and you have to accept that other people will say things about your code that you don't want to hear. But listen anyway, it is - generally - for your own good.

You also need to read other peoples code, good examples that is. Yeah I know that that is a hard bar to judge if you can't recognize that your own code is not great quality.

Here are some other things you can do that are more important than new frameworks. Do design! First! Work out how you are going to implement it, first. Work out the logic, first, the data structures, the flow, the modularization, how much could be reused later. Do as much of that as you can first. Then when you have worked out all the logic, flow, data structures etc, then you can do the easy part, you can write your code.

And while you are writing it, work out how you are going to test it. What functional tests are you going to write that will test every path through your code. Will test all the exceptions, all the error handling. As you are writing the code, write down the things that you'll need to test so you can have a script to check off that you have cracked all the functionality in all the different variations that it can happen. Then do those functional tests.

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
          - Brian W. Kernighan

Whatever you do, get really good at debugging, REALLY REALLY good. You will be doing a lot of it. Sometimes your code, sometimes code you have never seen before - which is like your own code 7 days after you wrote it. Learn techniques. Get a good book on debugging philosophy, one that doesn't talk about any particular language, one that talks about how to play detective with code and data.

And get REALLY REALLY good at it. Be twice as good at debugging than writing code.

dreamer

Start writing today, for free

Write Together is a safe space to blog, think, feel, and share together. Learn to write, or find a new home for your words, and join our passionate community.

Sign up Learn more
User Photo

By Yorick Phoenix 🥁

Chief WriteTogether Bug Finder & character stringer. Generally, to create computer code, but sometimes actual words and paragraphs. Listens to lots of music, takes lots of photos, & invests in stocks for the long haul.

Get Yorick Phoenix's newsletter

Almost there! Check your inbox and click the link to confirm.

Subscribe to Yorick Phoenix's latest writing to get it right in your inbox.