Live data from Hacker News

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

news.ycombinator.com

181–190 of 267 posts

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

#181
I used to do a fair amount of artsy stuff, and always stepped back to admire my work at multiple points in the process, as I suspect isn't uncommon among artists

Now at times when I have the space and time to code things the way I wanted, I step back and do the same :)

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

#182
post #156
post #96

Earlier quoted context omitted.

100%. It's amazing how many GitHub repos have little to no comments, not even file or function overview comments. The amount of time save by potential contributors reading and having to interpret the code is way longer than it would take for the author to write the comments in the first place. To each their own, but comments are generally a positive addition to code.

I find it's not useful to have comments in code that you are actively working on since they quickly get out of date. They are best added when one finishes work on a block of code.

At a previous job, when I transitioned off a few projects that I had solely worked on for 7 years, I warned the dev taking over from me: I don't usually comment my code, but when I do, you'd better pay attention.

I think in one of them, only a single source file (C++) had comments, and there were more comments than code. I was explaining an intricate locking pattern around a data cache.

Like you suggested, I added the comments after I'd done the work because it was a work in progress. I added the comments because it was a very fragile piece of code and sensitive to changes (e.g. really easy to cause a deadlock or race condition if changed).

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

#183

Way back, when Paul Graham first wrote "A plan for Spam", I was so intrigued upon first reading the article, that I jumped straight into coding. I happened to be hosting my own mail server at the time, and I had previously implemented a crude spam filter, but the important part is that all my emails were already stored in a database and (crudely) classified as spam or ham, so I had a corpus available for training the…

This sounds awesome. C is my preferred language and I use it whenever I can and when it makes sense. I'd love to see this code. Is there a public repo for it?

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

#184

Earlier quoted context omitted.

On a bit of a tangent here, but good commit messages are another thing I really appreciate 6 months later.

I love good commit messages as well, but it can be hard to convince people to write them. I always hear "Why? i don't use them" which is self propelling. You don't have good messages, so you don't read them when you want to know something, so you don't write good commit messages.

Another thing I like to put in commit messages is the ticket# (of what ever bug tracker you're using) of the feature/bug task that drove the change.

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

#185

I don't code, but I do write. I regularly re-read my own writing to spot any problems, but sometimes just for pleasure. For example, about 18 months ago I wrote a 5 part series on how to build a direct conversion receiver for the ham radio bands from scratch. I learned tons along the way and it was really rewarding to write. Re-reading it recaptures some of that joy and reminds me that I'm a good writer, even when I…

Never mind, I found it at miscdotgeek.

Thanks for checking it out! Here's the link for anyone else:

https://miscdotgeek.com/building-direct-conversion-receiver-...

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

#186
post #98

I've had the joy(?) of working for a company for close to 10 years, moving on to other work for about 5 years, and then returning again. During my first tour with the company I built, among other things: - (on a two-person team) an ASP.NET web app that allows payroll admins to extract year-end data from their AP in order to distribute tax forms (W-2s, 1099s, etc.) - (different two-person team) a mail-room management…

They're lucky (or cursed) to have had the same person build so many different systems at the company.

Ha! Too true on both counts.

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

#187
Sometimes my old code is “why did I over engineer this, it’s so hard to trace through”

Other times it’s “I think I really nailed the dev UX on this.”

These days I’m prioritizing more on conveying intent and proper use by name, location, and signature. And it seems to be supporting me back over the last two years oh my current codebase.

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

#189
post #156

Earlier quoted context omitted.

I find it's not useful to have comments in code that you are actively working on since they quickly get out of date. They are best added when one finishes work on a block of code.

I get the feeling, but I rarely think "I'm completely done now, time to comment!" Better to admit that and document a bit earlier than when it's "finished".

More accurate comments that way, isn't it. Nothing sadder than the optimistic comment from before implementation, which took the regular twisty path towards correctness in the corner cases. More of a risk for the higher level methods than the little "DRY" functions that do something relatively functional.

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

#190

Way back, when Paul Graham first wrote "A plan for Spam", I was so intrigued upon first reading the article, that I jumped straight into coding. I happened to be hosting my own mail server at the time, and I had previously implemented a crude spam filter, but the important part is that all my emails were already stored in a database and (crudely) classified as spam or ham, so I had a corpus available for training the…

This sounds awesome. C is my preferred language and I use it whenever I can and when it makes sense. I'd love to see this code. Is there a public repo for it?

Try go :) it's got the speed and "here's how the machine works" of C plus a) batteries included for all the modern things, and b) excellent multi-core scheduler.

On the grandparent, I never much wrote a ton of C and then compiled, did more "skeleton of the app/lower level bits/stich them together" incremental stuff. So lots of compiling and testing along the way. Not quite Lispy but Lispy for C.

Post reply on HN