Live data from Hacker News

Ask HN: Do you ever go back and admire a piece of code you wrote?

news.ycombinator.com

71–80 of 267 posts

Re: Ask HN: Do you ever go back and admire a piece of code you wrote?

#71
post #63

Yes! Some code reflects what the requirements demand, including error handling, and no more. The design is elegant in that it abstracts properly, is very readable and extensible. Periodically, when I'm feeling down about my abilities, I look over this code and smile. Often I look at my older code and recognize the stage of development as a coder that I was in. It's usually not cringe-worthy but it makes me pensive ab…

I read this after making my own post that starts the same. This sums up my thinking too so elegantly. There are so many aspects to code and how it gets written that inform the output that each needs to be viewed in the context of that. Was it time critical? Was it part of a legacy migration? Was it a complex problem?

The quality of the code doesn’t have to reflect the quality of the solution and we should celebrate the things we nail.

Re: Ask HN: Do you ever go back and admire a piece of code you wrote?

#74
I have some big programs that serve more as touchstones for me. I am familiar with the layout and I can see the various functions that work very well.

I tend to do a lot of ETL-like stuff, essentially tanks that roll in one direction relentlessly. If there is an uncaught exception, it gets Pokemon-caught because it is okay if that one row doesn't happen, I can examine the problem later. The tank must roll forward. Each problem encountered in the wild results in another chunk of armor.

Select techniques from different tanks are often handy.

Re: Ask HN: Do you ever go back and admire a piece of code you wrote?

#75
Not on purpose but sometimes I need to get back at an old project and it always takes a few minutes to get my mind around it's architecture again. Sometimes, as I re-understand why I did things a certain way, I get aha-moment and am sort-of proud I guess.

Re: Ask HN: Do you ever go back and admire a piece of code you wrote?

#76
Writing parsers with parser combinator libraries (personally, I use FParsec on F# and pyparsing on Python) feels like this all the time. I am especially happy about one doubly-recursive, parametric parser I had to write to handle an expression grammar of this kind:

     ::=  |  |  '+'  | ...
     ::=  | 
     ::=  '['  ']' 
     ::= ... (The parser is parametric in the parser for )
... without upsetting the F# typechecker.

Re: Ask HN: Do you ever go back and admire a piece of code you wrote?

#77

Programming isn't unique in allowing you swing between moods of "this feels great :D" and "I'm so dumb". (I think most people feel like either at times, even hours apart). But Fred Brooks makes a good point with: """The programmer, like the poet, works only slightly removed from pure thought-stuff. He builds his castles in the air, from air, creating by exertion of the imagination. Few media of creation are so flexib…

When I started my first programming job the CEO told me that programming is 59 minutes of feeling like an idiot and 1 minute of feeling like a genius. It's really stuck with me, and has so far proven true.

Re: Ask HN: Do you ever go back and admire a piece of code you wrote?

#78
Maybe in the first 6 months or so after writing it.

After that, I occasionally go back through old code asking "what have you done for ME lately?" and an eye towards dragging it behind the toolshed and going "Ole Yeller" on it.

My code has to continually prove its worth to me, or else it's gone. Code is a liability.

Re: Ask HN: Do you ever go back and admire a piece of code you wrote?

#79

What I like better is when you are bumbling through code you wrote a while ago trying to figure something out and there it is, a golden comment from past you, telling future you why you wrote shit this way. Usually it's some corner case or weirdness in an API you're calling.

Came here to say this - I almost never think much of the code I wrote. But when I see a moment in time that I took the care to do something for future me, it's almost the same as looking at an old photo of myself, and thinking, 'Hey, I didn't look half bad back then!"

Re: Ask HN: Do you ever go back and admire a piece of code you wrote?

#80
All the time.

The old joke is about us looking at code we wrote six months ago, and being horrified at what we see. And I've had more than my share of that.

But what's ALSO happened, many times, is I look at old code I wrote... and I'm IMPRESSED. Just blown away by the beautiful elegance and power of the abstractions I came up with, the sheer intelligence of the approach, the insight and lucidity oozing from the code.

"Wow, I wrote THAT?!" Because I was deep in a coding trance when I wrote it. So deep "in the zone", that when I come out, it's not easy to recapture where I was. Not even the next day, and certainly not months later.

Interesting how it works!

Post reply on HN