Seb De Deyne
Set a direction, and choose the tools you’ll need to get there. Don’t choose a direction based on the tools in your disposal.
… by chasing trends we would never be the ones to set them.
This one’s permanently stored in my Pinboard — a conversation I had this morning triggered a re-read.
“A user is only part of one team”. Until we decide to add multi-team support, and the
BelongsTo relation suddenly needs to be replaced in 50 places.
Golden advice from swyx:
It is a LOT easier to scale code from a cardinality of 2 to 3 than it is to refactor from a cardinality of 1 to 2.
A few weeks ago a spec change for an application we’re working on forced us to refactor part of the codebase. It was food for thought about the flexibility granular interfaces provide, and choosing the right abstraction at the right time. This is a short writeup on the thought process we went through as we updated our logic to support a new feature now and allow more options in the future.
Henrik Nyh suggests to make comments more resilient to change with double-entry bookkeeping.
- $timeoutMs = 1000; // Equals 1 second
+ $timeoutMs = 1000; // 1000ms equals 1 second
Whether the discrepancy is caught immediately by the author, or in review, or by another developer far down the line, it will be explicitly clear that the comment was not intended for the current value.
This lowers the odds that a comment will get out of sync, especially useful in configuration files.
For more context head to Henrik’s blog, The Pug Automatic.
RoyalSloth reviews the three most common patterns to model interconnected state in a user interface.
- Connect the boxes: create the user avatar component and pass its instance to the inventory table component
- Lift the state up: move the internal state of the user avatar component and the state of the inventory table into a separate box/class
- Introduce a message bus: connect the inventory table and the user avatar component to the shared pipe that is used for distributing events in the application
Connect the boxes and lift the state up seem to be the most common choices for React apps; respectively prop drilling and context or single state trees (like Redux).
There’s no silver bullet to UI complexity, all methods have their caveats.
Read the full article on blog.royalsloth.eu.
There are two bike stalls near my apartment. One is right in front of the door, the other around the corner. The one in front of the door is closest, so when I can, I store my bike there. However, most of the time that stall is full, and I need to go around the corner instead.
That’s fine. Until a next morning–when I’m still in a daze because I’m not a morning person–I take the walk around the corner, only to realise my bike was actually in front of the door. The day before was one of those lucky days I could store my bike in front of the door.
I quit using the front stall. The less choices I have to make, the more room I have for important things.
As developers, we often talk about the importance of learning. Learning is so important to us, that it’s worth persuing ways to improve the way we learn.
One way to become a better learner is to master the reverse: unlearning. Not the ability to completely forget, but the ability to set something aside for a brief moment.
When we learn a new language, framework, or tool, it’s hard not to dismiss new ideas based on our existing opinions. It’s the mental baggage we carry along all day.
What we’ve established as antipatterns in tool X’s, might be shiny tool Y’s bread & butter. That doesn’t mean we should dismiss tool Y. Ideas on their own are rarely good or bad, they need to be evaluated in a certain context.
My colleague Brent wrote a food-for-thought post about two different kinds of programmers: builders & architects.
The first ones, the builders, are the programmers who get things done. […] On the other hand there are architects. They are concerned about sturdy and structurally sound code. […]
These two types of programmers seem like opposites. They themselves look at the other group and often think exactly that. They have a different way of handling the same problems. The other group’s solutions are so different, they can’t possibly be right, or so it seems.
Builders often find architects too rigid and conservative. They follow the rules for the sake of following them, without any practical benefit. Architects in turn, think of builders as careless, too focused on results, instead of thinking about long-term maintainability.
Different programmers aside, “build vs. architect” is the eternal internal conflict when I want to make decisions. Striking a balance between “getting things done” and “getting things right” is tough.
Read the entire, beautifully illustrated post on stitcher.io.
By Fred Hebert:
- if you make the build tool simple, it won’t handle all the weird edge cases that exist out there
- if you want to handle the weird edge cases, you need to deviate from whatever norm you wanted to establish
- if you want ease of use for common defaults, the rules for common defaults must be shared between the tool and the users, who shape their systems to fit the tool’s expectations
- if you allow configuration or scripting, you give the users a way to specify the rules that must be shared, so the tool fits their systems
- if you want to keep the tool simple, you have to force your users to only play within the parameters that fit this simplicity
- if your users’ use cases don’t map well to your simplicity, they will build shims around your tool to attain their objectives
The endless loop of software development. Complexity is why what starts out as “a lightweight alternative to X” often ends up as bloated as X. Greenfield projects allow you to not care about the edge cases for a while, but complexity always catches up.
Read the full article on ferd.ca.
Dan Abramov shared a short post on some key principles the React team sticks to. Some solid general advice here, it’s not explicitly related to React.
Absorb the Complexity
Making React internals simple is not a goal. We are willing to make React internals complex if that complexity lets product developers keep their code easier to understand and modify.
Hacks, Then Idioms
We need to allow hacks using escape hatches, and observe which hacks people put in practice. Our job is to eventually provide an idiomatic solution for hacks that exist in the name of better user experience. Sometimes, a solution might take years. We prefer a flexible hack to entrenching a poor idiom.
These two stood out because they’re the opposite of how I generally need to think when building applications (although they make perfect sense in the context of something like a lower level framework). Either way, lots of food for thought in here.
Read all principles on overreacted.io.