Vertical Slice
Architecture
Germán Küber
Software Architect
>_
Arquitectura Tradicional N-Capas
UI
Lógica de Negocios
Acceso a Datos
Base de datos
¿ Como organizamos nuestras capas?
• User.cs
• UserController.cs
• UserService.cs
• UserRepository.cs
Arquitectura N capas Asp.Net
1
2
3
4
5
6
7
8
9
10
11
12
public interface IPostsRepository : IBaseRespository
{
Task<Post> CreateAsync(Post newPost);
bool PostExistById(int id);
Task<Post> GetById(int id);
Task<List<Post>> GetAllByCommentIdAsync(int comment);
Task<List<Post>> GetAllByDataIdAsync(DateTime date);
Task<List<Post>> GetAllByCoordinatorIdAsync(int commentId, List<string> categories);
Task<Post> GetByIdAsync(int id);
Task<Post> GetByIdForDraftAsync(int id);
Task<List<Post>> GetAllByProviderIdAsync(int providerId);
Task<List<Post>> GetAllWithProvidersAsync();
Task<Post> GetByCommentDraftIdAsync(int idPost);
Task<Post> GetByIdAndProviderIdAsync(int idProvider, int idPost);
Task<Post> GetByIdWithQuestionAsync(int postId);
Task<Post> GetByIdWithQuestionDraftAsync(int postId);
Task<Post> GetByProviderIdWithQuestionAsync(int postId, int providerId);
Task<Post> GetSoftByIdAsync(int id);
Task<Post> GetByIdWithMilestonesAsync(int idPost);
Task<Post> GetByIdWithCommentMessageAsync(int id);
Task<Post> GetByIdAndProviderIdWithCommentMessageAsync(int postId, int providerId);
Task<Post> GetByIdWithProviderPostsAsync(int id);
Task<Post> GetByIdAndQuestionIdWithQuestionAsync(int postId, int questionId);
Task<List<Post>> GetAsync();
Task<List<Post>> FilterPosts(Filter filter);
}
Arquitectura N-Capas
UI
BL
DAL
DB
Vertical Slice Architecture
Vertical Slice Architecture
De métodos a Clases
void BlockUser()
void AcceptUser()
void CreateUser()
UsersServices
BlockUser { }
AcceptUser { }
CreateUser { }
Modelo de Requests
Input
Request
Handler
Output
Comandos y Queries
Web
App
GET
Query
POST
Command
Query Handler Response
Command Handler Response
Idempotente
No Idempotente
Encapsulamiento
Request Response
Encapsulamiento
Request
Handler
Response
Domain
¿Por que Vertical Slice Architecture?
• Código sencillo
• Código fácil de probar
• Separación de tests
• Aplicación fácil de dividir
Gracias!!!
Germankuber
http://germankuber.com.ar

Vertical slice architecture

Editor's Notes

  • #6 UserRepository: Todo el tiempo cambiamos la base de datos no?
  • #7 Tocar en diferentes lugares
  • #10 Organizada entorno a lo que debe cambiar juntos. Organiza de manera lógica todo lo que cambia junto, en un mismo lugar
  • #16 Un modelo entra un modelo sale