Skip to content

Instantly share code, notes, and snippets.

@nkabrown
Last active March 28, 2018 02:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nkabrown/4000930d419e5cd8fb3661f7842ee26e to your computer and use it in GitHub Desktop.
Save nkabrown/4000930d419e5cd8fb3661f7842ee26e to your computer and use it in GitHub Desktop.
The Pragmatic Programmer – Tip 2 Think! About Your Work – mental engagement

Mental Engagement

Tip 2 – Think! About Your Work

Who feels like programming requires a tireless mindfulness? It kinda does, which is why it's important to take breaks.

Here are a couple of ideas to try that will help you become a better thinker about your work.

Git commit message forecasting

First, read this short, but very good, article about git commit messages: https://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message

On my best days I follow this advice and I've written some beautiful commit messages. Most of the time my commit messages are not so great. It's good to take some time to reflect on what you've done and put that into a nice communication for those who come behind you (including the future you). But wouldn't it have been so much more helpful to think about this stuff before you started working on the commit. That is what commit message forecasting is all about.

When you are starting your work take those three questions from the article above and write your commit message first, then get to work implementing it.

  • Why is this change necessary?
  • How does it address the issue?
  • What side effects does this change have?

Code modeling

I love this maxim from Kent Beck:

Call your shot. Before you run code, predict out loud exactly what will happen.

We all need to move away from writing some code and then just running it to see what happens, making a little change and then running it again, repeat as much as necessary. Thinking through the code you write to the point where you are confident in what is going to happen is going to speed you up and help build your understanding and confidence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment