Keep reading for FREE
"Don’t repeat yourself" (DRY) is usually good advice, but you have to get the abstractions right. Otherwise they quickly become unmaintainable.
Here's how it usually plays out:
Loop these steps a couple of times and you quickly get an unmaintainable mess.
If you find yourself passing parameters and adding conditional paths through shared code, the abstraction is wrong. It's no longer right for the codebase.
Wrong abstractions are no longer common abstractions; they are series of conditions mixed with vaguely related ideas. This makes them:
In the long run, it's better to fix wrong abstractions ASAP than to add more code and make everything more complicated.
Your goal is to remove the abstraction and conditionals, and to reduce each caller to only the code it needs. Here's how:
Once done, you can start anew, re-isolating duplication and re-extracting abstractions.
Start by implementing the problem in the concrete, not in the abstract. Don't try to guess what interfaces you will need. Discover them.
Only after implementing the problem in the concrete, go on to decoupling. Ask yourself: "What do I need to decouple to make it better, to allow it to deal with change as the data or business changes?".
Leaving the code in the concrete is also an option. Don't force abstractions when they are not necessary. Prefer duplication over the wrong abstraction because duplication is cheaper to deal with.
MORE LIKE THIS
4 Steps That'll Help You Cut Through the BS and Make a Hard Decision Faster
How I went from newbie to Software Engineer in 9 months while working full time
Ready for the next level?
Read Like a Pro
Explore the World’s
Take Your Ideas
Just press play and we take care of the words.
No Internet access? No problem. Within the mobile app, all your ideas are available, even when offline.
2 Million Stashers
Don’t look further if you love learning new things. A refreshing concept that provides quick ideas for busy thought leaders.
This app is LOADED with RELEVANT, HELPFUL, AND EDUCATIONAL material. It is creatively intellectual, yet minimal enough to not overstimulate and create a learning block. I am exceptionally impressed with this app!
Great interesting short snippets of informative articles. Highly recommended to anyone who loves information and lacks patience.
Best app ever! You heard it right. This app has helped me get back on my quest to get things done while equipping myself with knowledge everyday.
Great for quick bits of information and interesting ideas around whatever topics you are interested in. Visually, it looks great as well.
Even five minutes a day will improve your thinking. I've come across new ideas and learnt to improve existing ways to become more motivated, confident and happier.
Brilliant. It feels fresh and encouraging. So many interesting pieces of information that are just enough to absorb and apply. So happy I found this.
I have only been using it for a few days now, but I have found answers to questions I had never consciously formulated, or to problems I face everyday at work or at home. I wish I had found this earlier, highly recommended!
Read & Learn
Access to 200,000+ ideas
Access to the mobile app
Unlimited idea saving & library
Unlimited listening to ideas
Downloading & offline access
Claim Your Limited Offer
Get Deepstash Pro
75% OFF | 1-Year Pro Subscription