Hacker News new | past | comments | ask | show | jobs | submit

Ask HN: What are your "great" programmer habits?

- Write meaningful commit messages

- Make systems as observable as possible. Stuff will break, the easier it is to identify the cause, the better. Logging things at different program flow points helps immensely.

- Question every decision in the codebase you are working on, but thoroughly weigh any refactoring attempts

- Don’t fall in love with own code

- Prefer readability over performance (in most cases)

- Don’t follow trends blindly. More than likely your boring stack is the best way to go

- Allow room to recover from a malformed system state

- Don’t abstract prematurely. If you struggle with designing your abstractions, you are probably good with concrete case(s) for now

1. Deeply understand the problem before you start writing code.

2. Provide in depth summary and explanation of the problem and solution in your PRs

Engineers can waste months or years of their collective time because they don't understand the problem they are trying to solve. They slap bandaids and fight wack-a-moles.

Both steps I listed above combat this issue.. the person(s) dedicated to solving the problem must understand the root issue with certainty. And when they explain their fix/solution it must be articulated well enough for other engineers or your future self to understand reliably.. else the mistakes of the past will be repeated.

loading story #42761875
1. Commit for half the sprint, then add one uncommitted item. Say, you have a 10 day sprint. You commit to 5 days of work. You add another item, but don't tell anyone.

Studies show the work takes about 1.8x the estimated time. But if you underestimate, then Parkinson's law fills out the time and the 1.8x rule still applies. The uncommitted item is there to combat Parkinson's Law.

2. Sketch a full plan before any code. Wireframe, which fields does this item fetch from, where is it stored in DB. Especially if you're either FE or BE, it prevents blind spots from either of you. You also want peripheral vision of the whole playing field and this is how you do it. Spend minimum time on this; all plans are meant to be thrown away. If you don't need it, it takes 5 mins.

3. (and to answer your q3) If you can't spare half an hour, then you need half a day. The more out of control things are, the more discipline you need. If you can't make it, then accept that you have lost and figure out how much ground you need to concede. Overextending is how you lose everything, burn yourself out and burn out your team.

- Take notes of past decision (what context, deadline, available skills on the team, compromises that had to be made...).

- MR/MR contains a ref to the ticket, an explanation of the changes, proof of work or way to test the change.

- Know how to leverage your tools (git, editor)

- Be curious [other languages, tools (formal methods, fuzzing..), fields (web if you embedded, or the other way around), maths ... ]

loading story #42761923
1. Keep notes.

Depending on context, that might be comments written on the ticket, a notes file (that I delete when I open a PR), or todo notes (with my initials) that I either resolve or defer to another ticket before opening a PR (and I have a `git todo` alias to find them all).

Partly this is just so I don’t have to rely so much on my memory. Partly this is communication to the rest of the team.

Sometimes I leave a comment on my ticket at the end of the day saying what I’d say about it in standup the next day. Which is good for me when I come back after the weekend, and good for the rest of the team if I spend a day or two off ill. It makes it easier for someone to pick up where I left off in my absence, if necessary.

2. Review my own PRs before I ask anyone else to.

If I can fix all the obvious nits before someone else looks at it, that frees them up to notice more fundamental issues that I’m blind to.

3. Commit early, commit often. Especially if I’m having a bad brain day.

loading story #42761899
Not doing things:

- work that is not needed

- risky changes

- low value to effort

- changes that cause unnecessary noise in the codebase

Don't forget the client. I have found it extremely useful to watch the client use our software, particularly when new features have been added.
like all trades of men

the most important skill i have

is showing up every day

That’s one of the crappiest quotes I’ve ever heard no offence, it just sounds self congratulatory and forced as if they hoped for it to be quoted.
{"deleted":true,"id":42760683,"parent":42760632,"time":1737314694,"type":"comment"}