Live data from Hacker News

Ask HN: What habits make a programmer great?

news.ycombinator.com

81–90 of 191 posts

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

#81
I'm old fashioned so I make a distinction between programming and software engineering.

If you want to become a great programmer: read. Read anything and everything you can get your hands. Don't just read books but also read code. Study the great programs written by other great programmers. Then write. Put what you learn into practice. Write some more. It's been said a great programmer can solve pretty much any problem in two weeks and if it takes more than two weeks it's impossible. Not exactly the truth but you should be able to sketch out solutions to even the most sophisticated problems fairly quickly. The intuition comes from your own experience but also because at that point you've learned how to learn -- if somebody asks you to solve X you're at least passingly familiar with system Y and Z that are sort of like X.

A great engineer is something else. This involves careful analysis and deep understanding of the domain. This involves knowledge and contribution to specialized academic and corporate research. This involves the ability to communicate clearly and succinctly. But mostly it involves a highly developed sense of the problems that your clients are actually trying to solve. The big part of it is actually being able to work with and manage a team to evolve a solution that exceeds the client's expectations.

It's rare to be both. These are the mythical "10xers" that can not only deliver innovative solutions but also create systems that make those around them more productive.

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

#82

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

Addition to Performance/2.: Synchronization costs are typically the biggest deal in applications that involve I/O (e.g. hard drive or network). Try an average database transaction with and without synchronization. 1) On sqlite3, it's dozens vs hundreds of milliseconds. Bigger databases, probably not much difference. 2) Lookup NFS sync issues. It's a huge speed/safety tradeoff. 3) On some file systems, a debian installation may take 10 minutes or 90 minutes depending on whether you disabled sync (eatmydata command).

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

#83

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.

Setting aside the fact that your question is loaded ("littered" with incorrect error handling--OK):

1. Return something meaningful, not the bare error you received above.

2. If you do nothing but decorate the error, ignore coverage. Having decorated the error helps debug the full system when the error occurs.

3. If your error handling is more complex (remove temporary files, close handler, etc.), you might want to factor the cleanup into its own function and test it there.

Finally, your code is not really "littered." If you had exceptions, there would be no trace of the possible errors that might occur on the production system. Your coverage will be higher, but when the software will blow up in production, it will not matter then least.

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

#84
I've been doing this for 29 years, and I've learnt two useful things. The first is that anything you don't know can be learnt, and if this is your career, probably will be learnt.

The second is that the hardest won skill is getting things done. Whether you hate doing them, have done the thing 1M times before, are bored, or otherwise lack motivation. Applying yourself - really applying yourself only becomes possible when you have a reason to.

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

#85
post #6

Earlier quoted context omitted.

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…

Suggesting that is all well and good, but surely the concern is that the process will inevitably end after 4), or even 1) since "it works" and there are other higher priorities?

That's a communication problem, I think. You should outline that something working is a prototype, not an end-product. That means it's not maintainable, hard to extend etc...

To convert from a prototype to an end-product, you need to do the other steps.

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

#86
From my 25+ years experience, the main quality for being called great is getting sh*t done. It is never easy because of distorted but still very human mental (tinkering, overthinking, underthinking), physical (laziness, low morale, disorders) and relational (team dynamics, managers, politics) habits.

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

#87

The "developer on fire" podcast closes out each episode by asking the guest to provide three tips for delivering more value. Some that occur frequently are: * Take care of yourself. Get enough sleep, exercise and healthy food. Have hobbies. * Constantly learn new stuff * Practice communication skills. Building stuff fast and well doesn't help if you're building the wrong thing, and you need communication skills to pr…

> * 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).

I frankly do not believe that instinctive empathy is always necessary. Instead, like another suggestion, read good fiction- but also read people's real stories. There's a documentary on the families affected by the Sandy Hook shooting- this was useful to me. There's lots of people writing about their lives in situations you'll never be able to be in. Read them when you can, try to understand them, take people at their word when they say they're experiencing things. Chances are, they don't really have a reason to fake or blow it up nearly as much as it may first seem, even if it seems irrational or incomprehensible at first. Humans are rarely totally without some context or reason to their perspective.

Note: I don't have empathy for myself very well, but my own behavior can tread bizarrely enough that I am forced to examine my own behavior in a way that can be explained to others reasonably. If you can explain others' behavior in this way that isn't condescending towards them, that takes all aspects into their behavior into account, you will come off as compassionate and empathetic regardless of how you feel in the situation. At least this has been my experience.

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

#88
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…

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…

This! I especially see this problem in Java, where IDEs always suggest catching an exception. Like a dog chasing cars, you really should think through what you're going to do when you catch one. I've wasted a lot of time debugging problems that get masked over by try/catch only to pop up at some later point in a seemingly unrelated part of the code.

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

#89
Hard to say any definite habits that work for everyone, as each person is so different, but just for the fun of it, I'll try to list habits that work for me:

* Keep a diary. Write out problems and solution propositions first, if the solution is not trivial.

* Keep your mind clean, always finish what you started, so you can have completion and not clutter your thought process. This means not leaving code in a state of disarray, should compile when returned back to

* Let go. If the solution does not propose itself, take a break. Sleep over it. The solution will come, with time, not by bruteforcing of overdosing caffeine. Sometimes these work too, but as a habit, better to focus on long term goals than short term successes.

* KEEP IT SIMPLE. KISS! When solution starts to look too complex, it probably is. Break it down, simplify, line by line, so that the code is understandable and easy to read. Write for humans to read, not for machines to parse.

* There is no ready made solution. Accept the fact that to get results, work must be done and days and even weeks might go before getting there.

* It's ok to write code that is not "smart", that is not "perfect", that just freaking works right now as should and expected. It's just code, and in the end it all transforms into zeros and ones. Implement new features gradually towards more flexible and standardized solutions, first find a solution for the problem at hand and remember KISS again.

Some of the main points that come to mind. Especially the point of KISS, is so easy to go overboard with, starting to overthink all kinds of fancy structs, class inherintance models, whatever fancy code-beauty around a solution that could be solved with a simple function and evolved later if needed to something more flexible.

This KISS also applies to general software design, user interfaces etc also, probably the most useful habit is to remember when thinking about systems, keep it simple! It should also be fun to write at least in some level, if it feels like crap, don't do it for your own sake.

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

#90
You will never get a group of programmers to agree on such a list. Like the old Jewish saying (paraphrased) for every 3 Rabbis there are 4 opinions. In the end you have to find something that you believe in but be willing to alter if something isn't working, assuming you can tell.
Post reply on HN