Postagens

Why I’m Finally Letting Go of the Repository Pattern

Imagem
Original post Why I’m Finally Letting Go of the Repository Pattern (Yes, I was a fan once upon a time.) What it promised: 🔹 A clean boundary between domain logic and the data model/db 🔹 Easier maintainability by hiding data access details 🔹 Flexible architecture: swap out the ORM or DB anytime 🔹 Horizontal layering: controllers → services → repositories → DB What I experienced instead: 🔹 Mapping overhead everywhere: data model, domain model, DTOs, etc. 🔹 Rigid layering: feature logic split across too many folders and files 🔹 Orchestration fatigue: most ORMs (EF, Dapper) already solve common data issues 🔹 Slowed delivery: multiple abstractions for minimal real-world benefit When it clicked: Realizing typical line-of-business apps don’t need all this ceremony. Focusing on data flow (request → handler → data model/events → response) cuts out layers that don’t add value. Where I’m heading: ✅ Feature slices: group logic, data, and business rules together ✅ Less friction: directly l...

Lambda expressions and functional interfaces in Java

  Lambda expressions in Java (parameters) -> expression (parameters) -> { statements; }   // No parameters () -> System.out.println("Hello, World!"); // Single parameter a -> a * 2 // Multiple parameters (a, b) -> a + b // Block of code (a, b) -> {    int result = a + b;    return result; }   https://medium.com/@lakshyachampion/mastering-functional-interfaces-and-lambda-expressions-in-java-c02d8aaff5b2   Examples: // Functional interface with a single abstract method @FunctionalInterface interface   Calculator  {     int   calculate ( int a, int b ); } public   class   Main  {     public   static   void   main ( String[] args ) {         // Using Lambda Expression for addition        Calculator additionCalculator = (a, b) -> a + b;         ...