SlideShare une entreprise Scribd logo
1  sur  68
Télécharger pour lire hors ligne
BIG
                            application
                                design
Saturday, November 10, 12
@sergimansilla

Saturday, November 10, 12
http://c9.io




Saturday, November 10, 12
Smart code completion




Saturday, November 10, 12
Static analysis




Saturday, November 10, 12
Free linux VM


Saturday, November 10, 12
Bring your own machine
Saturday, November 10, 12
Real terminal
Saturday, November 10, 12
Hundreds of thousands
                        of lines of JavaScript



Saturday, November 10, 12
dynamic,
                            weakly-typed
                               language
Saturday, November 10, 12
one single thread


Saturday, November 10, 12
Openshift
    Cloud9 datacenter
                                Remote
                                  VM

                                Remote
                   IDE server
                                  VM

                                Remote
                                  VM


Saturday, November 10, 12
Saturday, November 10, 12
Saturday, November 10, 12
Modularization


Saturday, November 10, 12
Black box coding


Saturday, November 10, 12
Saturday, November 10, 12
re
 requi




                            Good at
                        abstracting away


Saturday, November 10, 12
re
 requi




          Not that good at
        app-level abstraction


Saturday, November 10, 12
re
 requi


                            Relies on FS
                              duplicated modules
                             maps to folder names
                            hard to configure module



Saturday, November 10, 12
Dependency error handling

     coding time            compile time   run time
                                                           !
                                                         OM
                                                 - BO
                                           KA

                                           - Server crash
                                           - Unhappy customers
                                           - Developer gets fired




Saturday, November 10, 12
How to fix it?

       Static dependency list        Resolve at startup

       Named services                No FS required

       Easy configuration            Pass an object




Saturday, November 10, 12
Architect




                            github.com/c9/architect

Saturday, November 10, 12
Architect
         Everything is a plugin
         Plugins can consume plugins
         An application is just a set of
         plugins


Saturday, November 10, 12
Dependency model

                    require        runtime

                   Architect   compile time


Saturday, November 10, 12
Dependency error handling
               Architect
  coding time               compile time              run time




                                                      - Happy customers
                             - Fails before release   - Developer keeps job




Saturday, November 10, 12
github.com/sergi/nodejsconfit2012




Saturday, November 10, 12
Saturday, November 10, 12
Declare entity ‘cook’ with behavior
       Use ‘cook’ to do some cooking




Saturday, November 10, 12
Dependency model


                                   Cooking
                            Cook
                                    action




Saturday, November 10, 12
package.json

                            Builds dependency tree

                            without
                            executing code


Saturday, November 10, 12
cook/package.json

                                       {
           do-­‐cooking/package.json

                                       {
Saturday, November 10, 12
Next

      Wrap in Architect plugin code
      Extract the code
      Make two plugins


Saturday, November 10, 12
Function
                                        signature




                            Call when
                              done

Saturday, November 10, 12
Architect plugin code


Module.exports
               Options - we’ll talk about it later
               Imports - everything you ‘consume’
               Register - call when done



Saturday, November 10, 12
Saturday, November 10, 12
Saturday, November 10, 12
Easy to test
                            Mock dependencies



Saturday, November 10, 12
‘cook’ should be called 8 times




Saturday, November 10, 12
No black magic

                        Specify dependency model
 Feed architect a config file
                                  Call ‘createApp’

Saturday, November 10, 12
Saturday, November 10, 12
Saturday, November 10, 12
Configuration

                           Per-plugin options
                     No global options object
                         Specify in config file

Saturday, November 10, 12
Saturday, November 10, 12
Saturday, November 10, 12
Options

                                     Passed in at startup
                            Options can be dependencies
                            Fail if options aren’t present


Saturday, November 10, 12
Saturday, November 10, 12
Saturday, November 10, 12
Your app as
          chunks of functionality
        rather than sets of classes


Saturday, November 10, 12
chunks of functionality


    Implicit type constraints
                            Keep implementation private
    Swap features instead of interfaces


Saturday, November 10, 12
How does Cloud9 use it?

                Open source version
                Local version (OS + sync)
                Hosted version
                       Normal
                       FTP
                       SSH
Saturday, November 10, 12
Saturday, November 10, 12
Swap feature per
                            implementation


               On OSS: talk local filesystem
               On FTP: talk FTP library
               On SSH: talk via a SSH bridge



Saturday, November 10, 12
Architect is a DI
                              framework


Saturday, November 10, 12
But a quite
                            special one


Saturday, November 10, 12
Single node.js process


                                       IDE instance   IDE instance
                                          (FTP)          (SSH)
                      Other code
                    (dashboard etc.)
                                       IDE instance   IDE instance
                                         (Normal)       (Normal)




Saturday, November 10, 12
Architect can do


                    Multiple instances of same plugin
                                     Run independently
                    But in the same process




Saturday, November 10, 12
Centralized event bus

       Loose coupling between plugins
       No hard dependencies!
       Can also do inter-context communication




Saturday, November 10, 12
React on event
           Other plugin




                                             Event
                                              bus



                                                     Emit event
                                                                  Plugin


Saturday, November 10, 12
Saturday, November 10, 12
Saturday, November 10, 12
And now scale


       Swap it with i.e. Redis PubSub
       Plugins will never notice
       Modular awesomeness!



Saturday, November 10, 12
Modularize in feature blocks


                Don’t over engineer
                Don’t create too small blocks
                They aren’t interfaces!




Saturday, November 10, 12
Avoid context switching


                Less code!
                Less errors!
                Less boilerplate!


Saturday, November 10, 12
Loose coupling

                            Use (don’t abuse) an event bus


                             Smaller dependency graph




Saturday, November 10, 12
github.com/c9/architect

Saturday, November 10, 12
Happy coding!

Saturday, November 10, 12
http://c9.io


                                        @sergimansilla
                                       github.com/sergi
Saturday, November 10, 12

Contenu connexe

Similaire à Big app design for Node.js

Rcos presentation
Rcos presentationRcos presentation
Rcos presentationmskmoorthy
 
ZFS and FreeBSD Jails
ZFS and FreeBSD JailsZFS and FreeBSD Jails
ZFS and FreeBSD Jailsapeiron
 
Multiplatform, Promises and HTML5
Multiplatform, Promises and HTML5Multiplatform, Promises and HTML5
Multiplatform, Promises and HTML5C4Media
 
Coding, Scaling, and Deploys... Oh My!
Coding, Scaling, and Deploys... Oh My!Coding, Scaling, and Deploys... Oh My!
Coding, Scaling, and Deploys... Oh My!Mark Jaquith
 
Inside the Atlassian OnDemand Private Cloud
Inside the Atlassian OnDemand Private CloudInside the Atlassian OnDemand Private Cloud
Inside the Atlassian OnDemand Private CloudAtlassian
 
Modern HTML & CSS Coding: Speed, Semantics & Structure
Modern HTML & CSS Coding: Speed, Semantics & StructureModern HTML & CSS Coding: Speed, Semantics & Structure
Modern HTML & CSS Coding: Speed, Semantics & StructureRaven Tools
 
Fast & Furious: Speed in the Opera browser
Fast & Furious: Speed in the Opera browserFast & Furious: Speed in the Opera browser
Fast & Furious: Speed in the Opera browserAndreas Bovens
 
Macruby - RubyConf Presentation 2010
Macruby - RubyConf Presentation 2010Macruby - RubyConf Presentation 2010
Macruby - RubyConf Presentation 2010Matt Aimonetti
 
Vinted life embetterment
Vinted life embettermentVinted life embetterment
Vinted life embettermentAgile Lietuva
 
Html5 new sword for interactive app
Html5 new sword for interactive appHtml5 new sword for interactive app
Html5 new sword for interactive appYohan Totting
 
Flex além do browser - Lightning talk qcon
Flex além do browser - Lightning talk qcon Flex além do browser - Lightning talk qcon
Flex além do browser - Lightning talk qcon David Paniz
 
Erlang for video delivery
Erlang for video deliveryErlang for video delivery
Erlang for video deliveryHugh Watkins
 
JS-Everywhere - SSE Hands-on
JS-Everywhere - SSE Hands-onJS-Everywhere - SSE Hands-on
JS-Everywhere - SSE Hands-onBrice Argenson
 
Building businesspost.ie using Node.js
Building businesspost.ie using Node.jsBuilding businesspost.ie using Node.js
Building businesspost.ie using Node.jsRichard Rodger
 
iOS Prototyping with Xcode Storyboards
iOS Prototyping with Xcode StoryboardsiOS Prototyping with Xcode Storyboards
iOS Prototyping with Xcode StoryboardsKyle Oba
 
DrupalCampNYC 10 - Native mobile apps with Drupal
DrupalCampNYC 10 - Native mobile apps with DrupalDrupalCampNYC 10 - Native mobile apps with Drupal
DrupalCampNYC 10 - Native mobile apps with Drupalzroger
 
Build and Deploy Sites Using Features
Build and Deploy Sites Using Features Build and Deploy Sites Using Features
Build and Deploy Sites Using Features Phase2
 

Similaire à Big app design for Node.js (20)

Rcos presentation
Rcos presentationRcos presentation
Rcos presentation
 
ZFS and FreeBSD Jails
ZFS and FreeBSD JailsZFS and FreeBSD Jails
ZFS and FreeBSD Jails
 
Multiplatform, Promises and HTML5
Multiplatform, Promises and HTML5Multiplatform, Promises and HTML5
Multiplatform, Promises and HTML5
 
Coding, Scaling, and Deploys... Oh My!
Coding, Scaling, and Deploys... Oh My!Coding, Scaling, and Deploys... Oh My!
Coding, Scaling, and Deploys... Oh My!
 
Inside the Atlassian OnDemand Private Cloud
Inside the Atlassian OnDemand Private CloudInside the Atlassian OnDemand Private Cloud
Inside the Atlassian OnDemand Private Cloud
 
Modern HTML & CSS Coding: Speed, Semantics & Structure
Modern HTML & CSS Coding: Speed, Semantics & StructureModern HTML & CSS Coding: Speed, Semantics & Structure
Modern HTML & CSS Coding: Speed, Semantics & Structure
 
Fast & Furious: Speed in the Opera browser
Fast & Furious: Speed in the Opera browserFast & Furious: Speed in the Opera browser
Fast & Furious: Speed in the Opera browser
 
Fluentd and WebHDFS
Fluentd and WebHDFSFluentd and WebHDFS
Fluentd and WebHDFS
 
Macruby - RubyConf Presentation 2010
Macruby - RubyConf Presentation 2010Macruby - RubyConf Presentation 2010
Macruby - RubyConf Presentation 2010
 
Vinted life embetterment
Vinted life embettermentVinted life embetterment
Vinted life embetterment
 
Html5 new sword for interactive app
Html5 new sword for interactive appHtml5 new sword for interactive app
Html5 new sword for interactive app
 
Wp7 gapmeetup
Wp7 gapmeetupWp7 gapmeetup
Wp7 gapmeetup
 
Mobile? WT... F?
Mobile? WT... F?Mobile? WT... F?
Mobile? WT... F?
 
Flex além do browser - Lightning talk qcon
Flex além do browser - Lightning talk qcon Flex além do browser - Lightning talk qcon
Flex além do browser - Lightning talk qcon
 
Erlang for video delivery
Erlang for video deliveryErlang for video delivery
Erlang for video delivery
 
JS-Everywhere - SSE Hands-on
JS-Everywhere - SSE Hands-onJS-Everywhere - SSE Hands-on
JS-Everywhere - SSE Hands-on
 
Building businesspost.ie using Node.js
Building businesspost.ie using Node.jsBuilding businesspost.ie using Node.js
Building businesspost.ie using Node.js
 
iOS Prototyping with Xcode Storyboards
iOS Prototyping with Xcode StoryboardsiOS Prototyping with Xcode Storyboards
iOS Prototyping with Xcode Storyboards
 
DrupalCampNYC 10 - Native mobile apps with Drupal
DrupalCampNYC 10 - Native mobile apps with DrupalDrupalCampNYC 10 - Native mobile apps with Drupal
DrupalCampNYC 10 - Native mobile apps with Drupal
 
Build and Deploy Sites Using Features
Build and Deploy Sites Using Features Build and Deploy Sites Using Features
Build and Deploy Sites Using Features
 

Dernier

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 

Dernier (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

Big app design for Node.js