• 0 Posts
  • 12 Comments
Joined 1 year ago
cake
Cake day: June 16th, 2023

help-circle
  • IMO the best way to start in a new language is to rewrite some of your previous projects in that language.

    I generally start out by rewriting a couple simple 1-3 function console apps, basic leet code stuff like; palindrome, fizzbuzz, reverse an array in place, etc, and some simple unit tests for them. Then I go ahead and rewrite some of my previous projects or uni assignments in that language.

    At that point I generally have a good understanding of basics and have an idea of how to approach a new project. When I got to this point in rust I then started on threading, async, why it’s easy to return a String and an ordeal to return &str, etc.










  • My brain goblin is a big fan of performance. Recently I reviewed a teammate’s code. It was a small 100ish line PR and he calls the same function twice in a row with a tiny variation. My brain goblin went “you could consolidate these into one call”, “since it’s only one call you could inline it”.

    A couple hours later when he came to ask me what I’m smoking I realised my proposed solution had more LoC and was more complex to read. If we needed better performance, step 1 should’ve been to offload this task to an API that wasn’t made with python. Not to mention the next thing this API does is string manipulation and then write to file.