Hacker News new | ask | show | jobs
by exsf0859 1671 days ago
AoC won't teach you anything about OOP.

The problems are designed to be solved in Python with less than 100 lines of code, by taking advantage of Python's extensive library of data structures and algorithms.

2 comments

quite strongly disagree with this. You can solve the problems with fewer than 100 lines of code, but you can certainly also take it as an opportunity to flesh your programs out in OOP style. In general, programming is about what you want to do and learn, and the problems aren't designed for any specific paradigm. A lot of people have taken Advent of Code as an opportunity to not lean on any external libraries for example.

There's numerous problems from board or combat game simulations, to mazes and the intcode computers that lend themselves to be approached in OOP style. The context OP is coming from is data science scripting, it's fine to start with small examples.

I did AoC2020 with C++ and did it in a enterprise, over-the-top, well-structured way. E.g. need to find two items whose prices sum up to 123? Implement a multidimensional knapsack just in case you need it later (spoiler: I did need it). If you take the time, and don't bother with the leaderboard, you might find AoC to be a really fun and engaging way to explore new concepts and solutions.
Yes, this is the way I do it as well. There were quite a few cases where I went all in with an apparently overengineered solution, and then I could use the code directly for the second problem with almost no changes.

I don't go for being the fastest or anything, I just want to do everything in a way that I like. Last year I did everything on the same day it got out; I plan to do the same this one, unless there is a particularly bullshitty problem that puts me off.