$30 off During Our Annual Pro Sale. View Details »

Whoops! Where did my architecture go?

Whoops! Where did my architecture go?

Slides of the talk on maintaining software architecture in Java applications I gave at GeeCON Prague 2014. @springcentral

Oliver Drotbohm

October 23, 2014
Tweet

More Decks by Oliver Drotbohm

Other Decks in Programming

Transcript

  1. Whoops!
    Where did my
    architecture go?
    Architecture management for Java applications
    !
    Oliver Gierke

    View Slide

  2. View Slide

  3. View Slide

  4. View Slide

  5. View Slide

  6. Background
    5 years of consulting
    Lots of code reviews
    Eoin Woods‘ talk on InfoQ
    Lot of input from fellows

    View Slide

  7. "If you think
    architecture is
    expensive, try no
    architecture.

    View Slide

  8. "Architecture is like
    weather: you can’t
    have none.

    View Slide

  9. Macro VS. Micro
    Architecture

    View Slide

  10. Orders
    Inventory
    Billing
    Macro-Architecture
    Micro-Architecture
    JMS
    REST
    AMQP

    View Slide

  11. JRuby
    Java
    Scala
    Macro-Architecture
    Micro-Architecture
    AMQP
    JMS
    REST

    View Slide

  12. Neo4j
    RDBMS
    MongoDB
    Macro-Architecture
    Micro-Architecture
    JMS
    REST
    AMQP

    View Slide

  13. Neo4j
    RDBMS
    MongoDB
    Macro-Architecture
    Micro-Architecture
    from Stefan Tilkov -

    Breaking the Monolith
    JMS
    REST
    AMQP

    View Slide

  14. Roadmap
    Divide and conquer
    Of layers and slices
    A plain Java based approach

    View Slide

  15. Architecture 101

    View Slide

  16. Know your
    dependencies

    View Slide

  17. Explicit / Visible
    dependencies

    View Slide

  18. Granularity
    Modules
    Layers
    Vertical slices
    Subsystems

    View Slide

  19. Granularity
    Java ARchive
    Package
    Class

    View Slide

  20. Divide and
    conquer

    View Slide

  21. Component
    Single unit to understand

    View Slide

  22. Component
    Single unit to change

    View Slide

  23. Component
    Scope of risk of change

    View Slide

  24. B
    Smaller unit to understand
    A

    View Slide

  25. B
    Reduced risk of change
    A

    View Slide

  26. B
    Cost of separation
    A

    View Slide

  27. B
    Definition and maintenance
    of dependencies
    A

    View Slide

  28. "Meanwhile, in my
    friend’s project…

    View Slide

  29. How do I add a feature?

    View Slide

  30. How do I add a feature?
    New

    Feature
    © Eberhard Wolff

    View Slide

  31. Of layers
    and slices…

    View Slide

  32. Presentation
    Service
    Data Access
    Account Customer Core

    View Slide

  33. Layers
    Well understood
    Known to developers
    Less important to business

    View Slide

  34. Slices
    Hardly understood
    New to developers
    Key for business requirements

    View Slide

  35. Presentation
    Service
    Data Access
    Account Customer Core

    View Slide

  36. "How to implement
    an architecture
    inside a codebase?

    View Slide

  37. Architecture
    VS.
    Codebase

    View Slide

  38. "How to implement
    an architecture
    inside a codebase?

    View Slide

  39. "How to maintain
    an architecture
    inside a codebase?

    View Slide

  40. Code analysis
    JDepend
    Sonarcube

    View Slide

  41. Sonargraph
    Formerly known as SonarJ

    View Slide

  42. Demo

    View Slide

  43. A plain Java
    based approach

    View Slide

  44. "How far can we get
    with plain Java
    means only?

    View Slide

  45. Presentation
    Service
    Data Access
    Account Customer Core

    View Slide

  46. Packages

    View Slide

  47. ….layer.slice
    ….slice.layer
    ….slice

    View Slide

  48. ….web.core
    ….service.core
    ….repository.core

    View Slide

  49. ….core.web
    ….core.service
    ….core.repository

    View Slide

  50. ….core
    ….customer
    ….account

    View Slide

  51. "Why the f#$k
    should I even care?

    View Slide

  52. "Does it make
    a difference?

    View Slide

  53. Dependency
    management

    View Slide

  54. "You only need to
    manage, what you
    can refer to…

    View Slide

  55. Layers first
    Leaks slice internals
    Lower layers visible to everyone

    View Slide

  56. Slices first/only
    Start with package per slice
    Expose interfaces and domain types
    Keep implementations private

    View Slide

  57. Slices first/only
    Encapsulates business module
    Internals understood anyway

    View Slide

  58. "Start with less
    packages and the
    least visibility
    possible…

    View Slide

  59. Presentation
    Service
    Data Access
    Account Customer Core

    View Slide

  60. Presentation
    Service
    Data Access
    Account Customer Core

    View Slide

  61. Demo

    View Slide

  62. Take-aways
    Know your dependencies
    On every granularity
    Start as strict as possible
    Get lenient where necessary

    View Slide

  63. Resources
    Spring Data JPA @ GitHub
    Sonargraph
    jQAssistant
    Blogpost

    View Slide

  64. Sample Code
    http://github.com/olivergierke/

    whoops-architecture

    View Slide

  65. Oliver Gierke
    Spring Data Project Lead
    !
    [email protected]
    olivergierke
    www.olivergierke.de

    View Slide

  66. Thanks & Credits
    Eoin Woods - Talk @ InfoQ
    Stefan Tilkov - Talk @ InfoQ
    Eberhard Wolff - Slides @ Slideshare

    View Slide