Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Virtualizing Dependency Resolution

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

Virtualizing Dependency Resolution

Mad Science

Avatar for Stephan Seidt

Stephan Seidt

December 02, 2013
Tweet

Other Decks in Programming

Transcript

  1. (My) Reality • I want to create something. How exciting!

    • I ask myself “Where do I put this code?”
  2. (My) Reality • I want to create something. How exciting!

    • I ask myself “Where do I put this code?” • One macro module: Can’t reuse
  3. (My) Reality • I want to create something. How exciting!

    • I ask myself “Where do I put this code?” • One macro module: Can’t reuse • Many micro modules: Hard to manage
  4. (My) Reality • I want to create something. How exciting!

    • I ask myself “Where do I put this code?” • One macro module: Can’t reuse • Many micro modules: Hard to manage • OK, let’s just write many small modules!
  5. The Human Condition Action Location Operation Create editor, local fs

    Text → FS Find deps editor, local fs DBnpm → FS
  6. The Human Condition Action Location Operation Create editor, local fs

    Text → FS Find deps editor, local fs DBnpm → FS Commit .git/ FS → DBlg
  7. The Human Condition Action Location Operation Create editor, local fs

    Text → FS Find deps editor, local fs DBnpm → FS Commit .git/ FS → DBlg Publish github DBlg → DBgh
  8. The Human Condition Action Location Operation Create editor, local fs

    Text → FS Find deps editor, local fs DBnpm → FS Commit .git/ FS → DBlg Publish github DBlg → DBgh Package npm FS → DBnpm
  9. The Human Condition Action Location Operation Create editor, local fs

    Text → FS Find deps editor, local fs DBnpm → FS Commit .git/ FS → DBlg Publish github DBlg → DBgh Package npm FS → DBnpm Test ci (apply [DBnpm, DBgh])
  10. The Human Condition Action Location Operation Create editor, local fs

    Text → FS Find deps editor, local fs DBnpm → FS Commit .git/ FS → DBlg Publish github DBlg → DBgh Package npm FS → DBnpm Test ci (apply [DBnpm, DBgh]) Deploy ssh/chef [DB] →→ FSremote
  11. The Other World Theory Action Location Operation Create browser Text

    → DB Find deps browser DB → DB Commit browser DB → DB
  12. The Other World Theory Action Location Operation Create browser Text

    → DB Find deps browser DB → DB Commit browser DB → DB Publish browser DBme → DByou | DBgh
  13. The Other World Theory Action Location Operation Create browser Text

    → DB Find deps browser DB → DB Commit browser DB → DB Publish browser DBme → DByou | DBgh Package browser DBme → DBnpm
  14. The Other World Theory Action Location Operation Create browser Text

    → DB Find deps browser DB → DB Commit browser DB → DB Publish browser DBme → DByou | DBgh Package browser DBme → DBnpm Test browser (apply DB)
  15. The Other World Theory Action Location Operation Create browser Text

    → DB Find deps browser DB → DB Commit browser DB → DB Publish browser DBme → DByou | DBgh Package browser DBme → DBnpm Test browser (apply DB) Deploy browser (apply DBme)
  16. The Other World Theory Action Location Operation Create browser Text

    → DB Find deps browser DB → DB Commit browser DB → DB Publish browser DBme → DByou | DBgh Package browser DBme → DBnpm Test browser (apply DB) Deploy browser (apply DBme) Deploy browser DBme → Container
  17. Action Code Create onChange = sync f, test f, deploy

    f Sync (Commit, Publish & Package) db.get(f.id).set(‘source’, source) The life of f
  18. Action Code Create onChange = sync f, test f, deploy

    f Sync (Commit, Publish & Package) db.get(f.id).set(‘source’, source) Test eval(bundle(f, test)) The life of f
  19. Action Code Create onChange = sync f, test f, deploy

    f Sync (Commit, Publish & Package) db.get(f.id).set(‘source’, source) Test eval(bundle(f, test)) Deploy browser eval(bundle(f ))) The life of f
  20. Action Code Create onChange = sync f, test f, deploy

    f Sync (Commit, Publish & Package) db.get(f.id).set(‘source’, source) Test eval(bundle(f, test)) Deploy browser eval(bundle(f ))) Deploy server postToDockerd(containerize(f )) The life of f
  21. findDeps • Search undefined symbols in source
 undefs :: Source

    ! [UndefinedSymbol] • Resolve undefs into dependency tree
 resolveDeps :: FunDef ! FunDepTree
  22. findDeps • Search undefined symbols in source
 undefs :: Source

    ! [UndefinedSymbol] • Resolve undefs into dependency tree
 resolveDeps :: FunDef ! FunDepTree • Locks current dependency version if unknown!
  23. bundle • Concatenate dependency & entrypoint
 bundle :: FunDepTree !

    Source • Run!
 evaluate(bundle(resolveDeps(f)))
  24. db • DB is a CRDT document • Replicates peer

    to peer between all participants • Can be persisted to disk or browser storage
  25. Browser as a compiler. • Replicates dependencies • Checks code

    validity • Compiles code into JS bundle
  26. Browser as a compiler. • Replicates dependencies • Checks code

    validity • Compiles code into JS bundle • Compilation result is cached in database
  27. Browser as a compiler. • Replicates dependencies • Checks code

    validity • Compiles code into JS bundle • Compilation result is cached in database • Runs bundle in isolated context
  28. f

  29. Next • Achieve 100% doge food • Add versioning •

    Add concept of ownership • Open port to the public