Programming Practices – How to Pay More Attention to Detail as a Developer

problem solvingprogramming practices

Are there any resources for paying more attention to detail as a software developer? (Especially edge cases, or small mistakes in code, details in the problem description, ramifications for certain changes to a large system)

Some thoughts so far:
– Books of some sort?
– Exercise of some sort (e.g. just solving math problems [a professor during undergrad mentioned math teaches attention to detail..although another said assembly language programming teaches detail too…])?
– Some type of method for decomposing problems/thinking to force attention to every detail?
– Some way of noting down details so as not to forget them later

Example of what I mean:

Someone said a good question to ask a prospective developer how many 7's between 0 and 100. I did it quickly and thought of 10, forgetting about 70-76 and 78-79. Basically it's just a lack of attention to detail….

Another example is during a white board coding interview, there was an easy problem and while the initial version was correct, as we kept making it more efficient I kept making more and more small mistakes. Once pointed out it was easy for me to fix them, but it was embarrassing to have them pointed out by the interviewer instead of me finding the issues on my own and fixing them.

Another example is just compiling code. Initially I would write code, go over it once before compiling and catch many errors. Now I miss many more errors and the compiler (or interpreter) finds many more errors than it used to.

Also I noticed that when I first came out of undergrad it was much easier to hang onto tons of detail where as now even the detail that I initially knew I seem to forget more as time goes on. Which is why in addition to paying attention to detail for new problems I could also use resources for keeping track of detail from older problems without having to rely on memory.

Best Answer

  1. Slow down. Think before you speak. Practice checking your work, even when it's all in your head. Everybody makes mistakes, especially in a stressful situation like an interview, but you'll make fewer of them if you give yourself time to think. Most people, including interviewers, appreciate a thoughtful answer more than a speedy one.

  2. If an interviewer asks you a question with an obvious answer, pause for a moment and consider whether that's the only answer. The 7's question could be answered a number of ways:

    • 20: That's the number of times the digit '7' occurs between 0 and 100.
    • 1: Only one of the numbers between 0 and 100 is 7.
    • 14: If you divide the numbers between 0 and 100 into groups of 7, you get 14 plus a few extra.
    • Infinitely many: I'll let you figure out why.
  3. There are plenty of books out there to help you improve your memory but when it comes to code, it's better to spend time writing code that's as clear as possible than to try to memorize all the details. If your code is easy to understand, you don't have to remember all the details. Take that a step further: If you have to remember details about the code in order to understand it, the code should be rewritten until that's no longer necessary.

Related Topic