22
Hexagonal Architecture Marcus Biel Software Craftsman www.marcus-biel.com

Hexagonal Architecture Marcus Biel Software Craftsman

Embed Size (px)

Citation preview

Page 1: Hexagonal Architecture Marcus Biel Software Craftsman

Hexagonal Architecture

Marcus BielSoftware Craftsman

www.marcus-biel.com

Page 2: Hexagonal Architecture Marcus Biel Software Craftsman

Maintainability

Page 3: Hexagonal Architecture Marcus Biel Software Craftsman

The Hexagon

Page 4: Hexagonal Architecture Marcus Biel Software Craftsman

The Outside

Page 5: Hexagonal Architecture Marcus Biel Software Craftsman
Page 6: Hexagonal Architecture Marcus Biel Software Craftsman

Framework

public class HttpController extends BaseController {[...]

public void process(Request req, Response resp) {[...]

comandBus.execute(new Command(param1…));}

[...]}

Page 7: Hexagonal Architecture Marcus Biel Software Craftsman
Page 8: Hexagonal Architecture Marcus Biel Software Craftsman

Application

public class CB implements CommandBus {[…]

public void execute(Command command) { registry.getHandler(command).execute();}

[…]}

Page 9: Hexagonal Architecture Marcus Biel Software Craftsman
Page 10: Hexagonal Architecture Marcus Biel Software Craftsman

Domain

public class Car implements Domain {

public void drive(Gear gear) {if(isNotAllAllowed(gear){

throw new InvalidGearException();}

}}

Page 11: Hexagonal Architecture Marcus Biel Software Craftsman

Ports

Page 12: Hexagonal Architecture Marcus Biel Software Craftsman

Ports & Adapters

Page 13: Hexagonal Architecture Marcus Biel Software Craftsman

Use Case

Page 14: Hexagonal Architecture Marcus Biel Software Craftsman

The Hexagon

Page 15: Hexagonal Architecture Marcus Biel Software Craftsman
Page 16: Hexagonal Architecture Marcus Biel Software Craftsman

public interface CommandBus {

void execute(Command command);

}

Page 17: Hexagonal Architecture Marcus Biel Software Craftsman

public interface CommandHandler {

public void handle(Command command);

}

Page 18: Hexagonal Architecture Marcus Biel Software Craftsman

A good architecture maximizes the

number of decisions NOT madeRobert C. Martin

Page 19: Hexagonal Architecture Marcus Biel Software Craftsman

A good architecture allows major decisions

to be deferredRobert C. Martin

Page 20: Hexagonal Architecture Marcus Biel Software Craftsman

Questions?

@MarcusBielwww.marcus-biel.com

Page 21: Hexagonal Architecture Marcus Biel Software Craftsman

Birthday-Greeting-Kata

Page 22: Hexagonal Architecture Marcus Biel Software Craftsman

References

Chris Fidao, Hexagonal Architecturehttp://fideloper.com/hexagonal-architecture

Robert C Martin - Clean Architecture and Design https://www.youtube.com/watch?v=Nsjsiz2A9mg

Birthday-Greeting-Kata:http://matteo.vaccari.name/blog/archives/154