←back to thread

165 points fzliu | 3 comments | | HN request time: 0.472s | source
Show context
joshlemer ◴[] No.41844227[source]
I've been thinking recently about how things like Project Euler, LeetCode, and to a bit less of an extent, Advent of Code, are so heavily focused on making clever use of math, data structures and algorithms, that it makes them suboptimal as a tools for getting familiar with a new programming language.

I know that that critique isn't new to anyone but it makes me think about how it would be cool if there were a code puzzler site that is specifically geared towards little self-contained tasks that are more to do with forcing you to get familiar with the common everyday tasks of software development.

Some example puzzlers could be like:

- open an http server on port 80

- open a file and write this data to it

- write temporary files to a location, deleting them when process exits

- query a database

- deal with such and such error scenario

- find a way to test this component

- bundle this code as an executable

- sanitize user input here

- make this behavior configurable

- take the config from environment variable variable and/or config file and/or arguments

- parse this data file

You do get a bit of parsing and file handling with Advent of Code but imagine a series of dozens of small problems that grill you on every corner of the python filesystem api. Would be a lot less dry than reading docs cover to cover.

replies(13): >>41844284 #>>41844312 #>>41844322 #>>41844599 #>>41844778 #>>41844869 #>>41844936 #>>41845344 #>>41845862 #>>41846052 #>>41847536 #>>41847980 #>>41851069 #
110jawefopiwa ◴[] No.41844936[source]
> Advent of Code, are so heavily focused on making clever use of math, data structures and algorithms

I've done a fair amount of Advent of Code and I wouldn't say it's at all "focused" on this. The vast majority of the questions use hash tables and graph traversal as the full extent of their use of math/DS/algos.

There's always one or two puzzles every year that require some particular math/CS insight but most of them just need you to know BFS and/or how to write a parser.

Your examples are also not bad, but they seem to be primarily concerned with "getting familiar with a new programming language" in the context of writing a web server, which is one of the parts of programming I try to stay away from. Most of your examples require less familiarity with the language's features and more with libraries you might use, which is less interesting to me personally (then again, I'm a PL fan and I write compilers for a living).

Meanwhile, I like AoC because I've used language features to take the fairly straightforward potential implementations and write them more elegantly in the language I choose. e.g. I use Monads in Haskell, or use Rust's easy threading to parallelize solutions, etc.

For me, learning a new programming language is largely uninteresting unless it changes the fundamental "shape" I think in, rather than what the exact names of the libraries I use change to. e.g. I already know Java so I'm not really going to bother "learning" C#. I already know Python so I don't really bother diving deep into Ruby, etc. However, I learn Haskell, Rust, Forth, Erlang, Scheme, etc.

replies(2): >>41845552 #>>41851063 #
1. fulafel ◴[] No.41845552[source]
AoC is still is algorithms and data structures: there's minimal interaction with the outside world, just solving the problem for the input data. It's just about coming up with the algorithm yourself instead of applying fancy well-known ones.
replies(2): >>41846536 #>>41847175 #
2. wodenokoto ◴[] No.41846536[source]
> It's just about coming up with the algorithm yourself instead of applying fancy well-known ones.

Isn’t that the whole fun?

3. cabidaher ◴[] No.41847175[source]
> just solving the problem for the input data

I think a lot of people here would be surprised how much of a step up this is from classic leetcode or DSA stuff. I have been involved in introducing people to AoC and helping them and the amount of people who have basic knowledge of algorithms but struggled to parse the input from a file was a little shocking to me at first. Of course, I do not blame anyone for not knowing something, classic academic courses can be misguided sometimes.

This doesn't negate the fact that there is somewhat of a lack in problems with more outside world interaction and it would be cool to see more of that.