yow west 2017
play

YOW West 2017 OUR SPONSORS Cost of a dependency Lee Campbell - PowerPoint PPT Presentation

YOW West 2017 OUR SPONSORS Cost of a dependency Lee Campbell Author of eBook and website IntroToRx.com Dev at Cashies Conference Circuit Trainer Practical Rx Project success Longevity How long will your project need to be used for? How


  1. YOW West 2017 OUR SPONSORS

  2. Cost of a dependency

  3. Lee Campbell Author of eBook and website IntroToRx.com Dev at Cashies Conference Circuit Trainer – Practical Rx

  4. Project success

  5. Longevity How long will your project need to be used for? How long will it need to be maintained for? How long will each of it’s dependent parts be relevant for?

  6. Freedoms Single man dependencies vs Fungible assets Technology lock-in vs Technology agnostic

  7. A case study A case study A COLLECTION OF EXPERIENCES

  8. How did it get like this? COMPOUNDING EFFECTS

  9. 1. Single repo

  10. Single repo \GUI \Server \Datastore

  11. Single repo \GUI ◦ FeatureA ◦ FeatureB \Server ◦ FeatureA ◦ FeatureB ◦ Shared \Datastore

  12. Single repo \GUI \Datastore ◦ FeatureA ◦ FeatureB ◦ FeatureC \Server ◦ FeatureA ◦ FeatureB ◦ FeatureC ◦ Shared ◦ Logic ◦ Scripts (Builds, Deployments)

  13. Single repo \GUI \Datastore ◦ FeatureA ◦ FeatureA ◦ FeatureB ◦ FeatureB ◦ FeatureC ◦ FeatureC \Server ◦ FeatureA ◦ FeatureB ◦ FeatureC ◦ Shared ◦ Logic ◦ Scripts (Builds, Deployments)

  14. Single repo \GUI \Framework ◦ FeatureA ◦ Comms Layer ◦ FeatureB ◦ Data Persistence abstraction ◦ FeatureC ◦ Scripts (Builds, Deployments) ◦ Shared \Server \Datastore ◦ FeatureA ◦ FeatureA ◦ FeatureB ◦ FeatureB ◦ FeatureC ◦ FeatureC ◦ Shared ◦ Logic ◦ Contracts

  15. Single repo Who defines requirements and budget for each part of the system? Can this progression be maintained for the expected lifetime of the system? Do these things change together?

  16. Single repo - Consequences Build times increase Testing burden Friction to innovate Blurry boundaries Lack of responsibility

  17. 2. Depend on abstractions

  18. Interface all the things View Models Translators Validators

  19. Consequences Testing now becomes an exercise in mocking Debugging is always a case of hitting finding "implementations of"

  20. Consequences Focus is diluted Cognitive load is increased through indirection

  21. Depend on (external) abstractions We can also take dependencies on interface define by someone else So maybe you just mock out your ◦ IoC Continer ◦ SqlConnection ◦ ORM UnitOfWork But these are normally defined in their package, with the implementation.

  22. 3. Deep layering

  23. Deep layering Deep system dependencies

  24. Deep layering

  25. Deep layering My application ◦ My libraries ◦ My Framework ◦ My Framework subsystem ◦ Generic public packages ◦ Low level generic public packages

  26. Deep layering My application ◦ My libraries (Domain, Data Access, Comms, Controls, Styles) ◦ My Framework (DataAccess, Comms, Contracts, Generic Utilities, Controls, Styles) ◦ My Framework subsystem (Implementation specific DataAccess, Comms etc) ◦ Generic public packages (ORM, Serializers, Web Platform, Messaging, Document manipulation) ◦ Low level generic public packages (Network interfaces, Collections Libraries)

  27. Deep layering Non linear growth 3 deep with each dependency having 3 children 1 + 3 + 9 = 13 total

  28. Deep layering Non linear growth Add 2 more layers (5 layers) 1 1 1 1 13 13 13 13 13 13 13 13 13 1 + 3 + (9 * 13) = 121 total

  29. Deep layering Non linear growth Add 2 more layers (7 layers) 1 1 1 1 121 121 121 121 121 121 121 121 121 1 + 3 + (9 * 121) = 1093 total

  30. + baggage Packages that include ◦ minified and original resource ◦ Documentation (JavaDoc/Intellisense) ◦ Tooling

  31. Deep call stacks I depend on abstractions But they also depend on abstractions So I have deep call stacks

  32. Deep call stacks https://twitter.com/gregyoung/status/ 734713437146734592

  33. Consequences Cognitive load increases exponentially with each layer Technical freedom is slowly eroded as each layer add more dependencies

  34. Compounding Consequences

  35. Compounding consequences Build times Test times Lack of Ownership

  36. Compensating behaviour Magic Build scripts Using the real IoC Container in tests AOP

  37. Complicated becomes complex Cant be rationalised about Emergent behaviour (bugs, not features)

  38. Alternatives IS THERE A BETTER WAY?

  39. Single repo FEATURE DEPENDENCY

  40. If it changes together, it lives together Ways to identify ◦ The person that has final say on requirements is different ◦ Release cadences are different ◦ Code change cadence is different ◦ Failures are ignored "Decompose your applications based on volatility" - Juval Lowy

  41. Single repo \GUI \Framework ◦ FeatureA ◦ Comms Layer ◦ FeatureB ◦ Data Persistence abstraction ◦ FeatureC ◦ Scripts (Builds, Deployments) ◦ Shared \Server \Datastore ◦ FeatureA ◦ FeatureA ◦ FeatureB ◦ FeatureB ◦ FeatureC ◦ FeatureC ◦ Shared ◦ Logic ◦ Contracts

  42. Multi repo FeatureA ◦ GUI ◦ GUI ◦ Server ◦ DataStore ◦ Server ◦ DataStore ◦ Contracts ◦ Contracts GUI Lib FeatureB Comms Lib ◦ GUI Persistence Lib ◦ Server ◦ DataStore ◦ Contracts FeatureC

  43. Multi repo Inherently parallel to build and test Forces the discussion about design by contract Can reduce the knee jerk reaction to share code

  44. Encapsulation

  45. Justify the interface What is the benefit of this being injected? Can it be encapsulated into this unit?

  46. Private by default Instead of Reuse being a goal, aim for encapsulation. Rule of 3 Reuse is an evolution

  47. The snip rule Single line to cut Avoid dependencies that require finesse to remove

  48. Code in action A DOMAIN MODEL WITH NO DEPENDENCIES

  49. Only depends on .NET

  50. So how does it do anything The Domain Model defines the interfaces for the things it needs ◦ IRepository<T> Can you tell what technology we are using here? Consumers are responsible to implement it We are isolating the business logic from our technology choices.

  51. Inversion of Control

  52. Hosts compose shallow dependencies Hexagonal Architecture (Alistair Cockburn)  Ports and Adapters  Onion Architecture

  53. We define our Ports IRepository is one of our ports We may have a SQLServer adapter, or perhaps a MongoDB one

  54. Composition App Service Domain Model Data Service Comms Service Messaging ORM Data store Serialization platform

  55. Composition App Service Data Comms adapter adapter Data Domain Comms store Model

  56. Adapters CODE BREAK OUT

  57. Composition instead of AOP I can just use normal old Decorator pattern

  58. Results Multi repo ◦ Division of labour ◦ Cohesive code base ◦ Reduced cognitive load ◦ Technical freedom

  59. Results Encapsulation ◦ Reduced cognitive load ◦ Less busy work ◦ Snip rule

  60. Results Inversion of Dependencies / Ports and Adapter ◦ Focused code ◦ Fast tests ◦ Shallow stacks ◦ Technical Freedom

  61. Know your costs Cognitive load Onboarding friction Technical Freedom Time to prod

  62. More information LeeCampbell.com Implementing Domain Driven Design – Vaugh Vernon Greg Young – Good enough software Hex Arch – Alistair Cockburn Having the computer to do what you want isn’t the hard part, having a person understand the intent of your code is.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend