+ All Categories
Home > Software > Vertical Slices in .NET - Bojan Veljanovski, March 2016, MK.NET UG

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

Date post: 16-Apr-2017
Category:
Upload: bojan-veljanovski
View: 413 times
Download: 2 times
Share this document with a friend
28
Vertical Slices in .NET Bojan Veljanovski, CTO at HASELT 1
Transcript

Vertical Slices in .NETBojan 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 as QUERY triggered via HTTP GET

- Commands modify data

- Queries retrieve data

3

User Intent - CQRS

CQRS is a simple pattern, writing and reading data is placed in 2 separate classes which have single responsibility.

4

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

- Commands & Queries

- Feature folders

- DEMO code

- Summary

6

“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 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.

- Story 5: Admin can manage subscription plans and pricing.

8

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

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

“Slicing” is a team organization thing too!

11

Vertical Slices over Horizontal Slices

- Horizontal slices is organization by technical layers.

- Vertical slices is organization by features (business requirements).

12

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

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 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- Enables support for potential simpler scaling out

- By Read/Write mechanics (CQRS), or- By Feature as a whole (SOA)

27

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


Recommended