Hacker News new | ask | show | jobs
by jhugo 1353 days ago
Huh. This is the first time I read this quote, but it resonates so well. Does anyone else program this way? I usually sit for a while thinking about the problem, write the program mentally, try out edge cases, sometimes rework the program a few times, then once I feel it's correct I type out all the code, with that phase taking much less time than the "mental work". I'd estimate my usual process is about 90% thought, 10% typing. Anecdotally, from some teams I've worked in, people often find this process quite strange.
11 comments

I'm the complete opposite. I'll think about the issue a little, but I'll just hack on it until it looks (and performs) right. Lots and lots of trial and error.

I draw the same way. My sketches are tons and tons of lines in the wrong places that somehow end up looking right, because the majority of the lines are near to or in the right places.

This is how I often program as well. I’ve realized that when you do this it’s crucial to have lots of tests to validate the program’s behavior, because it can easily look right and mostly run right without actually being correct.

Though this only works for the implementation side of things in my experience; you still need a good mental model of roughly what you’re aiming for architecturally, I think.

I have coded with a lot of people like this, and I think it is absolutely a fine way to approach things, and can even be good, but one piece of advice I always tell them:

The job has only started when it is working. That doesn't mean you're done! :)

Yes, knowing every detail of what I'm doing would bore me to death. I would rather "not know" and be amazed when the finished product, whether it be a loaf of bread, an application, or a sketch, emerge.
Yeah, I'm the same way. I never sit and think a long time - I prefer to think by doing, to externalize my thoughts so I can move it around, change things, see the thinking process in front of me as code and observable bahevior. Then I just keep shaping it until it becomes what I envisioned at the start. But then, where did that "vision" come from? Thinking over a long time, usually days and weeks, sometimes years.
Same - I can see the beginning and a partial end, but I find most of my ideas and inspiration occur once I get into it, and i can never see the final process to get there - it happens as I go.
It isn't strange, but I've found that writing code as I'm thinking helps me think about the problem.

Also, the domain is so large in programming, it is impossible for me to contextualize the entire set of edge cases. From remembering what exceptions to handle to library interactions, types, etc.. returned from various methods, it is just not really possible to think about even a small system this way (as in a system with 4-5 methods that perform real logic beyond "format this"

But, yeah - definitely large picture before I start to code. "Huh, yeah that calls that... ok.." but once I need to solve a problem "oh, this queue needs to be maintained this way... I need to compare these values against these values, oh, I need a second queue... I need to take this lock... oh this returns this type, which needs to be serialized so I need to figure that out..." - all of that stuff needs to be hashed out in a combination of paper & code. No way I can hold that in my head.

Kinda along those lines. What works best for me is to start with high level comments in plain English after thinking about what I'm trying to achieve for a bit. Then I make a skeleton of all the methods and classes that that will require. Then I'll comment each method (if not trivial) in plain English and only then actually begin development. The development phase seems to go by pretty quickly that way.

And as another plus, that makes my code very readable for others. I leave the comments in.

It depends. If it's an interesting problem I have to work on, but I can't right away, I think about it as I'm going about my day. Driving, cooking dinner, rotting in a meeting. Then by the time I get to finally do it, it's close to a fully-formed solution.

If it's a problem that I have to address right now, it's more like prototyping the first idea that comes to mind and then debugging and refining and being more critical.

Takes way too much RAM for my ADHD brain. If I work like that, solid concepts slip out of my grasp and I have to work them out all over again. Without writing things down, I miss obvious and important problems. Very envious of people who can maintain a large system in their head.
ADHD forces depth first search ("hyper focus") with a time penalty to avoid sinking too much into one effort. It's just a different search algorithm that will explore the problem landscape differently.
I find this the most effective way to do things as well, although at times I lack energy to do it properly, and end up banging away on the keyboard before I’ve properly thought things through (spending more net energy than if I’d done it properly, by the time I’m done).

Reminds me of Rich Hickey’s Hammock Driven Development https://github.com/matthiasn/talk-transcripts/blob/master/Hi...

> UTF-8 was designed, in front of my eyes, on a placemat in a New Jersey diner one night in September or so 1992.

https://www.cl.cam.ac.uk/~mgk25/ucs/utf-8-history.txt

Couple of nights ago I just sat and wrote out a small addition to a personal project.

Must have been less than 150 lines of C, but it was written in one go, compiled without warnings, and ran as expected.

Not even a forgotten comma, or an off-by-one.

I just sat there for five minutes enjoying the feeling of raw rarity.

The quote from Kim Jong Gi reminded me of the quote from Tesla (as well as other notes I've read) because it seems to indicate that they can visualize at extremely high detail and do this at very high speed... while also accurately retaining the information for use later.
Some writers work this way, mostly famously George Simenon, who was possibly the most prolific writer ever.
Corin Tellado's 4000 romance novels[1] would like a word. For reference, Simenon would be between Asimov and Stine on this list, I think.

[1] https://thebookslist.com/most-prolific-authors/

It's hard not to think that's a team writing secretly under an individual name.
Going off [1] and [2], it seems like she was definitely a lone writer but it also sounds like a lot of them were 75-100 pages - "[in 1962, Bruguera] offered her a contract to deliver a 76-page novel every week. This she did until Bruguera's collapse in 1985" which makes 23 years of 52 novels or about 1200.

[1] https://www.theguardian.com/books/2009/may/04/obituary-corin... [2] https://en.wikipedia.org/wiki/Cor%C3%ADn_Tellado

Well, its a comfy way to make water tight state machines? Is that the question?