Hacker News new | ask | show | jobs
by cranium 1299 days ago
I really like how the Advent of Code is structured. Not only it makes you think about how to solve the problem, it pushes you to architecture your code defensively so when you get the new requirements in part 2, you have the least amount of code to change. I remember being bitten in a problem involving a keypad: I didn't think the keypad shape could change!
2 comments

I personally hate it. I wish they could just give a clear specification of what they want instead of putting it in the format of a story where some things are vague.
One person's "architecture your code defensively" is another person's "make a dumb solution so that you don't waste effort being smart".
To me, often the "dumb" solution is the modular one, because I can't design the entire solution at once, but I can parse this string into this format, and then I can find out whether this sequence is contained in the other, and then I can map some chars to a number, and then ah..! the solution is just calling these 3 functions in the right order. Part 2 is just swapping one of the functions out with the other, great.

Now this is simplified I know, but I'm not convinced in your proposed duality.