It has some merit when you are comparing different solutions. For example (and I know people loathe python on here, I'm just using it for the sake of example, please bear with me), writing a simple web service in python takes fewer lines of code than doing the same in say, Rust.
This doesn't imply that a language is better than another, it's just an objective fact one might find useful to keep in mind.
The article's usage is admittedly clickbait, another recent article that popped up on the home page was titled something to the effect of "Speech Recognition in 100 lines of C++". Predictably, it turned out that they depend on a multi-million-line library.
But if you're importing in a library that might have 100,000 LoC just so that you can say you "wrote X in 12 LoC" ... is that really a far representation?
Yes, that's my point. What these articles do is effectively to "hijack" that metric.
This article is more honest, though. It only imports PyTorch and that is already mentioned in the title.
Re:Writing Snake in 12 Lines of PyTorch
by eliasffyksen on Thursday August 11, 2022 @02:56PM
(#32430173)
I wrote more for the fun of it than anything else. The challenge was just getting it as small as possible, just for the sake of it
I think that if someone can condense an algorithm using just a bunch of lines of code, that reflects a deep understanding of the problem domain. A lot of people can code an algorithm using a lot of lines of code. But it requires practice and experience to write short and expressive code. For example, Karpathy is famous for this, you can check his implementation of evolution strategies [1].
For example, in 1-line-of-code I can write "hello world". This hello world is physically lighting up individual pixels on my display. It's rendering the letters to be the shape "hello world" should be. It has antialiasing applied. All in 1 line of code!!!