Software Dev

Using Type Erasure to Build a Dependency Injecting Routing Framework in Swift

This post is just as weird and abstract as it sounds. 🀯 On first pass, I don’t get it. But I’m saving it here because I always like anything that promises easier dependency injection.

We’ll take an exciting look at how the treatment of methods/closures as properties can be used in this context to bypass one of the Swift Compiler’s most annoying compilation errors.

πŸ‘‰ Using Type Erasure to Build a Dependency Injecting Routing Framework in Swift

Type ErasureΒ is the process of abstracting constrained, generic types inside anΒ unconstrained non-generic typeΒ that can be passed around freely

Via iOS Dev Weekly.

Software Dev

Clean Code is Not the Goal πŸ€·πŸ»β€β™‚️

I want to thank this article for having the guts to say that basic working code is okay.

πŸ‘‰ Goodbye, Clean Code

As software developers, we all aim to write amazing, beautiful code. It’s part of what motivates us. But remember, the real goal is to ship something that people can use. And writing beautiful code isn’t necessarily what makes that happen (example).

Don’t be a clean code zealot. Clean code is not a goal.

This hit home for me after years working with an incredibly tedious and impractical code review process at a previous company. The reviews went way beyond sussing out bugs and tech debt and into opinions about the “right” approach for days on end. The team was unproductive and unhappy, and we still shipped plenty of bugs.

Sure, aim for great code. But there is a practical point where you need to let go and ship something that works.

Let clean code guide you. Then let it go.

As an engineer, yes, be elegant. But more than that, be practical. Voltaire put it elegantly πŸ˜† way back in the day.

Perfect is the enemy of good.

Voltaire

Via iOS Dev Weekly.

Software Dev

Duct Taped Software

I love this article on the ugliness of complicated (or not so complicated) software in the real world. A games goes open source, and developers are horrified by the code they see. πŸ˜±πŸ˜†

Beautiful. Disgusting.

I’m not surprised at all. Almost every successfully shipped system I’ve seen is full of really ugly code. At some point, you just have to ship that mother. πŸ€·πŸ»β€β™‚οΈ

πŸ‘‰ The truth is that many games are held together by duct tape

Via iOS Dev Weekly.

You

The Secrets to Happiness (Distilled)

I went to this talk by a Buddhist monk about happiness. I’m not a Buddhist, but one thing I like about Buddhism is that it’s more of a philosophy than a religion (from what I’ve seen). There was absolutely no talk of a religious greater power. And no attempt to convert anyone.

The talk was pretty simple, logical, and grounded in reality. It was basically just useful life hacks.

After the talk, I told a classmate, “That all seemed pretty simple.” And he said, “Simple to understand, but really hard to do,” So happiness is like chess in that sense. πŸ€·πŸ»β€β™‚οΈ

Anyways, here’s the quick guide to happiness, according to this class.


Happiness is about a peaceful internal state, i.e. a happy mind.

External rewards (like money, status, etc.) are fine, but they won’t give you lasting happiness. (I know this sounds self-righteous, but it is also self-evident. There’s nothing wrong with being rich, but we all know about rich people who are unhappy and poor people who are happy. πŸ™ƒ)

To reach an internal peaceful state, act on things you can control and don’t worry about things you can’t control.

If you can do something about it, don’t worry about it.

If you can’t do anything about it, don’t worry about.

Example: Stuck in traffic on the way to a doctor’s appointment? Call your doc and say you’re running late. If they can work you in later, great. If not, reschedule. Then relax and don’t worry about it. And don’t get mad at your fellow drivers. They’re all in the same situation as you.

Also, a happy mind is a clear, uncluttered mind. This is why mediation is so helpful. It is a quick way to clear out the clutter of your mind and reset to a more relaxed and productive state. It’s like cleaning out a cluttered closet.


And that’s it! Simple and hard, just like life.

πŸ’πŸ»β€β™‚οΈ As a side note, it’s funny that this guide to happiness comes from Buddhists, who say that life is suffering. There is something kind of perfect about the people who embrace suffering to be experts on happiness.

Me

Three Millions Steps

My Sweatcoin app, which I had reluctantly decided to allow tracking all my steps, reported to me that in 2019, I had walked over 3 millions steps, or the distance from Lubbock (Texas) to Rochester (New York).

This was cool to know, helped inspire me, and turned out to be a surprisingly delightful experience. πŸ˜€ It’s much better than the usual “medal” or fireworks for doing my regular workouts. Granted, there was a full-year buildup for the one.

My only complaint is that the distance shows up in kilometers. I know this is America-centric of me, but srsly, kilometers? πŸ™„πŸ˜† I had to convert them to miles on Google to get any real meaning out of it. πŸ€·πŸ»β€β™‚οΈ (It’s 1472 miles.)