I believe there is a moment of maturity in any developer's career. And it is related to critical mass of experience - when for pretty much any new task you know upfront how it should be done , at least architecturally. And in different variants: ideal, realistic or just to show something.
Ask HN: Do you ever go back and admire a piece of code you wrote?
241–250 of 267 posts
Re: Ask HN: Do you ever go back and admire a piece of code you wrote?
#242Programming 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…
Re: Ask HN: Do you ever go back and admire a piece of code you wrote?
#243Which (with ~1.5KB of binary data appended, total under 2KB) creates this: https://code.shishnet.org/videos/floating_point.mp4
I feel like my youthful stupidity unlocked a lot of potential - I managed to make a lot of impressive fragile hacks which only needed to work once, and worked once. These days if I tried to create an animation like the one above, I’d probably get a couple of thousand lines into writing a well-tested reusable framework, and get bored before seeing any results...
Re: Ask HN: Do you ever go back and admire a piece of code you wrote?
#244Earlier quoted context omitted.
> 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 wh…
I responded without reading anyone else's comments-- I'm so happy that my Past [name], Future [name], dialogue is something other people do! You're "other me" is the same as my "Past Jon" haha-- Remember to thank your "other me" and you should make sure to drop little notes addressed to your future self-- beacuse it is REALLY rewarding to find a note you left addressing your future self like "Hey, Future Self-- If yo…
“Of what others do you speak?” the Prodigy demanded.
Master Foo said: “All your future selves.”
Re: Ask HN: Do you ever go back and admire a piece of code you wrote?
#245Earlier quoted context omitted.
I’ll do comments first and then code. It’s a lot faster for me to keep a flow and pseudocode and then write the code in between. If the comments are two pedestrian afterwards (increment i), I will erase the comments. I started this technique early in my career back in the late 90s after reading “Code Complete”. It also helps me to pick back up faster if I get interrupted.
This sounds a lot like TDD, but with comments instead of tests. It's an interesting technique I never heard of. Do you ever get back to code you wrote and find a lot of misleading comments that you simply forgot to delete/update? Or are you always updating the comments before you try a new approach if the first one didn't work out?
//increment i
But also if the comment is something like: //Call the API to get a list of customers.
I’m going to replace it with List customers= GetCustomers();
Use the IDE to create a valid stub function and delete the comments. The method names become self documenting. At any point I have code that compiles.Re: Ask HN: Do you ever go back and admire a piece of code you wrote?
#246Sometimes 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.
I have this problem with a codebase I work on now. Basically, the program flow is: 1. Download file 2. Load file to local DB 3. Load local DB to cloud 4. Load cloud to different local DB 5. Generate file for other system. Really annoying, really over-engineered, and of course, undocumented. To boot, it also utilizes dependency injection because... There are no unit tests, no mocking, nothing. No reason to use DI othe…
You could also re-write the same code in C#, and have it perform even better than the hypothetical Python version, while being around the same length.
Re: Ask HN: Do you ever go back and admire a piece of code you wrote?
#247Re: Ask HN: Do you ever go back and admire a piece of code you wrote?
#248Earlier 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.
Yes, the greatest value add of comments for me is the potential time-saving, in the ideal case (re)acquainting you with a large work of code by guiding your attention from the top-down - firstly to orient you in the broad structural aspects, then to fly you smoothly down towards the minutae of reading individual lines of code. This does sometimes entail a few 'what'-style comments, so I'm disappointed to regularly re…
Re: Ask HN: Do you ever go back and admire a piece of code you wrote?
#249Earlier quoted context omitted.
Yes, the greatest value add of comments for me is the potential time-saving, in the ideal case (re)acquainting you with a large work of code by guiding your attention from the top-down - firstly to orient you in the broad structural aspects, then to fly you smoothly down towards the minutae of reading individual lines of code. This does sometimes entail a few 'what'-style comments, so I'm disappointed to regularly re…
Are they ‘what?’ or ‘wat?’ comments? Maybe that’s the difference?