WET your code now, and DRY it up later 💦
There are two fun acronyms that you can use to describe different ways of writing code:
- WET = Write Everything Twice
- DRY = Don't Repeat Yourself
WET code means that you have duplicate blocks which provide similar or the same functionality, and DRY enforces the opposite. Many developers love to preach for DRY code because in many large codebases, having duplicate code can be really messy to maintain later.
So should you really be striving for DRY code? Well, not from the start.
Get it WET
I didn't create this title just for convenience, it truly helps to start off with having some duplicate code.
Imagine that you're starting on a new project or feature and expect the scope to change for either business or technical reasons. Attempting to follow the DRY concept and thus creating abstractions early on to prevent duplicate code will decrease the flexibility of your code. This is not to say that the right abstraction cannot be made, but it's too easy to make the wrong one early on when you don't have a full understanding of what you're creating.
This also makes it a lot simpler to focus on the project or feature at hand, and not have to make architectural decisions.
Don't forget to DRY it
It's crucial that you factor in the time that will be required to refactor your code. Please don't skip this! Once you have a much fuller understanding of how everything should be functioning, you can create the necessary abstractions that may also be flexible enough for changes because you already had experience with that happening.
🗂 Tab Dump
- Instruments for Work - Movie soundtracks to promote getting your work done.
- State Machines Meet React Hooks - A talk by Zain Fathoni at JSConf Asia 2019.
- How to Build a Successful Brand in 2019 - Advice from Gary Vaynerchuk on business and personal branding.
- atomic-layout - Physical representation of layout composition to create declarative responsive layouts in React.
- create-index - Creates ES6 ./index.js file in target directories that imports and exports all sibling files and directories.
📅 Updates
I wasn't able to create any video content this week, but I did share a lot of tweets!
- 🎩 Working some magic on IronMic
- 📝 Shared some thoughts on building resumes
- 🕐 Inquired about balancing side projects with priorities
- Planning to finish out this small update on IronMic before starting the big V2 project! Also hope to get back on track with videos and articles this week.
- When I turn this newsletter issue into an article, I would love to expand with examples. Please feel free to share any overarchitected snippets of code due to early abstractions!
See you next Sunday, same inbox? 👋