Why every developer needs to read Algorithms to Live By
In this blog post, I talk about one of my favourite books. Written by Brian Christian and Tom Griffiths, Algorithms to Live By takes the concepts of computer science and applies them to everyday life. But, this book is not just for computer nerds, it's for anyone looking to make the most of their time and resources. Whether you're a developer, a student, or just someone trying to figure out how to adult, this book has got you covered.
Balancing Comfort and Adventure
“Life is a balance between novelty and tradition, between the latest and the greatest, between taking risks and savouring what we know and love”
This book talks about the Explore/Exploit tradeoff which is essentially the decision of whether to stick with what you know works or try something new.
Picture this: you're at a restaurant, menu in hand, faced with a classic dilemma. Do you go for your go-to favourite dish or take a leap and try something new?
This is where the regret minimisation framework can help you. It's all about considering potential regrets down the line. Imagine yourself in the future and ask, "Will I regret not trying that new dish or mixing up my workout routine?" By weighing the potential outcomes and aiming to minimise regrets, you'll make choices that strike the perfect balance between sticking with what you know and embracing exciting new experiences.
The magic of 37
Another important concept in the book is the "optimal stopping" problem, which is the question of when to stop looking for something and settle for what you've found. It's like searching for that perfect youtube video to watch while having dinner, at some point, you just have to accept that this is as good as it's going to get. But here's the good news: you don't have to leave it to chance! Enter the 37% rule, a powerful concept that can help you optimise your decision-making in situations like these.
So, what exactly is the 37% rule you ask? Well, it's a strategy that suggests you should explore the first 37% of your options without committing to any of them, and then choose the next option that's better than anything you've seen so far.
So when finding something to watch, decide how much time you’re willing to search for a video before hand then spend the first 37% of that time exploring options. After this period, choose the next video that’s better than what you've seen before. This simple yet powerful concept can be applied to various aspects of life, from job searches to apartment hunting to online dating.
Optimising Your Errand Runs
Running errands can be a time-consuming task, but you can make it more efficient with the help of the "Traveling Salesman" problem, a classic algorithmic challenge. Just like how this problem aims to find the shortest route to visit multiple cities, you can apply the same principle to optimise your errand runs.
Plan your route in advance, grouping errands that are in close proximity to each other, and avoid backtracking. This way, you can save time, fuel, and energy while checking off your to-do list like a pro! Say goodbye to zig-zagging across town and hello to a more optimised and streamlined errand-running adventure!
The Art of Scheduling
“Identify blockers, beware of context switching overheads and use heuristics to identify which tasks to complete first. Don’t stress about it - starting in the wrong order is better than not starting at all!”
Imagine your day as a game where you juggle a never-ending list of tasks. It's like playing Tetris with deadlines and priorities instead of colourful blocks. But fear not! This book introduces you to the art of scheduling and a secret weapon called Weighted Shortest Processing Time (WSPT).
With WSPT, you calculate the importance of a task by dividing its significance by the time it'll take to complete. If that resulting figure is higher than what you're currently working on, switch gears and jump into the new task. It's like strategically placing the most critical pieces in Tetris to clear lines faster. By applying this scheduling magic to your to-do list, you'll conquer your day like a pro.
Decluttering Your Desk
Think of your desk as a computer's cache, a place where you keep your most frequently used items for quick access. But remember, just like a computer, your desk has limited space and needs efficient management. In computer science, the Least Recently Used (LRU) algorithm is a strategy that discards the least recently used items first when the cache is full.
Now, let's apply this to your desk. You keep the tools you use often like your laptop or a favourite pen on the desk for easy access. But what happens when your desk starts to look like a cluttered mess?
That's when you apply the LRU principle. Start by removing items that you haven't used in a while. This way, your desk remains organised, and you can work more efficiently because the tools you need most are always within reach. Just like the LRU algorithm keeps a computer running smoothly by managing its cache, you can keep your workspace tidy and efficient by applying the same principle.
Conclusion
Algorithms to Live By is a must-read for developers and non-developers alike. It's informative, funny, and full of practical advice. And who knows, maybe you'll even discover the algorithm for finding the perfect cup of coffee. So go forth and optimise, both in your code and in your life!