Ask HN: What was your most humbling learning moment?
532 pointsI've worked on large products for large and small companies and written tens of thousands of lines of code across my career, solving complex, abstract, challenging technical problems in a variety of languages on a variety of platforms, sometimes under difficult conditions. I have often been a resource for my friends and co-workers when they have programming or technical questions.
I only recently learned how to correctly raise and lower window blinds--I had been doing it wrong my entire life. It was maybe the dumbest I have ever felt, and was a humbling reminder of how much I don't know about how much I don't know.
Have you had similar experiences?
Comments (680) 153 threads
Show all comments
Showing thread 25 of 153
Unfortunately, the program was difficult to test (no unit tests) and very important, and difficult to verify correctness of output as well. (As in, you can't just look at it and say "yeah that's numbers lgtm").
Also unfortunately the previous author had not been very consistent in their programming style, so there was a lot of syntactic noise (some single line if statements used braces, some omitted them, etc)
Also unfortunately in my prior rewrite work in this, I had grafted the old UI onto my new backend to save time, but not brought the rigor there up to snuff (it's UI code, I had thought. It's well enough to have tests covering the business logic for now.)
Well anyway when I had rearranged some code, I hadn't realized there had been an extremely large block right underneath an if statement that wasn't using brackets, and I had accidentally split it into a few statements. N-1 of which were naturally now outside of the if statement.
The end result being that a bunch of code would run and the "is dirty" state worked fine, but if you clicked save on a "clean" state with no edits, it would blank the fields in the DB but not in the UI.
It didn't end up having any actual impact because we caught it in time, but god damn did it teach me something about "real" programming. I'm not sure exactly what all it taught me, but I think about that a lot as I do random other things now 8 years and 3 companies later.
Time to get into woodworking!
Make curly braces mandatory with a linter, of course!
Also, add tests before changing the thing.
There was an if that didn't need brackets when I wrote it. 6 months later it needed more stuff on a branch but i was tired and in a hurry so I didn't notice adding extra lines needs brackets. New code compiled but wasn't part of the if. Turned a 5 minute fix into 2 days.
Of course, all my ifs have had brackets on both sides since then.
Well, not in python...