Loving the Little Things

2 minute read Published: 2021-03-13

I can only speak for myself, but I don't feel indifferent to the technologies and programming languages I use as a programmer. They're not just tools, but environments that either delight or frustrate me.

Some programming languages are frustrating to debug and make it more likely for me to implement specific bugs in my systems. Others are so rigid that maintaining code written in them is close to impossible.

When choosing the correct job offer, it's not enough to consider salary, benefits, domain, and the social environment.

What will you stare at all day? Will it make you tear your hair out?

My feelings around programming languages are usually strong. So when I dislike a language feature, I hate it with a passion. The opposite is also true. I love small details that make my work life just a little bit easier.

One such small thing that I like is Rust's field init shorthand syntax that you can use when variables and fields in a struct have the same name. Languages usually let you either use positional arguments OR named arguments. In some cases, they allow you to use both in specific combinations, like using positional arguments first in a constructor and then named arguments in whatever order after that. With the field init shorthand syntax, you can omit the field name if the variable that you're passing has the same name as it.

struct User {
  name: String,
  age: u8,
  country: CountryCode
}

fn create_norwegian(name: String, age: u8) -> User {
  User {
    name,
    country: CountryCode::No,
    age
  }
}

It's a delight not having to write name: name, but still get the clarity of named arguments when needed and the flexibility of rearranging the order of them how you'd like.

It's all about the little things.