A few habits I've found that work well for me: 1. Start small, then extend. 2. Change one thing at a time. 3. Add logging and error handling early. 4. All new lines must be executed at least once. 5. Test the parts before the whole. 6. Fix the known errors, then see what’s left. Taken from here: https://henrikwarne.com/2015/04/16/lessons-learned-in-softwa...
Ask HN: What habits make a programmer great?
171–180 of 191 posts
Re: Ask HN: What habits make a programmer great?
#172Study the idioms of whatever language you are using. If you're writing production code, consistency is everything. Don't write anything surprising or clever - you'll just paint yourself into a corner later, and it'll be impossible to maintain. Boring code is good code. Take error handling really seriously. A program that can gracefully reject input with a detailed error message is far better than one that crashes mys…
Re: Ask HN: What habits make a programmer great?
#173Earlier quoted context omitted.
> * Practice empathy Any tips on how to do this? I don't often feel things for myself and it's even rarer to experience empathy at a level I can detect. I meditate to try to better understand and learn to detect my feelings, but haven't made much progress yet (I use Headspace).
Having pets and being a good pet owner really helps. They can't speak. You have to empathize with them to have any relationship with them. In social situations you'll end up reading body language and worrying about other's feelings without even thinking about it due to pet practice.
Re: Ask HN: What habits make a programmer great?
#174Re: Ask HN: What habits make a programmer great?
#175Re: Ask HN: What habits make a programmer great?
#176Focus on the problem and not the tools ceremony around it. Don't follow the herd and the hype. When given a problem, keep drilling the problem until it is absolutely clear to you and then only work on solution.
>keep drilling the problem until it is absolutely clear to you and then only work on solution. My experience has taught me the exact opposite: no amount of Google Docs or whiteboarding meetings will tell you what the real problems are, you're only going to find them when you start implementing. I got burned on my last project: we spent several weeks mostly talking and writing (English) about problems that turned out…
When you hear them say: "I need a modern site", don't start until you're clear why they want it. For example "My customers told me my site doesn't look very trustworthy" will lead to a different solution than "My site is too slow" or "My site doesn't work on mobile devices".
Once you know the customer's why, you are also better able to make decisions like "It's okay to lose 1% of the data in case of failure in order to have a simpler system", or "We only look at the results once a day anyway, so using batching is acceptable".
Re: Ask HN: What habits make a programmer great?
#177Study the idioms of whatever language you are using. If you're writing production code, consistency is everything. Don't write anything surprising or clever - you'll just paint yourself into a corner later, and it'll be impossible to maintain. Boring code is good code. Take error handling really seriously. A program that can gracefully reject input with a detailed error message is far better than one that crashes mys…
Think about your error handling best practices. Mine are: 1. Re-structure your logic so the error cannot happen 2. If you can't do 1, recover from the error silently and continue on with the program 3. If you can't do 2, handle the error gracefully and notify the user of what state is changed, letting them choose whether or not to continue 4. If you can't do 3, inform the user of what happened and ideally provide the…
I think that defensive programming is the worst way of dealing with errors. You are now silently diverging from your business requirements by making up data.
Re: Ask HN: What habits make a programmer great?
#178Depth. Every programmer I admire has worked on their chosen field for years. You can keep flitting between languages and frameworks, but mastery ultimately comes from hankering down on one thing and advancing our collective knowledge a bit further. You can achieve mastery in any field - it can be a business domain - as mundane as a Time Tracking or a Todo list app, or it can be a technical domain - like compilers or…
Re: Ask HN: What habits make a programmer great?
#1792. No magic configurations. No implicit behaviors. Every optional behavior should be explicitly opt-in or opt-out.
3. Treat one as a special case of many. You will thank yourself later when you would otherwise curse the day you were born.
Re: Ask HN: What habits make a programmer great?
#1801. Generous function level and inline comments that explain the rationale behind code organization / approach. Code can be self-documenting, but intentions are not. A great programmer will ensure future maintainers / contributors don't break something for lack of understanding the original context. 2. No magic configurations. No implicit behaviors. Every optional behavior should be explicitly opt-in or opt-out. 3. Tr…