Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Vertical Slices in .NET
Bojan Veljanovski, CTO at HASELT
1
What is an user’s intent in software?
2
User Intent - Reads and Writes
- WRITE is a request modeled as COMMAND triggered via HTTP POST
- READ is a request modeled...
User Intent - CQRS
CQRS is a simple pattern,
writing and reading data is placed
in 2 separate classes which have single re...
DISCLAIMER
Nope… there is no silver bullet.
5
What we are going to talk about
- Overview
- Horizontal vs. Vertical user stories
- Horizontal vs. Vertical slices
- Comma...
“Two“ starting points to build a system
- Horizontal first
- Vertical first
7
Horizontal vs. Vertical user stories
- Horizontal
- Story 1: Create the new DB Table for Users
- Story 2: Create the DAL t...
Horizontal vs. Vertical user stories
- Horizontal
- Implement the database layer for A, B and C
- Implement the business l...
Horizontal slicing is not natural in agile
- Changes usually happen vertically
- You limit your application to the same ho...
“Slicing” is a team organization thing too!
11
Vertical Slices over Horizontal Slices
- Horizontal slices is organization by technical layers.
- Vertical slices is organ...
Vertical Slicing: The Stakeholder
Stakeholders talk and eat the cake in vertical slices.
They want one delicious piece at ...
Horizontal Slices
14
Horizontal Slices (2)
15
Horizontal Slices (3)
16
Vertical Slices
17
Organization structure
18
19
20
Addressing cross-cutting concerns
- Loggers
- Validators
- Transactions
21
ASP.NET MVC - Feature Folders ViewEngine
22
ASP.NET MVC - Feature Folders ViewEngine
23
Slide intentionally blank...
24
Can it easily evolve to CQRS?
25
Can it easily evolve to SOA/Microservices?
26
SUMMARY: Characteristics of good Vertical Slices
- Code is structured primarily by feature, secondary by layer
- Have sing...
SUMMARY: Trade-offs and Challenges
- Complete mindset shift
- Developers must be all-round-shaped (back, front, middle, db...
Upcoming SlideShare
Loading in …5
×

Vertical Slices in .NET - Bojan Veljanovski, March 2016, MK.NET UG

557 views

Published on

At its core, engineering is the art of decomposing big problems into smaller ones so that are easier to be understood, communicated and tackled.
The traditional n-tier approach to building a feature is to break it down into several layers. By building it as such there is high risk of over-engineering each layer individually to ensure that the next dependable layer has everything it needs. This way, there is high potential for introducing non-necessary complexity.
By slicing through the layers, and building features in “vertical slices” the complexity gets as big as the individual feature needs it to be, isolated from other parts of the system.
In this session I’ll explain and demo how to simplify a horizontal-layered system towards vertical-sliced one, by employing principles and practices such as SRP and CQS.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Vertical Slices in .NET - Bojan Veljanovski, March 2016, MK.NET UG

  1. 1. Vertical Slices in .NET Bojan Veljanovski, CTO at HASELT 1
  2. 2. What is an user’s intent in software? 2
  3. 3. User Intent - Reads and Writes - WRITE is a request modeled as COMMAND triggered via HTTP POST - READ is a request modeled as QUERY triggered via HTTP GET - Commands modify data - Queries retrieve data 3
  4. 4. User Intent - CQRS CQRS is a simple pattern, writing and reading data is placed in 2 separate classes which have single responsibility. 4
  5. 5. DISCLAIMER Nope… there is no silver bullet. 5
  6. 6. What we are going to talk about - Overview - Horizontal vs. Vertical user stories - Horizontal vs. Vertical slices - Commands & Queries - Feature folders - DEMO code - Summary 6
  7. 7. “Two“ starting points to build a system - Horizontal first - Vertical first 7
  8. 8. Horizontal vs. Vertical user stories - Horizontal - Story 1: Create the new DB Table for Users - Story 2: Create the DAL to access the DB Users - Story 3: Create the Users business layer code that references the DAL - Story 4: Write the Users UI screen - Vertical - Story 1: User can register and provide username and password. - Story 2: User can manage multiple addresses. - Story 3: User can add additional contact fields (phone, email, etc). - Story 4: User can subscribe to a subscription plan. 8
  9. 9. Horizontal vs. Vertical user stories - Horizontal - Implement the database layer for A, B and C - Implement the business logic layer for A, B and C - Implement the user interface for A, B and C - Vertical - Implement A from end to end - Implement B from end to end - Implement C from end to end 9
  10. 10. Horizontal slicing is not natural in agile - Changes usually happen vertically - You limit your application to the same horizontal constraints for all features (regardless of the size and complexity) - ...and more 10
  11. 11. “Slicing” is a team organization thing too! 11
  12. 12. Vertical Slices over Horizontal Slices - Horizontal slices is organization by technical layers. - Vertical slices is organization by features (business requirements). 12
  13. 13. Vertical Slicing: The Stakeholder Stakeholders talk and eat the cake in vertical slices. They want one delicious piece at a time, not only the vanila part. Why don't we structure our code vertically as well? 13
  14. 14. Horizontal Slices 14
  15. 15. Horizontal Slices (2) 15
  16. 16. Horizontal Slices (3) 16
  17. 17. Vertical Slices 17
  18. 18. Organization structure 18
  19. 19. 19
  20. 20. 20
  21. 21. Addressing cross-cutting concerns - Loggers - Validators - Transactions 21
  22. 22. ASP.NET MVC - Feature Folders ViewEngine 22
  23. 23. ASP.NET MVC - Feature Folders ViewEngine 23
  24. 24. Slide intentionally blank... 24
  25. 25. Can it easily evolve to CQRS? 25
  26. 26. Can it easily evolve to SOA/Microservices? 26
  27. 27. SUMMARY: Characteristics of good Vertical Slices - Code is structured primarily by feature, secondary by layer - Have single responsibility (business-oriented) - Encapsulated and decoupled from other slices - Complexity and defects are isolated in each slice, instead of each layer - Increases developer’s understanding of each feature as a whole - Enables incremental releases of features - Enables faster feedback loop 27
  28. 28. SUMMARY: Trade-offs and Challenges - Complete mindset shift - Developers must be all-round-shaped (back, front, middle, db, all) - Now you have twice as many classes as before 28

×