Now at times when I have the space and time to code things the way I wanted, I step back and do the same :)
Ask HN: Do you ever go back and admire a piece of code you wrote?
181–190 of 267 posts
Re: Ask HN: Do you ever go back and admire a piece of code you wrote?
#182Earlier 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.
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?
#183Way 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…
Re: Ask HN: Do you ever go back and admire a piece of code you wrote?
#184Earlier 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.
Re: Ask HN: Do you ever go back and admire a piece of code you wrote?
#185I 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.
https://miscdotgeek.com/building-direct-conversion-receiver-...
Re: Ask HN: Do you ever go back and admire a piece of code you wrote?
#186I'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.
Re: Ask HN: Do you ever go back and admire a piece of code you wrote?
#187Other 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?
#188Re: Ask HN: Do you ever go back and admire a piece of code you wrote?
#189Earlier 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".
Re: Ask HN: Do you ever go back and admire a piece of code you wrote?
#190Way 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?
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.