Tuesday, 1 April 2014

Dont Tie Yourself to a Framework

  • Programming is great
  • Software development is the crap bit. You'll spend more time configuring, integrating and faffing rather than writing logic most of the time.
  • Test Driven Development makes development easier as it forces you to decouple your code.
    • Your core logic should be pure, dependency free C#, Java, Python etc.
    • Your frameworks and libraries should be on the edge of the system.
  • Most people do this for some of their code, e.g. your data access.
  • What about the other parts of a system?
    • Web frontend
    • REST api's
    • Console applications
    • Desktop clients
  • Why should we couple our applications with these layers?

Hexagonal Architecture

  • Hexagonal Architecture is a solution to limit coupling
    • Easily switch out your delivery mechanism, e.g. test runner adapter for testing, HTML adapter for production.
    • Great example from Kevin Rutherford.
    • Excellent video by Uncle Bob though terminology differs.
    • Implementation details should be hidden behind adapters.
      • Tested manually in the majority of cases
      • Few integration tests for comfort
      • Third party code after all.
    • Inner hexagon should only communicate via ports (interfaces) - keeps domain pure.

Why?

  • Last few major projects involved with were due to the delivery mechanism becoming out of date.
    • Flash to Web
    • Web to Mobile
  • Easier to test
  • Easier to change

Why not?

  • CRUD apps - sometimes it's just CRUD.
  • Lightweight projects might not need hexagonal architecture
  • SOA or Microservices could mean hexagonal architecture actually introduces overhead or complexity - judge on context.

No comments:

Post a Comment