: Rust


Programming Languages

Mastery of a few languages helps progress careers faster. Switching focus between many languages is like trying to hit a bullseye on a target that is constantly moving.

I have been guilty of switching focus myself, as evidenced by my sandbox repo. At one point in time I genuinely planned on doing projects in each of these languages. No longer.

The following is a list of things to consider before deep diving into a new programming language. These factors lead companies to decide whether a programming language is worth their time or not. Outlining these considerations should show why Go and Rust have become popular recently.

Simple Networking Applications in Rust and Golang

The Premise

I wanted to be more comfortable and competent with the provided networking libraries in Rust and Golang. I figured implementing some simple client/server applications would be a great way to do this.

The Applications

Echo Server

I implemented a simple Echo Server and Client in both Rust and Go.

Here is the Rust source code

And here is the Go source code

Both implementations support the same functionality which is sending either TCP or UDP messages from a client to a server and having the server “echo” back whatever the client sent.

A Small Concurrency Example in Various Languages

The Premise

A common introduction to concurrency is the simple task of spawning two threads, then printing “ping” and “pong” in order N (N = 5 in the following examples) times.

This task is a light intoduction to synchronization primitives like mutexes and condition variables, or in more modern-concurrency models, channels / thread-safe queues.

I figured it’d be interesting to see what this task looks like in different programming languages, so I decided to code it in my four favorite programming languages (python, rust, golang, c++, in that order) to get a sense of their concurrency libraries.