Live data from Hacker News

Ask HN: What habits make a programmer great?

news.ycombinator.com

161–170 of 191 posts

Re: Ask HN: What habits make a programmer great?

#161

Focus 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 to be trivial, and got totally blindsided by problems that were not detectable until we actually connected to the firehose of incoming data (it's a streaming/analytical system) and then verified our work. There were lots of subtleties in the way a small portion of messages could be related over days and weeks. Nothing we would have been able to forsee with unit tests or manual inspection. We had to actually write the program to find out what would be hard about it.

Re: Ask HN: What habits make a programmer great?

#162
Don't think you are smart. Remember that you are average and that for everyone who you might think you are smarter than there is someone else who is equally smarter than you.

You will move in the direction you face. If you look down on people your skill will diminish. If you look up to people your skill will improve.

Be a dilettante. Do general study of many different fields but recognize the limitations of your knowledge and show the appropriate respect to specialists and experts in their respective fields.

Pay close attention to your errors. Do root cause analysis on every error you make and formulate a plan of action to avoid it in the future.

Analyze your own habits and the habits of your peers. Seek to adopt practices that work for others where possible but only if they prove to work for you as well.

Re: Ask HN: What habits make a programmer great?

#163

Earlier quoted context omitted.

Thanks for these notes! I reformatted this in a Google Doc, if anybody wants: https://docs.google.com/document/d/1Pix3-l3Qz1aLOuxoiiP1PTV6...

Could you put a link back to the original source in the doc? That way you capture the comments & discussion, which has a bunch of useful clarifications.

There is a link to your comment thread in the footer. I'll add link to the entire OP as well.

Re: Ask HN: What habits make a programmer great?

#164
post #125

1. Embrace the grind. Motivation comes and goes, but the grind remains. This doesn't mean working all day every day, but rather setting aside specific blocks of time and doing the same thing every single day. Workouts should happen at the same time every day. Work should happen at the same time every day. Each of these things should be daily habits and doing them at the same time every day helps them become habits. 2…

This is some pretty odd advice. Basically it amounts to "stop doing things that you enjoy". Drop music, news, and video games? Not listening to music will not make you a better programmer. I agree about sugar in moderation and getting good rest (though the specific times seem debatable).

#2 is a serious misunderstanding of flow[0] and is against research arguing that flow states facilitate learning[1].

Flow is not easy-peasy non-frustration time, it is getting "fully immersed in a feeling of energized focus, full involvement, and enjoyment in the process of the activity." To deny yourself that is blocking yourself from the most productive and rewarding of human experiences.

One of the fundamental ideas of flow is that when the task is challenging enough to break one out of the state, additional skills are learned to return to the flow state.[2]

In my opinion, to achieve your maximum potential as a programmer, you should be striving to hit a flow state as much as possible.

[0]: https://en.wikipedia.org/wiki/Flow_(psychology)#Education

[1]: https://www.learning-theories.com/flow-csikszentmihalyi.html

[2]: https://www.amazon.com/Flow-Psychology-Experience-Perennial-...

Re: Ask HN: What habits make a programmer great?

#165
post #17

Study 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…

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…

This is what Martin Fowler refers to as the Tolerant Reader pattern. https://martinfowler.com/bliki/TolerantReader.html

Code should tolerate all sorts of bad inputs. Code should produce pristine outputs.

Just like being a model member of society

Re: Ask HN: What habits make a programmer great?

#166

Earlier 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.

I sometimes temporarily modify the program by for example misspelling a file name of a data base column name just to provoke an error that will execute the error handling code. Or changing a condition from == to != to cause an exception. Not ideal, but at least the new code is executed at least once, so I see that it executes as expected. Creating tests for some of these cases would involve mocking things out, and th…

>I sometimes temporarily modify the program by for example misspelling a file name of a data base column name just to provoke an error that will execute the error handling code.

Yes, a lot of things like that are possible. I remember in one client-server project I worked on, we unplugged the network cable from one PC (while the program was communicating between client and server), to see if we got the correct error message that we had written for that case. And did other stuff like that.

Re: Ask HN: What habits make a programmer great?

#167
post #165
post #17

Earlier 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…

This is what Martin Fowler refers to as the Tolerant Reader pattern. https://martinfowler.com/bliki/TolerantReader.html Code should tolerate all sorts of bad inputs. Code should produce pristine outputs. Just like being a model member of society

I think I read somewhere that Jonathan Postel (Internet pioneer) also had a rule advising that.

Googled and found it:

https://en.wikipedia.org/wiki/Robustness_principle

https://en.wikipedia.org/wiki/Jon_Postel

"In his lifetime he was known as the "god[2] of the Internet" for his comprehensive influence on the medium."

Re: Ask HN: What habits make a programmer great?

#168
post #139

Earlier quoted context omitted.

Can you elaborate on point 3 ( Music part).

Recorded music is great. I listen to recorded music all the time when I'm at the gym or at the office. I use it to set the mood. I use it to fill the silence. I use it to block out office noise. But here's the big question: could you go a week without listening to any recorded music at all? You'd be surprised how many people try to stop and find themselves feeling symptoms of withdrawal. That implies some form of psy…

Exception state: Music helps with chronic fatigue/pain. If you're one of the unlucky ones, go with any and all effective pain management.

By all means, make your Skinner cage to lengthen assumed times for rewards, but make sure you can still run.

Post reply on HN