Does your heart sink when you're asked to make "small changes" to your ASP.NET applications?
There's so much code; making "small" changes takes days and you're frustrated because you can't turn requests around quickly enough....
You know the feeling; a boss/customer/product owner calls and says:
"This is just a small change, I can't imagine it would take more than half an hour or so?"
And your heart sinks, because you know what these "small" tweaks actually entail.
You've done this dance many times before.
If you're lucky, you can locate the relevant ASP.NET controller, but you know that's only the start.
As you dive further and further through your application's layers into the depths of your codebase, you begin to question your life choices.
Wait, didn't I see this service already?
UserManagerFactory again?! Maybe the
3 hours later, you're knee-deep in your Data Access Layer, desperately trying to figure out where this "small tweak" needs to be made, wondering if it's lunchtime yet.
Do you need all those layers?
It doesn't have to be this way! You can skip a lot of this pain by leveraging the idea of "vertical slices".
When you build and architect your application around individual features, using vertical slices, magical things start to happen!
- You always know exactly where to look for the code that makes any given feature tick
- You get to work with (and write) simple code
- When it comes to implementing new features you get to focus on the feature (not mountains of boilerplate code)
- You can use tests to be confident your feature actually does what the user/customer wants it to do (imagine that!)
- You can get all your work done in a few hours and bunk off early (OK, maybe not, but it's good to dream...)
Discover vertical slices for yourself
I've been using vertical slices for several years now, and have come to really appreciate their simple, yet powerful elegance.
Now I'm delighted to share that experience with you so you can enjoy the feeling that comes from knowing you can turn any feature request into working software (and still understand the code when you come back to it in 6 months!)
"From Layers to Vertical Slices" will get you up and running in just a few hours. Read it today and you can start using vertical slices to simplify your code tomorrow.
Here's the complete contents listing for the book...
Just another Monday MorningPreview
Why your projects devolve into a hot messPreview
Conditional logic == harder to reason about the codePreview
One model, multiple usesPreview
Ever expanding classesPreview
Entropy will have its way...Preview
You have an "in"
You can see how "big" a feature is
See what features exist
Your focus is shifted!
Razor Pages does this already
Fall into the pit of success
Creating minimal structure (guide rails) with MediatR
More accurate terminology
Specific representation of your data
But where does the actual logic go?
Use MediatR to "send" your requests
Not just queries
Wire up the command
Encapsulate by feature
Single purpose models
Focus on your features
Refactor by feature
DRY is overrated
Storage is cheap, and context is key
Vertical slices all the way down
Wire up MediatR
Create your feature
Start with something simple
Migrate existing queries
Migrate existing commands
A word on testing vertical slices