Live data from Hacker News

Ask HN: What do you code when learning a new language/framework?

news.ycombinator.com

21–30 of 171 posts

Re: Ask HN: What do you code when learning a new language/framework?

#22
I'm an embedded/real-time/systems software developer. The realms I work in tend to be either the very small or the very large. When I wanted to learn Rust and Go, I coded the same application in both of them, one that I had previously coded in Java, C++, and C: I implemented the Generic Cell Rate Algorithm using a virtual scheduler. The GCRA is a traffic shaping algorithm that takes as parameters a desired peak rate, sustained rate, and maximum burst size, to meter or police traffic. I coded it as a library function, and provided a unit test to convince myself that it worked. I can only learn by doing, and that's what I did. One of the reasons I like this approach is it requires a lot of stuff: threads, synchronization, modularization, etc. https://coverclock.blogspot.com/2018/11/vamoose-rustler.html

Re: Ask HN: What do you code when learning a new language/framework?

#23
Find out what the most common domain is for that language. If that domain is unfamiliar to me, I try to find a good tutorial on building something in it. The self-correcting part is if the language is good for the domain 99/100 a times an excellent tutorial can be found on it.

I'm not gonna write a compiler in Rust, and I'm not gonna write a web server in Haskell (reading between the lines the opposite is true).

So just for example

Kotlin => a quick web app or a mobile app

Python => rewrite some bash script I've been meaning to improve, or write some statistical analysis with numpy

In the process I get to learn a new domain at the same time, and get to see what that looks like when an ecosystem actively tries to make it easier.

Of course sometimes it's good to try to use a language for something it's not commonly used for, and find out how much programming can suck when no-one has worked on smoothing out the edges.

Re: Ask HN: What do you code when learning a new language/framework?

#25
I use https://exercism.org/ with new languages to get a grasp on syntax and see examples that other people have submitted.

It's far from a true comprehension of the language, but it is really helpful to tackle problems that I've already done a few times in languages I am more familiar with to help relate concepts and highlight the differences.

Re: Ask HN: What do you code when learning a new language/framework?

#26
Backend web dev for the most part these days. Trying to simultaneously learn a language or system and produce something deployable has been a huge headache for me. I prefer to learn something new by starting at the beginning, with small exercises and study until I'm fluent enough to work on a real project without making bad mistakes from ignorance. The other approach, which everyone seems to expect, seems like madness to me.

If you're a good pianist and you have to learn the violin, I think it's best to start with scales and arpeggios just like any other beginner, except you go faster because your existing knowledge transfers to the new instrument. Trying to make your way through Beethoven's violin concerto starting on your first day with the violin seems to me like a ridiculous approach.

Re: Ask HN: What do you code when learning a new language/framework?

#27
Ray tracer or a simple roguelike.

I've got pretty good experience with both, so knowing the algorithms is helpful. Where it gets harder isn't the language itself, but usually the idioms for expressing certain concepts.

For example, Rust doesn't have default parameters, so the builder pattern is pretty common.

Re: Ask HN: What do you code when learning a new language/framework?

#28
First thing I do is looking for ways to execute machine code.

When that fails, because there's no non-exploity solution ... I drop it.

Otherwise, next, I look for easy multithreading.

Then I look for ways of plotting pixels on an easily available canvas.

Then I code an effect.

The last new language I've learned was python. For that one it was different. With no experience in python specifically, I've asked the friend, who recommended it to me, to give me a problem and I'll code him a solution.

I'm an autodidact and generally don't like using tutorials, papers and whatnot. Google is all I need. He wanted a webscraper ... and two hours later, after lots of fiddling around figuring out how the language works, I was done.

Then I made an effect. It was slow. D'uh. :-)

Re: Ask HN: What do you code when learning a new language/framework?

#30
automating the game I'm playing right now with plain old input simulation + image recognition.

This is how I started my career in the first place as a software engineer and this is how I continue learning new languages w/o the feeling to artificially build something useless

I usually start like that:

- add a mouse/keyboard emulator library, on the way you usually find out how good native system integrations are and how to integrate dependencies into your project

- write a brutally easy script of some mouse clicks/movements or similar to have something in place you can build on

- generalize the script

  - make use of basic code features like functions, code logic, abstractions
  - maybe add some math for screen resolution independent mouse movements ore more natural movements or typing events
  - have some basic idea of concurrency by waiting a random time before input events
- how about adding openCV or a similar screen capture tool? now you can capture a single color indicating a specific event to make things more interactive

- get more creative in what you want to detect

- figure out what are the limitations of the language of your choice, how many fps can you archive and what are the bottlenecks?

- when you are at this point you opened the door to an endless journey of adding more and more features and optimizing your code

the first steps are often just c&p from stackoverflow + some basic lookup from the documentation. with this approach you have a working prototype rather quickly and you are in full control on how fast and in what direction you want to go

by the time everything feels repetitive in what you are doing you probably already have a basic idea of the language and can decide on how or if to continue.

needles to say, don't spoil yours and others fun by applying this approach to PVP oriented games. also you will probably have a hard time since there are way more efficient ways + anti cheat tool will detect you

Post reply on HN