Ask HN: What is the coding exercise you use to explore a new language?
41–50 of 73 posts
Re: Ask HN: What is the coding exercise you use to explore a new language?
#42My "go to" for anything UI related is Connect 4.
Other than that I try to pick a game that fits the theme. Games are amazing because they have well defined business requirements with sufficient depth to really exercise your critical thinking skills.
Re: Ask HN: What is the coding exercise you use to explore a new language?
#43If one knows C++ then Peter Shirley's https://raytracing.github.io/books/RayTracingInOneWeekend.ht... is a pretty nice raytracer one can type in any language.
Re: Ask HN: What is the coding exercise you use to explore a new language?
#44I usually pick one of the ideas on my low-stakes "side quest" list that I maintain. Something that I won't mind if it never gets finished, or if I have to trash it and start over because of what I learned while building it the first time, now that I know the language better. I'm currently working on a RISC-V cycle-level simulator in Rust. While I'm picking up Rust, I really like the "rustlings" project that lets you…
Re: Ask HN: What is the coding exercise you use to explore a new language?
#45Functional -- writing an interpreter for a toy language,
Scripting -- Sudoku/Wordle solver with UI
Systems language with low-level hardware access -- OpenCV integration, driving I/O pins, web server.
For all of them, I also test access to native C/C++ libraries.
Re: Ask HN: What is the coding exercise you use to explore a new language?
#46By far the most trouble I ever have is getting soup-to-nuts deployment happening such that I can concentrate on fixing bugs without being scared shitless I won’t even be able get the damn thing running in production.
Re: Ask HN: What is the coding exercise you use to explore a new language?
#47It's a good introduction to handling input and output, string manipulation, error handling, abstractions for iteration (or lack thereof), and language performance characteristics. All while being a fairly easy task that can be implemented easily but performantly in 60 lines of Python: https://git.sr.ht/~wintershadows/polyglot-benchmarks/tree/ma...
It also lets you play around with different software architectures and abstraction models, introducing enough real-world complexity to prevent you from making too many assumptions, while the logic is simple enough to keep you from getting lost in deep algorithmic implementation.
I have started adding some of these implementations to a Git repo that I will eventually fill out with other "polyglot" comparisons. See here for (currently) Python, Nim, Perl, and (somewhat-overengineered) Common Lisp: https://git.sr.ht/~wintershadows/polyglot-benchmarks/tree/ma...
I have several more implementations that I haven't committed to Git yet, because I've been lazy.
I've learned a lot through this process, not just about individual programming languages, but also about "how things work" in the process of trying to figure out why Python is so much faster than every other language I've tried (on par with Nim, handily beating all others, haven't tried plain C yet).
Re: Ask HN: What is the coding exercise you use to explore a new language?
#48I typically write a raytracer while attempting to stick to a small set of "best-practices" for the language I'm trying to learn. I also use this exercise from time-to-time to test new language features (for example C++20 ranges/coroutines recently). I also recommend this same exercise to others through the book "The Ray Tracer Challenge" [1] by Jamis Buck, because it describes an entire implementation of a raytracer…
Re: Ask HN: What is the coding exercise you use to explore a new language?
#49I typically write a raytracer while attempting to stick to a small set of "best-practices" for the language I'm trying to learn. I also use this exercise from time-to-time to test new language features (for example C++20 ranges/coroutines recently). I also recommend this same exercise to others through the book "The Ray Tracer Challenge" [1] by Jamis Buck, because it describes an entire implementation of a raytracer…
I'm currently going through this book and it's amazing. Any tips on where to go once I finish it?
[1] http://www.raytracerchallenge.com/#bonus
[2] https://raytracing.github.io/
Re: Ask HN: What is the coding exercise you use to explore a new language?
#50I write a bittorrent node. It goes over many topics I'm interested in: potrntially low-level networking, storage, bits and bytes fiddling, concurrency. The protocol is shockingly simple, and the end result is both easily testable and actually useful.
This seems interesting. Any resources you can recommend for understanding the protocol? And any examples of simple clients in various languages?
I used to work on a fork of https://github.com/jackpal/Taipei-Torrent with custom features, I found its code to be easy enough to understand