Learning from Giants #46
Color formats in CSS, An introduction to database sharding, and crucial professional advice: Get straight to the point.
👋 Hi, this is Mathias with your weekly drop of the 1% best, most actionable, and timeless resources to grow as an engineering or product leader. Handpicked from the best authors and companies. Guaranteed 100% OpenAI-free content.
Did a friend send this to you? Subscribe to get these weekly drops directly in your inbox. Read the archive for even more great content. Also: I share these articles daily on LinkedIn.
Color formats in CSS
"CSS has a whole slew of different color formats: hex codes, rgb(), hsl(), lch(), the list goes on!"
Yes - there is a world beyond #FFFFFF. One where dimensions and perception vary a lot.
"Which one should we use?"
First, RGB means Red / Green / Blue, using simple color blending with 256 different values for each color. And Hex is just the hexadecimal representation of the same thing: rgb(255,255,255) is the same as #FFFFFF.
HSL means Hue, Saturation, Lightness. It's an interesting and widely supported alternative to RGB. While it describes the same color space (more on that below), it does it with dimensions that make it easier for humans to reason with.
"Hue: This is the pigment we want to use. Valid values range from 0 to 360, and we specify it in degrees because the scale is circular (0deg and 360deg represent the same red hue)."
"Saturation: How much pigment is in the color? Valid values range from 0% to 100%. At 0%, there is no pigment in the color, and it's totally grayscale. At 100%, the color is as vibrant as possible."
"Lightness: how light/dark is the color? Valid values range from 0% to 100%. At 0%, the color is pitch black. At 100%, the color is pure white."
HSL is easier because these dimensions map perfectly with how we're thinking about colors. What takes tweaking R, G, and B with RGB can be easily achieved by changing just one of H, S, or L.
Yet RGB and HSL are just different notations for the same colors. If you have studied a little physics, you may know that 1) the color space is continuous, and 2) it's infinite and goes beyond what the average human eye can see.
"RGB doesn't come close to capturing the full range of colors the human eye is capable of seeing."
And with the incredibly advanced displays we now have access to, the RGB color space is starting to feel very limited. Most displays currently support broader color spaces. But browsers are late to the party.
Apple, among others, is pushing for new standards. They have added many to WebKit (Safari):
"P3 extends the standard sRGB color space, giving us access to brighter and more vibrant colors."
"LCH is a color format that aims to be perceptually uniform to humans. Two colors with an equivalent "lightness" value should feel equally light!"
📗 Josh Comeau's Color Formats in CSS introduces not only CSS color formats but many key concepts to understand colors. And as always with Josh, it's beautifully (and interactively) illustrated.
How does database sharding work?
Some of the greatest relational databases are single-server. PostgreSQL and MySQL are good examples. And while scaling that one server to Tbs of RAM can work (and should often be tried first), large businesses inevitably face that limit.
The solution? Scaling out, i.e., using more databases, is also called "Sharding".
▶︎ "Sharding helps you scale out your database by storing partitions of your data across multiple servers instead of putting everything on a single giant one."
There are many things to consider when going down the sharding path. Adding machines creates entropy, but if poorly designed, it can also slow core use cases.
Sharding turns your database into a distributed system. And like all distributed systems, you can't have it all; you'll need to make informed trade-offs.
Co-locating data drives performance.
Too many operations on the same shards ("Hotspots") create slowness.
Duplicating important data creates consistency challenges.
Beyond the short-term optimization, sharding must be optimized for operability. Maintenance of large sharded applications can introduce heavy toil and slow down your organization.
📗 Justin Gage's How does database sharding work? introduces the challenges and paths one can take to shard a database in simple terms. As it's a guest post on Planetscale's blog, it's slightly biased toward not sharding yourself. Yet, in my opinion, that bias is quite sound. One should only consider sharding themselves if a particular setup makes buying impossible. And if you are, then look at the open-source solutions before writing a single line of code!
Get straight to the point
Crucial advice to 10x your professional interactions and get instant feedback and answers from your leadership.
Waiting for a green light, a review, or a decision from a peer or manager considerably slows down your work. It can also be highly frustrating. Worse, they answered your colleague's message in 10 seconds, and it feels like they're ignoring yours.
James Stanier's advice is to get straight to the point. Long complex messages, unclear asks or next steps are the main reason your message moves from the answer directly to the read later bucket.
Here's their three-step framework to Get straight to the point:
"1. Make it clear up front what you want".
You can keep the additional context for the end of your message or presentation. What matters is making it clear to your peer what their role is.
"2. Make the next steps obvious."
The second reason people "Read later" or "Mark unread" your content is that they don't know what to do with it. "Can you read X?" is not actionable enough.
"If the other person knows exactly what you're after, they're far more likely to prioritise it and take action. You're making it so much easier for them."
"3. If you already have a recommendation, say it."
This is both about saving time and lowering the complexity for your audience. It's far easier to probe a solution than explore a problem.
"This is especially potent in decision meetings of any kind. Always say up front what your recommendation is. It will transform the meeting."
📗 James Stanier's Get straight to the point may sound obvious, but it can be a professional superpower when applied consistently.
"You'll be surprised how much faster you can get things done."