The document discusses architecting large Node.js applications. It introduces the Cloud9 IDE and how it was used to build a JavaScript application with 10,000s of lines of code. It describes how the application was difficult to maintain due to lack of modularity. The Architect module is introduced as a way to modularize Node.js applications by treating everything as plugins that can import other plugins. Architect allows defining dependency models, easy testing of modules, and configuration of modules through options. Cloud9 uses Architect to build features like local, FTP, and SSH versions of the IDE that can run independently in a single process. Architect also enables loose coupling between modules through an event bus and centralized configuration.
25. Java/.NET import(s)
Node.js require
Monday, October 22, 12
26. Great for
re
requi
abstracting
Monday, October 22, 12
away
27. re
requi
Not Great for
application
modularity
Monday, October 22, 12
28. re
requi
Relies on FS
duplicated modules
maps to folder names
Hard to configure module
Monday, October 22, 12
29. Dependency error handling
coding time compile time run time
!
OM
- BO
KA
- Server crash
- Unhappy customers
- Developer gets fired
Monday, October 22, 12
30. How to fix it?
Static dependency list Resolve at startup
Named services No FS required
Easy configuration Pass an object
Monday, October 22, 12
31. P ro g ra m
☑ C l o u d9 ID E?
☑ G row i n g pai n s
☐ I n t ro du c i n g Arc hitec t
☐ Le ss on s le arn e d
Monday, October 22, 12
32. Architect
github.com/c9/architect
Monday, October 22, 12
33. Architect
Everything is a plugin
Plugins can consume plugins
An application is just a set of plugins
Monday, October 22, 12
34. Dependency model
require runtime
Architect compile time
Monday, October 22, 12
35. Dependency error handling
Architect
coding time compile time run time
- Happy customers
- Fails before release - Developer keeps job
Monday, October 22, 12
41. What’s next?
Wrap in Architect plugin code
Extract the code
Make two plugins
Monday, October 22, 12
42. Function
signature
Call when done
Monday, October 22, 12
43. Architect plugin code
Module.exports
Options - we’ll get to that
Imports - everything you ‘consume’
Register - invoke when done
Monday, October 22, 12
61. Swap feature per
implementation
On Open source: talk local filesystem
On FTP: talk FTP library
On SSH: talk via a SSH bridge
Monday, October 22, 12
63. Single node.js process
IDE instance IDE instance
(FTP) (SSH)
Other code
(dashboard etc.)
IDE instance IDE instance
(Normal) (Normal)
Monday, October 22, 12