SlideShare a Scribd company logo
1 of 34
Download to read offline
Building
                    businesspost.ie

                    Richard Rodger
                    @rjrodger
Friday 9 November 2012
businesspost.ie




Friday 9 November 2012
Everything
                    JavaScript.
Friday 9 November 2012
So, how do you
       build it?
       ‣have a common code-base,
       ‣be service-oriented,
       ‣use small, independent pieces.
Friday 9 November 2012
Web
                 Mobile                     Cloud
                              Services
                Web Apps                   Services
                                API


                  Mobile &      REST &
                                            Database
                 Tablet Web      JSON

                 Mobile &     Horizontal   Third Party
                Tablet Apps     Scale       Services

                   Desktop     Cloud
                                           Monitoring
                    Web        Hosted
Friday 9 November 2012
Client-side
                         Router   #! URLs
                                                    • Common code-base
                                                     • even for hybrid apps!
                     Models       Data, biz logic
                                                    • backbone.js
                                                    • shims for weak browsers
                         Views    DOM Layout
                                                    • browser-targeting: user-
                                                      agent & capabilities

                                                    • responsive layout
                                                      (mostly)
                    Helpers       Shared code


Friday 9 November 2012
Running...
               1. Load
               static       2. Init shared
               index.html   code, then       3. Init
               and assets   targeted         router, and   4. Wait for
                            code             display as    events
                                             per #! URL




Friday 9 November 2012
Native Apps
    Same code as mobile web versions, ...
     ... wrapped using PhoneGap to run natively
     ... plus some native plugins




Friday 9 November 2012
Server-side
                                  map /api/ URLs       • nginx & Node.js
                         Router
                                  to functions         • Small code volume
                      API         function( req,       • Third party modules:
                   functions      res ) { ... }         • connect
                                  Shared code
                                                        • express
                     Helpers      (some with client)    • seneca
                                  Open source
                                                       • Deploy with:
                    Modules       heavy-lifting         • sudo killall node
Friday 9 November 2012
Running...
               1. Connect
               to databases   2. Route
               and listen     HTTP            3. Talk to
               for HTTP       requests to     database,    4. Send
                              API functions   wait for     JSON back
                                              callback     to client




Friday 9 November 2012
Callback Style
         this is the common language of
         Node.js - always use it!
         doSomething( input, function( error, output ) {
            ...
         })




Friday 9 November 2012
Error Pattern
         use functional style avoid
         if statements everywhere
         function wraperror( success ) {
           return function( err, result ) {
             if( err ) return handleError( err );
             else      return success( result );
           }
         }

         database.doQuery( wraperror( function( result ) {
           doRealWork( result );
         }))


Friday 9 November 2012
Cloud Services
                 Database        Hosting    Monitors



                  MongoDB        Amazon      Amazon

                                  Load
                         Redis              cloudkick
                                 Balancer

                                 Instance
                memcached                   Continuous
                                  Scaling
Friday 9 November 2012
Integrations...
    JSON, XML, simple form data, text files, ...
      ... all easy using JavaScript and Node.js Modules


                   Analytics     Twitter    E-Commerce

                                               In-App
                     Logging     Facebook
                                             Purchasing

                         Email   LinkedIn   Stock Feed

Friday 9 November 2012
Lots of Little
                    Processes
                    ‣Web API       ‣Admin site
                    ‣RSS reader ‣Search index
                    ‣Image resizer ‣Sitemap
Friday 9 November 2012
Use queues!
                    This is how
                    processes talk.
Friday 9 November 2012
Example!
         news reader finds an image...
         ... and pushes it onto queue
         redis.publish("images", "/storage/img1234.jpg");




         then image processor resizes...
         redis.subscribe("images");
         redis.on("message", function(channel, message) {
           resizeImage( message ) // message == "/storage/img1234.jpg"
         });


Friday 9 November 2012
Node.js
                    modules.
Friday 9 November 2012
Write small
                    modules,
                    not big apps!
Friday 9 November 2012
businesspost.ie
                    modules
                    ‣underscore,
                    ‣connect,
                    ‣express,
                    ‣appgen,
                    ‣seneca
Friday 9 November 2012
underscore
            module
            ‣npm install underscore
            ‣underscorejs.org
            ‣do functional programming
            ‣provides "missing" JS features
            ‣useful for handling arrays, objects
Friday 9 November 2012
connect
            module
            ‣npm install connect
            ‣senchalabs.org/connect
            ‣build web services
            ‣provides "middleware" pattern
            ‣useful for HTTP request handling
Friday 9 November 2012
express
            module
            ‣npm install express
            ‣expressjs.com
            ‣build websites
            ‣provides HTML page handling
            ‣useful for building dynamic sites
Friday 9 November 2012
appgen
            module
            ‣npm install appgen
            ‣appgenjs.org
            ‣build multi-platform web apps
            ‣generates multiple code versions
            ‣useful for organizing platform code
Friday 9 November 2012
seneca
            module
            ‣npm install seneca
            ‣senecajs.org
            ‣build business logic
            ‣provides "command" pattern
            ‣useful for organizing features
Friday 9 November 2012
businesspost.ie
                    lessons.

Friday 9 November 2012
Lesson:




Friday 9 November 2012
Lesson:
                                    code volume
                  4

                  3

                  2

                  1

                  0
                         Client JavaScript   Server JavaScript




Friday 9 November 2012
Lesson:
    multi-platform client-side JavaScript is really hard

        • a framework is a must           • code against ECMA, use shims
                                             to support older browsers
         • backbone.js                    • Code/Test/Debug inside Safari
        • business logic must be in       • phonegap.github.com/weinre for
                common code                  hard to reach places
        • browser-specific code        • use error capture in production
         • virtual .js files           • Finally, use a simple static site as
                                        a fallback (also for Googlebot)
        • use jshint to keep IE happy • appgen module helps!
Friday 9 November 2012
Lesson:
    multi-platform HTML/CSS is really hard

        • "structured" CSS is a must   • Clean, semantic HTML is not
                                          optional
         • sass or less                 • graceful degradation may
        • Be happy with                     require radically different CSS

                                       • 100% "Responsive" design is tough
         • media queries                • Responsive within browser
         • CSS3 transforms                  subsets has higher reward/effort

        • browser-specific code         •appgen module helps!
         • virtual .css files
Friday 9 November 2012
Lesson:
    the app stores are not web sites

        • that bug in version one... • you can't deploy hot fixes
         • will take two weeks to • make everything
                     fix via an update     configurable!

              • some users will never    • All prices, text, host
                     update                 names, urls, ...

              • appears after an OS     • On launch, app "checks-in"
                     update               for new configuration

                                         • this will save your life
Friday 9 November 2012
Lesson:
    Node.js is awesome!

        • High performance             • callback spaghetti is not a
                                          problem in practice
        • High throughput
        • Low CPU usage                  • use functional style
        • Constant memory usage          • client-side code is far
                                            more difficult
         • leaks will kill, but then
        • < 100ms startup time         • Don't do CPU intensive
                                          stuff
         • means you may not
                     notice!             • Node.js is not for that
Friday 9 November 2012
Lesson:
    Small processes can save your life

        • Prevents total failure even if
                other systems fail
                                            • Memory leaks are not
                                              a disaster - just restart!
        • Easy to scale - just move to      • Use queues in
                new machines
                                              preference to direct
        • Easy to code - you get small,       communication
                single purpose code bases

        • Easy to manage - even             • Easy to divide up work
                traditional process
                                              between developers
                management will get you a
                long way
Friday 9 November 2012
Thank You!
                    Richard Rodger
                    @rjrodger
Friday 9 November 2012

More Related Content

What's hot

What's hot (20)

Cloud Native (Bert Ertman)
Cloud Native (Bert Ertman)Cloud Native (Bert Ertman)
Cloud Native (Bert Ertman)
 
Virtual Desktops on AWS by Mike Burke, Farm Credit Canada
Virtual Desktops on AWS by Mike Burke, Farm Credit CanadaVirtual Desktops on AWS by Mike Burke, Farm Credit Canada
Virtual Desktops on AWS by Mike Burke, Farm Credit Canada
 
Understanding serverless architecture
Understanding serverless architectureUnderstanding serverless architecture
Understanding serverless architecture
 
Debunking serverless myths
Debunking serverless mythsDebunking serverless myths
Debunking serverless myths
 
Software Process... the good parts
Software Process... the good partsSoftware Process... the good parts
Software Process... the good parts
 
devops, platforms and devops platforms
devops, platforms and devops platformsdevops, platforms and devops platforms
devops, platforms and devops platforms
 
Let's Program The Cloud
Let's Program The CloudLet's Program The Cloud
Let's Program The Cloud
 
Serverless is more FinDev than DevOps
Serverless is more FinDev than DevOpsServerless is more FinDev than DevOps
Serverless is more FinDev than DevOps
 
Stuff About CQRS
Stuff About CQRSStuff About CQRS
Stuff About CQRS
 
Moving to Microservices with the Help of Distributed Traces
Moving to Microservices with the Help of Distributed TracesMoving to Microservices with the Help of Distributed Traces
Moving to Microservices with the Help of Distributed Traces
 
How to build a social network on serverless
How to build a social network on serverlessHow to build a social network on serverless
How to build a social network on serverless
 
Real-world Microservices: Lessons from the Front Line - Zhamak Delghani, Thou...
Real-world Microservices: Lessons from the Front Line - Zhamak Delghani, Thou...Real-world Microservices: Lessons from the Front Line - Zhamak Delghani, Thou...
Real-world Microservices: Lessons from the Front Line - Zhamak Delghani, Thou...
 
Eric_Gales_Amazon_June_9_2017_presentation
Eric_Gales_Amazon_June_9_2017_presentationEric_Gales_Amazon_June_9_2017_presentation
Eric_Gales_Amazon_June_9_2017_presentation
 
Open is as Open does
Open is as Open doesOpen is as Open does
Open is as Open does
 
The Journey from Monolith to Microservices: a Guided Adventure
The Journey from Monolith to Microservices: a Guided AdventureThe Journey from Monolith to Microservices: a Guided Adventure
The Journey from Monolith to Microservices: a Guided Adventure
 
Spider Architecture
Spider ArchitectureSpider Architecture
Spider Architecture
 
Lies Enterprise Architects Tell - Data Day Texas 2018 Keynote
Lies Enterprise Architects Tell - Data Day Texas 2018  Keynote Lies Enterprise Architects Tell - Data Day Texas 2018  Keynote
Lies Enterprise Architects Tell - Data Day Texas 2018 Keynote
 
Better and Faster: A Journey Toward Clean Code and Enjoyment
Better and Faster: A Journey Toward Clean Code and EnjoymentBetter and Faster: A Journey Toward Clean Code and Enjoyment
Better and Faster: A Journey Toward Clean Code and Enjoyment
 
SACon 2019 - Surviving in a Microservices Environment
SACon 2019 - Surviving in a Microservices EnvironmentSACon 2019 - Surviving in a Microservices Environment
SACon 2019 - Surviving in a Microservices Environment
 
How to build a social network on Serverless (AWS Community Summit)
How to build a social network on Serverless (AWS Community Summit)How to build a social network on Serverless (AWS Community Summit)
How to build a social network on Serverless (AWS Community Summit)
 

Viewers also liked

5-3 SlopeInterceptForm.pdf
5-3 SlopeInterceptForm.pdf5-3 SlopeInterceptForm.pdf
5-3 SlopeInterceptForm.pdf
LomasAlg1
 
Автоматизация гостиниц на оборудовании HDL Buspro
Автоматизация гостиниц на оборудовании HDL BusproАвтоматизация гостиниц на оборудовании HDL Buspro
Автоматизация гостиниц на оборудовании HDL Buspro
Андрей Павлов
 
Ofrecimiento Servicios Web Linkedin
Ofrecimiento Servicios Web LinkedinOfrecimiento Servicios Web Linkedin
Ofrecimiento Servicios Web Linkedin
jjmconsultores
 
Cultos y-procesiones-2012
Cultos y-procesiones-2012Cultos y-procesiones-2012
Cultos y-procesiones-2012
FRAPEMA
 
150608 Nkonki SOC Integrated reporting Brochure print version
150608 Nkonki SOC Integrated reporting Brochure print version150608 Nkonki SOC Integrated reporting Brochure print version
150608 Nkonki SOC Integrated reporting Brochure print version
Deborah Chapman
 

Viewers also liked (20)

5-3 SlopeInterceptForm.pdf
5-3 SlopeInterceptForm.pdf5-3 SlopeInterceptForm.pdf
5-3 SlopeInterceptForm.pdf
 
Email Deliverability
Email DeliverabilityEmail Deliverability
Email Deliverability
 
Lces joy hughes
Lces   joy hughesLces   joy hughes
Lces joy hughes
 
Автоматизация гостиниц на оборудовании HDL Buspro
Автоматизация гостиниц на оборудовании HDL BusproАвтоматизация гостиниц на оборудовании HDL Buspro
Автоматизация гостиниц на оборудовании HDL Buspro
 
Contaminacion
ContaminacionContaminacion
Contaminacion
 
2014 2015 ieee java projects lists
2014 2015 ieee java projects lists2014 2015 ieee java projects lists
2014 2015 ieee java projects lists
 
Ofrecimiento Servicios Web Linkedin
Ofrecimiento Servicios Web LinkedinOfrecimiento Servicios Web Linkedin
Ofrecimiento Servicios Web Linkedin
 
Amplify Your Customer Success With User Reviews
Amplify Your Customer Success With User ReviewsAmplify Your Customer Success With User Reviews
Amplify Your Customer Success With User Reviews
 
El Pla Local d’Adaptació al Canvi Climàtic de Girona
El Pla Local d’Adaptació al Canvi Climàtic de GironaEl Pla Local d’Adaptació al Canvi Climàtic de Girona
El Pla Local d’Adaptació al Canvi Climàtic de Girona
 
Matria nº 7
Matria nº 7Matria nº 7
Matria nº 7
 
Identidad y comunicacion conceptos basicos comunicacion - clase 01
Identidad y comunicacion   conceptos basicos comunicacion - clase 01Identidad y comunicacion   conceptos basicos comunicacion - clase 01
Identidad y comunicacion conceptos basicos comunicacion - clase 01
 
Rossi cap2-esp
Rossi cap2-espRossi cap2-esp
Rossi cap2-esp
 
Cultos y-procesiones-2012
Cultos y-procesiones-2012Cultos y-procesiones-2012
Cultos y-procesiones-2012
 
Nachdenkliches zu VWL
Nachdenkliches zu VWLNachdenkliches zu VWL
Nachdenkliches zu VWL
 
Rotulado 2011 mar uba
Rotulado 2011 mar ubaRotulado 2011 mar uba
Rotulado 2011 mar uba
 
Theory, application &amp; operation of frameless motor technology webinar 02 ...
Theory, application &amp; operation of frameless motor technology webinar 02 ...Theory, application &amp; operation of frameless motor technology webinar 02 ...
Theory, application &amp; operation of frameless motor technology webinar 02 ...
 
Guia de prestaciones 2013
Guia de prestaciones 2013Guia de prestaciones 2013
Guia de prestaciones 2013
 
PDF, PPS, RTF
PDF, PPS, RTFPDF, PPS, RTF
PDF, PPS, RTF
 
UTILIDAD DE LA ECOGRAFIA EN INFLAMACIÓN DERMATOLÓGICA
UTILIDAD DE LA ECOGRAFIA EN INFLAMACIÓN DERMATOLÓGICAUTILIDAD DE LA ECOGRAFIA EN INFLAMACIÓN DERMATOLÓGICA
UTILIDAD DE LA ECOGRAFIA EN INFLAMACIÓN DERMATOLÓGICA
 
150608 Nkonki SOC Integrated reporting Brochure print version
150608 Nkonki SOC Integrated reporting Brochure print version150608 Nkonki SOC Integrated reporting Brochure print version
150608 Nkonki SOC Integrated reporting Brochure print version
 

Similar to Building businesspost.ie using Node.js

Node.js and the MEAN Stack Building Full-Stack Web Applications.pdf
Node.js and the MEAN Stack Building Full-Stack Web Applications.pdfNode.js and the MEAN Stack Building Full-Stack Web Applications.pdf
Node.js and the MEAN Stack Building Full-Stack Web Applications.pdf
lubnayasminsebl
 
Linkedinmobile 111011223417-phpapp02
Linkedinmobile 111011223417-phpapp02Linkedinmobile 111011223417-phpapp02
Linkedinmobile 111011223417-phpapp02
htdvul
 
Owasp App Sec Ireland Windows Phone 7 Security
Owasp App Sec Ireland Windows Phone 7 SecurityOwasp App Sec Ireland Windows Phone 7 Security
Owasp App Sec Ireland Windows Phone 7 Security
Security Ninja
 

Similar to Building businesspost.ie using Node.js (20)

Cloud Camp Chicago Dec 2012 Slides
Cloud Camp Chicago Dec 2012 SlidesCloud Camp Chicago Dec 2012 Slides
Cloud Camp Chicago Dec 2012 Slides
 
Cloud Camp Chicago Dec 2012 - All presentations
Cloud Camp Chicago Dec 2012 - All presentationsCloud Camp Chicago Dec 2012 - All presentations
Cloud Camp Chicago Dec 2012 - All presentations
 
CloudFoundry and MongoDb, a marriage made in heaven
CloudFoundry and MongoDb, a marriage made in heavenCloudFoundry and MongoDb, a marriage made in heaven
CloudFoundry and MongoDb, a marriage made in heaven
 
20120802 timisoara
20120802 timisoara20120802 timisoara
20120802 timisoara
 
20120306 dublin js
20120306 dublin js20120306 dublin js
20120306 dublin js
 
Node.js and the MEAN Stack Building Full-Stack Web Applications.pdf
Node.js and the MEAN Stack Building Full-Stack Web Applications.pdfNode.js and the MEAN Stack Building Full-Stack Web Applications.pdf
Node.js and the MEAN Stack Building Full-Stack Web Applications.pdf
 
Standard Issue: Preparing for the Future of Data Management
Standard Issue: Preparing for the Future of Data ManagementStandard Issue: Preparing for the Future of Data Management
Standard Issue: Preparing for the Future of Data Management
 
Building node.js applications on windows azure
Building node.js applications on windows azureBuilding node.js applications on windows azure
Building node.js applications on windows azure
 
IDEALIZE 2023 - NodeJS & Firebase Session
IDEALIZE 2023 - NodeJS & Firebase SessionIDEALIZE 2023 - NodeJS & Firebase Session
IDEALIZE 2023 - NodeJS & Firebase Session
 
Droidcon event 2015 Bangalore
Droidcon event 2015 BangaloreDroidcon event 2015 Bangalore
Droidcon event 2015 Bangalore
 
Linkedinmobile 111011223417-phpapp02
Linkedinmobile 111011223417-phpapp02Linkedinmobile 111011223417-phpapp02
Linkedinmobile 111011223417-phpapp02
 
LinkedIn Mobile: How do we do it?
LinkedIn Mobile: How do we do it?LinkedIn Mobile: How do we do it?
LinkedIn Mobile: How do we do it?
 
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other ThingsI Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
 
Cloud4all Architecture Overview
Cloud4all Architecture OverviewCloud4all Architecture Overview
Cloud4all Architecture Overview
 
Building an E-commerce website in MEAN stack
Building an E-commerce website in MEAN stackBuilding an E-commerce website in MEAN stack
Building an E-commerce website in MEAN stack
 
A Journey Begin with Node.js
A Journey Begin with Node.jsA Journey Begin with Node.js
A Journey Begin with Node.js
 
Administration for Oracle ADF Applications
Administration for Oracle ADF ApplicationsAdministration for Oracle ADF Applications
Administration for Oracle ADF Applications
 
Administration von ADF Anwendungen
Administration von ADF AnwendungenAdministration von ADF Anwendungen
Administration von ADF Anwendungen
 
Owasp App Sec Ireland Windows Phone 7 Security
Owasp App Sec Ireland Windows Phone 7 SecurityOwasp App Sec Ireland Windows Phone 7 Security
Owasp App Sec Ireland Windows Phone 7 Security
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
 

More from Richard Rodger

Using RAG to create your own Podcast conversations.pdf
Using RAG to create your own Podcast conversations.pdfUsing RAG to create your own Podcast conversations.pdf
Using RAG to create your own Podcast conversations.pdf
Richard Rodger
 
Richard_TheDev2023_pattern.pptx.pdf
Richard_TheDev2023_pattern.pptx.pdfRichard_TheDev2023_pattern.pptx.pdf
Richard_TheDev2023_pattern.pptx.pdf
Richard Rodger
 
richard-rodger-awssofia-microservices-2019.pdf
richard-rodger-awssofia-microservices-2019.pdfrichard-rodger-awssofia-microservices-2019.pdf
richard-rodger-awssofia-microservices-2019.pdf
Richard Rodger
 
richardrodger-microservice-algebra-cluj-apr.pdf
richardrodger-microservice-algebra-cluj-apr.pdfrichardrodger-microservice-algebra-cluj-apr.pdf
richardrodger-microservice-algebra-cluj-apr.pdf
Richard Rodger
 
richardrodger-designing-microservices-london-may.pdf
richardrodger-designing-microservices-london-may.pdfrichardrodger-designing-microservices-london-may.pdf
richardrodger-designing-microservices-london-may.pdf
Richard Rodger
 
richardrodger-designing-microservices-london-may.pdf
richardrodger-designing-microservices-london-may.pdfrichardrodger-designing-microservices-london-may.pdf
richardrodger-designing-microservices-london-may.pdf
Richard Rodger
 
richardrodger-microservice-risk-dublin-mar.pdf
richardrodger-microservice-risk-dublin-mar.pdfrichardrodger-microservice-risk-dublin-mar.pdf
richardrodger-microservice-risk-dublin-mar.pdf
Richard Rodger
 
richardrodger-service-discovery-waterford-feb.pdf
richardrodger-service-discovery-waterford-feb.pdfrichardrodger-service-discovery-waterford-feb.pdf
richardrodger-service-discovery-waterford-feb.pdf
Richard Rodger
 
How to Write Big Apps (Richard Rodger NodeDublin 2012)
How to Write Big Apps (Richard Rodger NodeDublin 2012)How to Write Big Apps (Richard Rodger NodeDublin 2012)
How to Write Big Apps (Richard Rodger NodeDublin 2012)
Richard Rodger
 
Richard rodger-appgen-2012-lxjs-lisbon
Richard rodger-appgen-2012-lxjs-lisbonRichard rodger-appgen-2012-lxjs-lisbon
Richard rodger-appgen-2012-lxjs-lisbon
Richard Rodger
 

More from Richard Rodger (20)

Using RAG to create your own Podcast conversations.pdf
Using RAG to create your own Podcast conversations.pdfUsing RAG to create your own Podcast conversations.pdf
Using RAG to create your own Podcast conversations.pdf
 
Richard_TheDev2023_pattern.pptx.pdf
Richard_TheDev2023_pattern.pptx.pdfRichard_TheDev2023_pattern.pptx.pdf
Richard_TheDev2023_pattern.pptx.pdf
 
richard-rodger-awssofia-microservices-2019.pdf
richard-rodger-awssofia-microservices-2019.pdfrichard-rodger-awssofia-microservices-2019.pdf
richard-rodger-awssofia-microservices-2019.pdf
 
richardrodger-microservice-algebra-cluj-apr.pdf
richardrodger-microservice-algebra-cluj-apr.pdfrichardrodger-microservice-algebra-cluj-apr.pdf
richardrodger-microservice-algebra-cluj-apr.pdf
 
richardrodger-designing-microservices-london-may.pdf
richardrodger-designing-microservices-london-may.pdfrichardrodger-designing-microservices-london-may.pdf
richardrodger-designing-microservices-london-may.pdf
 
richardrodger-designing-microservices-london-may.pdf
richardrodger-designing-microservices-london-may.pdfrichardrodger-designing-microservices-london-may.pdf
richardrodger-designing-microservices-london-may.pdf
 
richardrodger-microservice-risk-dublin-mar.pdf
richardrodger-microservice-risk-dublin-mar.pdfrichardrodger-microservice-risk-dublin-mar.pdf
richardrodger-microservice-risk-dublin-mar.pdf
 
richardrodger-service-discovery-waterford-feb.pdf
richardrodger-service-discovery-waterford-feb.pdfrichardrodger-service-discovery-waterford-feb.pdf
richardrodger-service-discovery-waterford-feb.pdf
 
richardrodger-vespa-waterford-oct.pdf
richardrodger-vespa-waterford-oct.pdfrichardrodger-vespa-waterford-oct.pdf
richardrodger-vespa-waterford-oct.pdf
 
Richardrodger designing-microservices-uxdx-dublin-oct
Richardrodger designing-microservices-uxdx-dublin-octRichardrodger designing-microservices-uxdx-dublin-oct
Richardrodger designing-microservices-uxdx-dublin-oct
 
How microservices fail, and what to do about it
How microservices fail, and what to do about itHow microservices fail, and what to do about it
How microservices fail, and what to do about it
 
Richardrodger nodeday-2014-final
Richardrodger nodeday-2014-finalRichardrodger nodeday-2014-final
Richardrodger nodeday-2014-final
 
Richardrodger microxchgio-feb-2015-final
Richardrodger microxchgio-feb-2015-finalRichardrodger microxchgio-feb-2015-final
Richardrodger microxchgio-feb-2015-final
 
Micro-services Battle Scars
Micro-services Battle ScarsMicro-services Battle Scars
Micro-services Battle Scars
 
Richard rodger technical debt - web summit 2013
Richard rodger   technical debt - web summit 2013Richard rodger   technical debt - web summit 2013
Richard rodger technical debt - web summit 2013
 
The Seneca Pattern at EngineYard Distill 2013 Conference
The Seneca Pattern at EngineYard Distill 2013 ConferenceThe Seneca Pattern at EngineYard Distill 2013 Conference
The Seneca Pattern at EngineYard Distill 2013 Conference
 
How to Write Big Apps (Richard Rodger NodeDublin 2012)
How to Write Big Apps (Richard Rodger NodeDublin 2012)How to Write Big Apps (Richard Rodger NodeDublin 2012)
How to Write Big Apps (Richard Rodger NodeDublin 2012)
 
Richard rodger-appgen-2012-lxjs-lisbon
Richard rodger-appgen-2012-lxjs-lisbonRichard rodger-appgen-2012-lxjs-lisbon
Richard rodger-appgen-2012-lxjs-lisbon
 
20120816 nodejsdublin
20120816 nodejsdublin20120816 nodejsdublin
20120816 nodejsdublin
 
20120514 nodejsdublin
20120514 nodejsdublin20120514 nodejsdublin
20120514 nodejsdublin
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
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
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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?
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Building businesspost.ie using Node.js

  • 1. Building businesspost.ie Richard Rodger @rjrodger Friday 9 November 2012
  • 3. Everything JavaScript. Friday 9 November 2012
  • 4. So, how do you build it? ‣have a common code-base, ‣be service-oriented, ‣use small, independent pieces. Friday 9 November 2012
  • 5. Web Mobile Cloud Services Web Apps Services API Mobile & REST & Database Tablet Web JSON Mobile & Horizontal Third Party Tablet Apps Scale Services Desktop Cloud Monitoring Web Hosted Friday 9 November 2012
  • 6. Client-side Router #! URLs • Common code-base • even for hybrid apps! Models Data, biz logic • backbone.js • shims for weak browsers Views DOM Layout • browser-targeting: user- agent & capabilities • responsive layout (mostly) Helpers Shared code Friday 9 November 2012
  • 7. Running... 1. Load static 2. Init shared index.html code, then 3. Init and assets targeted router, and 4. Wait for code display as events per #! URL Friday 9 November 2012
  • 8. Native Apps Same code as mobile web versions, ... ... wrapped using PhoneGap to run natively ... plus some native plugins Friday 9 November 2012
  • 9. Server-side map /api/ URLs • nginx & Node.js Router to functions • Small code volume API function( req, • Third party modules: functions res ) { ... } • connect Shared code • express Helpers (some with client) • seneca Open source • Deploy with: Modules heavy-lifting • sudo killall node Friday 9 November 2012
  • 10. Running... 1. Connect to databases 2. Route and listen HTTP 3. Talk to for HTTP requests to database, 4. Send API functions wait for JSON back callback to client Friday 9 November 2012
  • 11. Callback Style this is the common language of Node.js - always use it! doSomething( input, function( error, output ) { ... }) Friday 9 November 2012
  • 12. Error Pattern use functional style avoid if statements everywhere function wraperror( success ) { return function( err, result ) { if( err ) return handleError( err ); else return success( result ); } } database.doQuery( wraperror( function( result ) { doRealWork( result ); })) Friday 9 November 2012
  • 13. Cloud Services Database Hosting Monitors MongoDB Amazon Amazon Load Redis cloudkick Balancer Instance memcached Continuous Scaling Friday 9 November 2012
  • 14. Integrations... JSON, XML, simple form data, text files, ... ... all easy using JavaScript and Node.js Modules Analytics Twitter E-Commerce In-App Logging Facebook Purchasing Email LinkedIn Stock Feed Friday 9 November 2012
  • 15. Lots of Little Processes ‣Web API ‣Admin site ‣RSS reader ‣Search index ‣Image resizer ‣Sitemap Friday 9 November 2012
  • 16. Use queues! This is how processes talk. Friday 9 November 2012
  • 17. Example! news reader finds an image... ... and pushes it onto queue redis.publish("images", "/storage/img1234.jpg"); then image processor resizes... redis.subscribe("images"); redis.on("message", function(channel, message) { resizeImage( message ) // message == "/storage/img1234.jpg" }); Friday 9 November 2012
  • 18. Node.js modules. Friday 9 November 2012
  • 19. Write small modules, not big apps! Friday 9 November 2012
  • 20. businesspost.ie modules ‣underscore, ‣connect, ‣express, ‣appgen, ‣seneca Friday 9 November 2012
  • 21. underscore module ‣npm install underscore ‣underscorejs.org ‣do functional programming ‣provides "missing" JS features ‣useful for handling arrays, objects Friday 9 November 2012
  • 22. connect module ‣npm install connect ‣senchalabs.org/connect ‣build web services ‣provides "middleware" pattern ‣useful for HTTP request handling Friday 9 November 2012
  • 23. express module ‣npm install express ‣expressjs.com ‣build websites ‣provides HTML page handling ‣useful for building dynamic sites Friday 9 November 2012
  • 24. appgen module ‣npm install appgen ‣appgenjs.org ‣build multi-platform web apps ‣generates multiple code versions ‣useful for organizing platform code Friday 9 November 2012
  • 25. seneca module ‣npm install seneca ‣senecajs.org ‣build business logic ‣provides "command" pattern ‣useful for organizing features Friday 9 November 2012
  • 26. businesspost.ie lessons. Friday 9 November 2012
  • 28. Lesson: code volume 4 3 2 1 0 Client JavaScript Server JavaScript Friday 9 November 2012
  • 29. Lesson: multi-platform client-side JavaScript is really hard • a framework is a must • code against ECMA, use shims to support older browsers • backbone.js • Code/Test/Debug inside Safari • business logic must be in • phonegap.github.com/weinre for common code hard to reach places • browser-specific code • use error capture in production • virtual .js files • Finally, use a simple static site as a fallback (also for Googlebot) • use jshint to keep IE happy • appgen module helps! Friday 9 November 2012
  • 30. Lesson: multi-platform HTML/CSS is really hard • "structured" CSS is a must • Clean, semantic HTML is not optional • sass or less • graceful degradation may • Be happy with require radically different CSS • 100% "Responsive" design is tough • media queries • Responsive within browser • CSS3 transforms subsets has higher reward/effort • browser-specific code •appgen module helps! • virtual .css files Friday 9 November 2012
  • 31. Lesson: the app stores are not web sites • that bug in version one... • you can't deploy hot fixes • will take two weeks to • make everything fix via an update configurable! • some users will never • All prices, text, host update names, urls, ... • appears after an OS • On launch, app "checks-in" update for new configuration • this will save your life Friday 9 November 2012
  • 32. Lesson: Node.js is awesome! • High performance • callback spaghetti is not a problem in practice • High throughput • Low CPU usage • use functional style • Constant memory usage • client-side code is far more difficult • leaks will kill, but then • < 100ms startup time • Don't do CPU intensive stuff • means you may not notice! • Node.js is not for that Friday 9 November 2012
  • 33. Lesson: Small processes can save your life • Prevents total failure even if other systems fail • Memory leaks are not a disaster - just restart! • Easy to scale - just move to • Use queues in new machines preference to direct • Easy to code - you get small, communication single purpose code bases • Easy to manage - even • Easy to divide up work traditional process between developers management will get you a long way Friday 9 November 2012
  • 34. Thank You! Richard Rodger @rjrodger Friday 9 November 2012