You spent days on your JIRA ticket... only to be told to redo it after your team lead reviewed your code?
A few years ago, I was working on a hotel management tool. My team lead asked me to redo an apparently trivial task. I had to store emails before sending them. It wasn't a full rework, but I had to change my approach. We had completely different expectations from the same task. Two days of work almost wasted.
If I had only asked one single question before starting... "Hey, I'm doing it like this, are we on the same page?"
If you're like me, eager to jump into the code, confident in your solution, hold your horses and follow these four tips:
#1. Always ask why.
Don't start coding if you don't understand what needs to be doneโEspecially relevant these days of AI-assisted coding.
Before coding, ask:
- Why this task?
- What's the real problem?
- Why solve it now?
#2. Read the existing code before starting.
Your changes might be simple, unless you have to refactor some legacy code first.
If you rush to code without knowing that, you'll give the wrong impression you're taking too long on a simple task. Yes, estimates are hard.
#3. Outline your solution with comments.
Start by sketching your "coding" plan in comments. That's your blueprint.
Of course, once you're done, don't forget to delete the noisy comments. Remember: names over comments and types over names.
#4. Write a one-page spec.
Draft a summary of the changes you need to implement, just for yourself. It's for you to think clearly before writing a single line of code.
A simple question would have saved me from wasting two days of work. Make sure everyone agrees on your solution before you start. It could save you from building the wrong thing.
It's better to annoy people by asking too many questions than by making mistakes for not asking any questions at all.
Strive for context before coding. Always! Because typing isn't the hardest part of coding, but knowing what to type.
I cover 30 lessons like the one in this post in my book, Street-Smart Coding here. That's the roadmap I wish I had on my journey from junior to senior.
Top comments (0)