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...
> All new lines must be executed at leaat once. What if you write a function in Go that's littered with the usual if err != nil { return err } and the error that's being propagated is hard to reproduce, e.g. a filesystem error? I never cover those "return err" in actual programs.
Ask HN: What habits make a programmer great?
61–70 of 191 posts
Re: Ask HN: What habits make a programmer great?
#62Re: Ask HN: What habits make a programmer great?
#63Focus 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.
This. I often encounter situations where a day or two were spent creating a mess of classes and abstractions, yet the actual logic to solve the problem still hasn't materialised. A defense about "code quality" or "not wanting to write spaghetti code" is often made. My recommendations for a problem you don't have a clear solution in mind for: 1) Hack some pseudo-code spaghetti together in a blank file until you think…
Re: Ask HN: What habits make a programmer great?
#64How does what I do benefit the customer? What happens with this if I die tomorrow?
You can code the most elegant, clever and beautiful code in your pet projects but in a professional setting major importance lies in delivering values to the customer and writing code which can be handed over to be maintained by your successor.
Re: Ask HN: What habits make a programmer great?
#65Earlier quoted context omitted.
Please, everyone who thinks, "I just expect correct inputs" take note of part two. I've had so many discussions with colleagues about that "Why don't you check for null pointers and give an error message?" "I think it's perfectly fine to just crash with a null pointer, I don't expect null pointers." That attitude hurts everyone who has to support what you write. edit: Reformatted as a habit "Make sure whatever you wr…
Only if a.) you can do something to recover from the null pointer or b.) you can provide more information about its cause than you could recover from an ordinary stack trace. Otherwise you're just adding code without changing the ultimate result of the NPE: a debugging session. Assertions, however, are great. If you can force the program to throw that NPE closer to the point where it actually illegitimately became nu…
And: Using a different language is always a great idea, but often not possible.
Re: Ask HN: What habits make a programmer great?
#66Meta-habit: learn to adopt different habits for different situations. With that in mind, some techniques I've found useful for various situations: "Researchey" green-field development for data-science-like problems: 1. If it can be done manually first, do it manually. You'll gain an intuition for how you might approach it. 2. Collect examples. Start with a spreadsheet of data that highlights the data you have availab…
> Don't ignore constant factors. Sometimes an algorithm with asymptotically worse performance will perform better in practice because it has much better cache locality.
Forget the cache, sometimes they're just plain faster (edit in response to comment: I mean faster for your use case). I've e.g. found that convolutions can be much faster with the naive algorithm than with an FFT in a pretty decent set of cases. (Edit: To be specific, these cases necessarily only occur for "sufficiently small" vectors, but it turned out that was a larger size than I expected.) Caching doesn't necessarily explain it I think, it can just simply be extra computation that doesn't end up paying off.
Re: Ask HN: What habits make a programmer great?
#67Earlier quoted context omitted.
> All new lines must be executed at leaat once. What if you write a function in Go that's littered with the usual if err != nil { return err } and the error that's being propagated is hard to reproduce, e.g. a filesystem error? I never cover those "return err" in actual programs.
Consider using a language that has exceptions instead of 1980's error codes
Re: Ask HN: What habits make a programmer great?
#68Re: Ask HN: What habits make a programmer great?
#69- Add value. Train yourself to only do things that add value. Value is loosely defined. It can be going the extra mile smashing that bug that everybody is complaining about. It can be whipping up a mind blowing demo to pull in that big customer. Nobody cares if you work 80 hours a week, but it's not adding any value. Get in the habit of working on things that bring value to others. - More communicating, less coding.…
"Value is loosely defined"
This is a really worthwhile thing to think about - not only creating value, but levering it up.
If you spend the time to work/find something out, demonstrate it to others. If you change someone else's code for the better, explain why.
Minimise the cost of organisational communication - operate transparently. Pro-actively communicate your status/progress and respond quickly and clearly to requests for such.
Boost others. Communicate success upward in terms of the team - even if you did it.
Re: Ask HN: What habits make a programmer great?
#70- Beginner's mind, with discretion
- Ability to avoid buzzwords / marketing mumbo jumbo and identifying true value (or lack of) of any tool
- Remembering you are here to solve a problem, beautiful code is not an end to itself
- Beautiful code is maintainable
- Maintainable code makes you productive
- Productivity is everything: The more problems you, can solve the better you are
- Personally, Hatha Yoga and certain related practices (Kriyas) have rejuvenated me every time I felt burnt out. I'm not a hippy new age shill and if you contact me, I'll share more information.