Live data from Hacker News

Ask HN: Can you be a good programmer if you are not details oriented?

news.ycombinator.com

21–27 of 27 posts

Re: Ask HN: Can you be a good programmer if you are not details oriented?

#21
It's going to be difficult, but that goes for nearly any endeavor, in my experience. That being said, I'm not sure whether attention to detail is an innate skill, or something that has been honed to a keen edge by repeated failures. I know that most of the things that I do while programming that could be described as detail-oriented are more the result of the experience of getting burned by a particular edge case than anything else.

If a reference can possibly be null, check it before you use it.

When comparing things like URLs and URIs that are supposed to be functionally equivalent regardless of case, use a case-insensitive comparison like string.equals("a", "A", StringComparison.InvariantCultureIgnoreCase) or even "a".ToUpper()=="A".ToUpper(), rather than the default "a"=="A".

The Javascript === vs == shitshow.

Floating point equality without an epsilon value.

Remembering to put in the # or . prefix when trying to select an element by id or class in css/jQuery selectors.

Understanding when database calls are actually triggered using your ORM of choice.

Using thread-safe containers when collections can be modified on one thread while they are being iterated over on another.

Treating rm -rf with extreme care.

After you run into an embarrassing bug that makes you look incompetent because you failed to account properly for these things, you develop a certain amount of OCD about it and internalize the checks. At least you should, or else you just end up making the same mistakes over and over. Of course, things can always fail in new and unexpected ways, so you are always adding to your corpus of fail.

As a last note, an incredibly help for me has been using static analysis tools that are built into tools like Resharper, Webstorm, IntelliJ, (basically anything made by JetBrains), Javascript linters, etc. You can offload a lot of the burden of correctness checking for the more trivial errors and gotchas to the machine, and focus on higher-level issues.

Re: Ask HN: Can you be a good programmer if you are not details oriented?

#22
post #10

Try not to say "I am not X". I find that when I start thinking: "I will get better at X", it motivates me a lot more. I think when I say "I am not X" I unconsciously blame it on my nature and see it as something that I cannot correct and have to live with. A subtle change in attitude about yourself can go a long way.

Thanks for your comment :), some good advice like this sometimes makes me wonder why I never thought about it in that way.

Re: Ask HN: Can you be a good programmer if you are not details oriented?

#23
I think it's useful to point out that, much like with any other written language, there are two collaborative processes at play here--reading for understanding, and proofreading/editing. As someone who has a lot of 'detail' trouble (I miss a lot of detail in day-to-day life), but who is also a writer, editor and programmer--there's most-certainly a lot of room for improvement. I'll talk about writing for a bit before I bring this back to programming.

Many writers have a miserable time proofreading their own work--and it's this way because they already have a strong mental model of what they wrote. When our brain already has a strong model, it can hide a lot of detail from us. It's really just trying to help free our attention for _new_ detail, but in cases like this it causes problems. I suspect you're having trouble finding these minor issues in your own code, and I also suspect you'd find them more readily in code you aren't familiar with (if you're proficient at reading code you didn't write--itself a muscle that must be developed.)

My perception is that the biggest component of developing the ability to proofread my own writing was learning to edit other people's writing in a very exacting manner. Other people write differently than you do; when you edit them in an exacting manner, you're strengthening processes for applying arbitrary rules, deciding which arbitrary rules are worth enforcing, and building your own sense of style. When you just do this to yourself, it can take longer for you to develop strong opinions, because you aren't forced to encounter all of the mistakes and tics other writers make. Getting pissed off at all of the annoying shit other writers do will provide both the eye and motivation to attack your own writing with a scalpel. Learning to admire perfect pacing, metaphors, structure and word-choice will slowly prepare you to realize when you fall short. From there, it can help to apply what you've learned to older writing that you're less familiar with; the gap you need to read yourself clearly will shrink.

In programming, I think the most succinct analog to this process is refactoring other people's code (note: I didn't say rewrite. Avoid that temptation.) Likewise, it's also really useful to refactor your own code once it has become unfamiliar; you'll both realize how you've grown, and identify some of your own annoying tendencies. When you invest time in activities like this, you're building strong models of where things should be, and how they should be done. You'll cope with common problems, and develop a sense of how code can be written to make those mistakes harder to make in the first place, and easier to spot when you do.

I realize I haven't said a word about finding stray semicolons or an errant bracket, yet, but my point is: there are classes of mistake that are much easier to find when you're reading like an editor than when you're reading like a programmer.

Re: Ask HN: Can you be a good programmer if you are not details oriented?

#24
I find I write less code nowadays that makes me go WTF later but it still happens ("The only valid measurement of code quality is WTFs/minute" [1])

Probably the best thing you can do is seek out code reviewers, as they find problems (and they will) try to become aware of patterns in your mistakes and then focus on eliminating those.

[1] http://www.osnews.com/story/19266/WTFs_m

Re: Ask HN: Can you be a good programmer if you are not details oriented?

#25
You must pay attention to the details if you will ever become a good programmer (not necessarily the same as being detail-oriented). This may mean different things depending on context: designing a system? The implementation details aren't very relevant yet. Building the system? Those details become very important.

I've been programming for over 20 years and I've come to think the two most important factors contributing to a "good" programmer are communication skill and attention to detail (both of which can be learned, though some seem innately good at both at the outset).

For example: let's say you are reviewing someone's code. You notice they've missed some null checks, haven't properly handled exceptions or ignore some failure cases, aren't doing object comparisons properly, etc. They insist the code works fine (if you're putting up untested code for review, you should be beaten), but those little things now consume the reviewer's valuable time and head-space when they should have been sorted out before the review was ever posted. As the reviewer, you get caught up in an endless stream of niggling little details and nitpicking, rather than focussing on the logic and design and structure of the code. Meanwhile, the programmer feels very productive ("hey, I've just churned out a whole new module") and moved on to the next task, essentially relying on everyone else to finish his job.

Missing some things like this now and then doesn't make one a bad programmer, but consistently neglecting/forgetting them implies a lack of attention to detail and makes me wonder what else they're missing that I'm just not seeing (slog through several hundred lines in a code review and you will inevitably start missing things (http://www.ibm.com/developerworks/rational/library/11-proven... )). It also creates a lot of busy-work churn for the whole team that has to deal with that code. They may seem to be very productive, but they're actually dragging down the overall productivity of the team because everyone else has to point out the little things that were missed, as well as most likely re-review the code once all the small-detail changes have been made.

EDIT: fixed link

Re: Ask HN: Can you be a good programmer if you are not details oriented?

#26
I would argue from a productivity perspective: yes. If you were like me, you would get bogged down "in the weeds" fixing every single little bug encountered, no matter the time investment or how trivial, and wouldn't ship as much. It's productivity self-bikeshedding / developer "gold plating" in a way that I'm probably avoiding "real" work. By being semi strategically-lazy, it's possible to get more done.

So based on personal style, it's possible to get better by walking a middle path of not too crappy and not over-crafted.

(The real work is the stuff that needs doing or somehow seems "most important.")

Post reply on HN