Skip to content

Instantly share code, notes, and snippets.

@pepasibble
Last active June 21, 2021 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pepasibble/4add5fae6d503922f0324b009aff664a to your computer and use it in GitHub Desktop.
Save pepasibble/4add5fae6d503922f0324b009aff664a to your computer and use it in GitHub Desktop.
Notes on Robert Martin's "Architecture: the Lost Years" talk

Notes on Robert Martin's "Architecture: the Lost Years" talk

video: https://www.youtube.com/watch?v=WpkDN78P884

  • 7:00 structure of a typicaly rails app
    • top level dir structure communicates that it is a rails app, not what the app actually does
    • the web is just a delivery mechanism, just a detail, yet it dominates your project structure
  • floorplan of a library, church, etc
    • the top-level structure of these buildings conveys their intent / purpose
  • why are we reflecting the web framework rather than the intent of the app?
  • 12:20 Object-Oriented Software Engineering: A Use Case Driven Approach by Ivar Jacobson
    • he talks about how to get the intent of the app expressed at the top-level structure
  • user story vs use-case
  • 15:20 Jacobson's model:
    • "interactor" object: represents a use-case
      • for application-specific business rules
    • "entities"
      • for application-non-specific business rules (orders, customers, etc)
    • interactors and entities are decoupled from database and delivery mechanism (web)
    • "boundaries" (interfaces, protocols)
      • how to get data into / out of interactors and entities
    • note direction of dependencies, delivery mechanism can be replaced / pluggable
    • request model, result model: not web-specific
    • tests can be written without involving the web/server at all
    • project would be structured around boundaries, interactors and entities
      • structure of project thus reflects the intent of the application
      • interactors are e.g. "create order", "add item to order", "deliver order", etc
  • 29:00 MVC
    • invented by Trygve Mikkjel Heyerdahl Reenskaug, in smalltalk
    • controller gets input from user, view presents data to user, view observes model
    • originally, every part of the view hierarchy had its own controller and model
    • these days we have diverged (e.g. iOS: typically one controller per screen)
    • flaw: both controllers and views know about the business objects
  • rant about the web
  • 35:20 "presenter" translates a result model into (e.g. a web-specific) view model
    • "view" is simple, "dumb" mapping from view model to output format
      • tests for views are less important
  • note: the arrows seem to indicate "this piece knows about (is coupled to) this piece", rather than data flow
    • everything to the left of the line can be created as a library
      • which can be used by any particular delivery mechanism
  • 39:00 digression about tests
  • 40:25 Database
    • database should not be the center of the application, it is just a detail
    • "entity gateway"
    • "architecture is the art of drawing lines (boundaries) with the rule that all the dependencies (arrows) which cross that line go in the same direction"
      • e.g. not ok for objects on both sides of the line to "know about" (be coupled to) each other
    • database is isolated as a plugin, and it not needed when e.g. running tests
    • tests with no delivery mechanism and no database can be run very quickly
    • note: active record, ruby, etc are on the other side of the line from the business logic
  • 46:00 digression about "fitnesse" application (a testing framework and wiki)
    • deferred decision about choosing a database, ended up not needing it at all (just used flat files)
    • digression about ward cunningham's accomplishments
  • "a good architecture allows major decisions to be deferred"
    • e.g. rails is just a detail, database is just a detail
  • "a good architecture maximizes the number of decisions not made"
    • e.g. keeps your options open for as long as possible
  • 58:00 digression about TDD

Screen Shot 2021-03-30 at 1 06 54 PM

Screen Shot 2021-03-30 at 1 07 11 PM

Screen Shot 2021-03-30 at 1 07 29 PM

Screen Shot 2021-03-30 at 1 08 20 PM

Screen Shot 2021-03-30 at 1 08 55 PM

Screen Shot 2021-03-30 at 1 09 20 PM

Screen Shot 2021-03-30 at 1 09 37 PM

Screen Shot 2021-03-30 at 1 10 01 PM

Screen Shot 2021-03-30 at 1 10 17 PM

Screen Shot 2021-03-30 at 1 10 44 PM

Screen Shot 2021-03-30 at 1 12 06 PM

Screen Shot 2021-03-30 at 1 21 18 PM

Screen Shot 2021-03-30 at 1 21 48 PM

Screen Shot 2021-03-30 at 1 22 39 PM

Screen Shot 2021-03-30 at 1 27 26 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment