SlideShare a Scribd company logo
1 of 45
Download to read offline
YOU WILL REGRET THIS!
                          My Other Mood is 'Even More Angry'




Friday, June 10, 2011
I'M GONNA TELL YOU A STORY
                        In which I tell you how to behave
                                                            - how dare I?


Friday, June 10, 2011
SOCKET.IO-ERLANG


    • Developed              by Yurii Rashkovskii, Omar Yasin, Fred Hebert (me)

    • Used              as a base demo app for this presentation

    • Allows             to write neat front-ends for conversational websites




Friday, June 10, 2011
BIZARRO SOCKET.IO-ERLANG



    • 'Bad'             socket.io-erlang used for the presentation

    • Freely  substitutes dependencies and actual code for whatever
        purpose I have




Friday, June 10, 2011
APP STRUCTURE




Friday, June 10, 2011
APP STRUCTURE
                                Bunch of supervisors




Friday, June 10, 2011
APP STRUCTURE
                                Bunch of supervisors



                 web server




Friday, June 10, 2011
APP STRUCTURE
                                Bunch of supervisors


                                 transport handlers
                 web server




Friday, June 10, 2011
APP STRUCTURE
                                Bunch of supervisors
          Client code
         attaches here
                                 transport handlers
                 web server




Friday, June 10, 2011
WE USE A WEB SERVER


    • We    need a web server (the slide's title says just that (and also
        the previous slide))

    • Oh, Carrying             parameters and a connection around is
        annoying!

    • Let's             use parametrised modules!



Friday, June 10, 2011
PARAMETRISED MODULES

                        -­‐module(test_module,	
  [Param1]).
                        some_method()	
  -­‐>	
  Param1.

                                     Equivalent to:

                        -­‐module(test_non_pmod).
                        some_method(Param1)	
  -­‐>	
  Param1.



Friday, June 10, 2011
PARAMETRISED MODULES

             1> X = test_module:new(horror),
             X:some_method().
             horror

             2> test_non_pmod:some_method(sane).
             sane




Friday, June 10, 2011
PARAMETRISED MODULES

    • They              are great!

    • We   can use them as if they
        were objects!

    • They   let us carry everything
        as one large parameter!

    • Let's             do this!


Friday, June 10, 2011
PARAMETRISED MODULES

    • They              are great!

    • We   can use them as if they
        were objects!

    • They   let us carry everything
        as one large parameter!

    • Let's             do this!


Friday, June 10, 2011
What?


Friday, June 10, 2011
I'LL TELL YOU WHAT

              3> dbg:tp({X, some_method, 0}, [...]).
              ** exception error: no case clause matching
              {test_module,horror}

              4> dbg:tp({test_module, some_method, 0}, [...]).
              * never matches anything *

              5> dbg:tp({test_module, some_method, 1}, [...]).
              * will actually match stuff *




Friday, June 10, 2011
What is this I don't even...



Friday, June 10, 2011
I'LL TELL YOU WHAT

    •   The parameters are global and they ghost values, become implicit
        function arguments. Errors out of nowhere.

    •   They're based on a old fun hack ({Mod, Fun}:(Args))

    •   They mess up the concept of arity

    •   They mess up tracing (previous slide!)

    •   They were added because some library accepts callback modules and
        nothing else but might still need state around. No other reason.

Friday, June 10, 2011
I'll use them anyway
                        (in my server)




Friday, June 10, 2011
YOU PROBABLY SHOULDN'T
                        But you might not have a choice, so let's keep going

Friday, June 10, 2011
WHAT ELSE DO WE HAVE?

    •A         supervision tree, of course!

    • Some    of the supervisors are tricky and must interact with
        servers and dynamic children and ...

    • Who               starts who? By which API?

    • We    could probably just forget about supervisors, link stuff
        together and make it simpler

    • Let's             do this!

Friday, June 10, 2011
IN THIS VERY SLIDE I PRETEND
          I MAKE THE CHANGES
Friday, June 10, 2011
APP STRUCTURE




Friday, June 10, 2011
APP STRUCTURE
                                  transport handlers
                                 were moved and no
                               longer need a supervisor.
                                  They only use links.

                                  The code is more
                                   straightforward!




Friday, June 10, 2011
APP STRUCTURE
                                  transport handlers
                                 were moved and no
                               longer need a supervisor.
                                  They only use links.

                                  The code is more
                                   straightforward!




Friday, June 10, 2011
What?
                        ... my code is so much easier to read now!




Friday, June 10, 2011
I'LL TELL YOU WHAT


    • You   need to add ad-hoc start/restart policies and make sure
        orderly shutdowns work fine with just links. Care to add tests?

    • You   can no longer benefit from systool's application upgrades
        and downgrades as they depend on supervisors

    • You           will need to take your app down!



Friday, June 10, 2011
It's okay, I'll do rolling upgrades
                    through all nodes
                        this should avoid downtime




Friday, June 10, 2011
NOT WITH LIVE SESSIONS!
               Nobody likes to be disconnected during a conversation!
                                                    Would you disconnect this guy?

Friday, June 10, 2011
Stolen from Yurii's talk earlier today




                NOT WITH LIVE SESSIONS!
                        Nobody likes to be disconnected!

Friday, June 10, 2011
Stolen from Yurii's talk earlier today




                NOT WITH LIVE SESSIONS!
                        Nobody likes to be disconnected!

Friday, June 10, 2011
You're killing me. I'll leave the
           change in. Code is meant to be
                       read first!



Friday, June 10, 2011
OK, AS LONG AS YOU LISTEN
            TO THE NEXT POINT
Friday, June 10, 2011
SURE, I'M HAPPY
                                    WITH MY APP

    • It's       all done in OTP

    • Now               Easier to read

    • Uses              parametrized modules, hell yes!

    • It's       time to start it!

    • Let's             do this!


Friday, June 10, 2011
THIS IS GONNA BE FUN
                   main(_) ->
                       appmon:start(),
                       sasl:start(normal, []),
                       socketio:start(normal,[]),
                       {ok, Pid} = socketio_listener:start([
                                       {http_port, 7878},
                                       {default_http_handler,?MODULE}]),
                       EventMgr = socketio_listener:event_manager(Pid),
                       ok = gen_event:add_handler(EventMgr, ?MODULE,[]),
                       receive _ -> ok end.




                                And it works!
                                                                           (believe me)


Friday, June 10, 2011
THIS IS GONNA BE FUN
                   main(_) ->
                       appmon:start(),
                       sasl:start(normal, []),
                       socketio:start(normal,[]),
                       {ok, Pid} = socketio_listener:start([
                                       {http_port, 7878},
                                       {default_http_handler,?MODULE}]),
                       EventMgr = socketio_listener:event_manager(Pid),
                       ok = gen_event:add_handler(EventMgr, ?MODULE,[]),
                       receive _ -> ok end.




                                And it works!
                                                                           (believe me)


Friday, June 10, 2011
YOU, AGAIN!?
                        You are worse than clippy
                        What is it this time?

Friday, June 10, 2011
I'LL TELL YOU WHAT

    • The VM            starts all applications under the Application Controller

    • Starting          one outside of it means it is not supervised by it

    • No           app failure strategy (permanent, transient, temporary)

    • No           access to 'env' variables

    • No    respect of start phases
        or dependencies


Friday, June 10, 2011
AND IT GETS WORSE
    • With    bad default values (or overly defensive code) for env
        variables, bad things happen...




    • In       this case, infinitely many web sockets opened for each client
        (before a patch to change that, because I forgot to listen to this hint)

Friday, June 10, 2011
DO THIS INSTEAD
                   main(_) ->
                       appmon:start(),
                       application:start(sasl),
                       application:start(misultin),
                       application:start(socketio),
                       {ok, Pid} = socketio_listener:start([
                                       {http_port, 7878},
                                       {default_http_handler,?MODULE}]),
                       EventMgr = socketio_listener:event_manager(Pid),
                       ok = gen_event:add_handler(EventMgr, ?MODULE,[]),
                       receive _ -> ok end.




                          And it works better!
                                                                           (believe me)


Friday, June 10, 2011
Oh...


Friday, June 10, 2011
RIGHT
                        Your OTP code is not worth much without that

Friday, June 10, 2011
One more
                         thing...




Friday, June 10, 2011
DON'T LISTEN TO ME
                        If your product might not ship because of this.
                        Making it work is #1. Making it pretty is not.
Friday, June 10, 2011
HAPPY HACKING
                        Hopefully you won't regret this

Friday, June 10, 2011

More Related Content

Viewers also liked

Gesundheit Beilage Erfolg 03 2011
Gesundheit Beilage Erfolg 03 2011Gesundheit Beilage Erfolg 03 2011
Gesundheit Beilage Erfolg 03 2011Netzwerk-Verlag
 
Fluturas presentation @ Big Data Conclave
Fluturas presentation @ Big Data ConclaveFluturas presentation @ Big Data Conclave
Fluturas presentation @ Big Data Conclavefluturads
 
Exercicis Tecno[1]
Exercicis Tecno[1]Exercicis Tecno[1]
Exercicis Tecno[1]laietatm
 
Ortografia de la O i la U atones
Ortografia de la O i la U atonesOrtografia de la O i la U atones
Ortografia de la O i la U atonesPere MiG
 
Suplemento Revista Artez 183, San javier 2012
Suplemento Revista Artez 183, San javier 2012Suplemento Revista Artez 183, San javier 2012
Suplemento Revista Artez 183, San javier 2012Artez Artes Escénicas
 
The Emergence of Science Communication in Germany
The Emergence of Science Communication in GermanyThe Emergence of Science Communication in Germany
The Emergence of Science Communication in GermanyProf. Alexander Gerber
 
Diario Resumen 20141007
Diario Resumen 20141007Diario Resumen 20141007
Diario Resumen 20141007Diario Resumen
 
Pres universidad cordoba-rebium-aag_20150312_v02
Pres universidad cordoba-rebium-aag_20150312_v02Pres universidad cordoba-rebium-aag_20150312_v02
Pres universidad cordoba-rebium-aag_20150312_v02Alberto Abella
 
The Canals_June15 (1)
The Canals_June15 (1)The Canals_June15 (1)
The Canals_June15 (1)Andrea Mejia
 
Mayra documento final
Mayra documento finalMayra documento final
Mayra documento finalDiscua L
 
Reclutamiento 2.0 | Redes Sociales e internet en RRHH y selección de personal
Reclutamiento 2.0 | Redes Sociales e internet en RRHH y selección de personalReclutamiento 2.0 | Redes Sociales e internet en RRHH y selección de personal
Reclutamiento 2.0 | Redes Sociales e internet en RRHH y selección de personalPablo Alonso
 
Ley de etica_gubernamental_de_puerto_rico_libro
Ley de etica_gubernamental_de_puerto_rico_libroLey de etica_gubernamental_de_puerto_rico_libro
Ley de etica_gubernamental_de_puerto_rico_libroYadira Mangual
 
Una visión crítica del manejo del riesgo cardiovascular
Una visión crítica del manejo del riesgo cardiovascularUna visión crítica del manejo del riesgo cardiovascular
Una visión crítica del manejo del riesgo cardiovascularKuky Guirao Salinas
 

Viewers also liked (20)

Gesundheit Beilage Erfolg 03 2011
Gesundheit Beilage Erfolg 03 2011Gesundheit Beilage Erfolg 03 2011
Gesundheit Beilage Erfolg 03 2011
 
Cca
CcaCca
Cca
 
Fluturas presentation @ Big Data Conclave
Fluturas presentation @ Big Data ConclaveFluturas presentation @ Big Data Conclave
Fluturas presentation @ Big Data Conclave
 
Codigo 2.0 - Lawrence Lessig
Codigo 2.0 - Lawrence LessigCodigo 2.0 - Lawrence Lessig
Codigo 2.0 - Lawrence Lessig
 
Exercicis Tecno[1]
Exercicis Tecno[1]Exercicis Tecno[1]
Exercicis Tecno[1]
 
2010ko Inserzioak
2010ko Inserzioak2010ko Inserzioak
2010ko Inserzioak
 
Ortografia de la O i la U atones
Ortografia de la O i la U atonesOrtografia de la O i la U atones
Ortografia de la O i la U atones
 
Suplemento Revista Artez 183, San javier 2012
Suplemento Revista Artez 183, San javier 2012Suplemento Revista Artez 183, San javier 2012
Suplemento Revista Artez 183, San javier 2012
 
The Emergence of Science Communication in Germany
The Emergence of Science Communication in GermanyThe Emergence of Science Communication in Germany
The Emergence of Science Communication in Germany
 
Diario Resumen 20141007
Diario Resumen 20141007Diario Resumen 20141007
Diario Resumen 20141007
 
CV OF MOHAMMADY
CV OF MOHAMMADYCV OF MOHAMMADY
CV OF MOHAMMADY
 
Pres universidad cordoba-rebium-aag_20150312_v02
Pres universidad cordoba-rebium-aag_20150312_v02Pres universidad cordoba-rebium-aag_20150312_v02
Pres universidad cordoba-rebium-aag_20150312_v02
 
The Canals_June15 (1)
The Canals_June15 (1)The Canals_June15 (1)
The Canals_June15 (1)
 
Mayra documento final
Mayra documento finalMayra documento final
Mayra documento final
 
Reclutamiento 2.0 | Redes Sociales e internet en RRHH y selección de personal
Reclutamiento 2.0 | Redes Sociales e internet en RRHH y selección de personalReclutamiento 2.0 | Redes Sociales e internet en RRHH y selección de personal
Reclutamiento 2.0 | Redes Sociales e internet en RRHH y selección de personal
 
Paper based interaction
Paper based interactionPaper based interaction
Paper based interaction
 
Ley de etica_gubernamental_de_puerto_rico_libro
Ley de etica_gubernamental_de_puerto_rico_libroLey de etica_gubernamental_de_puerto_rico_libro
Ley de etica_gubernamental_de_puerto_rico_libro
 
Ensayo
Ensayo Ensayo
Ensayo
 
Eleanor & park
Eleanor & parkEleanor & park
Eleanor & park
 
Una visión crítica del manejo del riesgo cardiovascular
Una visión crítica del manejo del riesgo cardiovascularUna visión crítica del manejo del riesgo cardiovascular
Una visión crítica del manejo del riesgo cardiovascular
 

Similar to Angry Erlang Rant

Opera Mobile HTML5 CSS3 Standards
Opera Mobile HTML5 CSS3 StandardsOpera Mobile HTML5 CSS3 Standards
Opera Mobile HTML5 CSS3 StandardsZi Bin Cheah
 
Devops workshop unit2
Devops workshop unit2Devops workshop unit2
Devops workshop unit2John Willis
 
Android Development Slides
Android Development SlidesAndroid Development Slides
Android Development SlidesVictor Miclovich
 
Desenvolvimento Indolor com JQuery Mobile
Desenvolvimento Indolor com JQuery MobileDesenvolvimento Indolor com JQuery Mobile
Desenvolvimento Indolor com JQuery MobileBruno Oliveira
 
Discussing Java's Future
Discussing Java's FutureDiscussing Java's Future
Discussing Java's FutureRay Gauss
 
Ready to Play: JavaScript / HTML5 Game Development
Ready to Play: JavaScript / HTML5 Game DevelopmentReady to Play: JavaScript / HTML5 Game Development
Ready to Play: JavaScript / HTML5 Game DevelopmentZachary Johnson
 
The Many Hats of Building and Launching a Web Startup
The Many Hats of Building and Launching a Web Startup The Many Hats of Building and Launching a Web Startup
The Many Hats of Building and Launching a Web Startup Tracy Osborn
 
Javascript Views, Client-side or Server-side with NodeJS
Javascript Views, Client-side or Server-side with NodeJSJavascript Views, Client-side or Server-side with NodeJS
Javascript Views, Client-side or Server-side with NodeJSSylvain Zimmer
 
node.js for front-end developers
node.js for front-end developersnode.js for front-end developers
node.js for front-end developersGarann Means
 
Usability tour-pceu-2011
Usability tour-pceu-2011Usability tour-pceu-2011
Usability tour-pceu-2011Puppet
 
Errors and handling them. YOW nights Sydney 2011
Errors and handling them. YOW nights Sydney 2011Errors and handling them. YOW nights Sydney 2011
Errors and handling them. YOW nights Sydney 2011Michael Neale
 
Error Handling Done Differently
Error Handling Done DifferentlyError Handling Done Differently
Error Handling Done DifferentlyCloudBees
 
iPhone Python love affair
iPhone Python love affairiPhone Python love affair
iPhone Python love affairAnna Callahan
 
Introduction to JavaScriptMVC
Introduction to JavaScriptMVCIntroduction to JavaScriptMVC
Introduction to JavaScriptMVCPedro Pimentel
 
international PHP2011_ilia alshanetsky_Hidden Features of PHP
international PHP2011_ilia alshanetsky_Hidden Features of PHPinternational PHP2011_ilia alshanetsky_Hidden Features of PHP
international PHP2011_ilia alshanetsky_Hidden Features of PHPsmueller_sandsmedia
 

Similar to Angry Erlang Rant (20)

Opera Mobile HTML5 CSS3 Standards
Opera Mobile HTML5 CSS3 StandardsOpera Mobile HTML5 CSS3 Standards
Opera Mobile HTML5 CSS3 Standards
 
Devops workshop unit2
Devops workshop unit2Devops workshop unit2
Devops workshop unit2
 
Android Development Slides
Android Development SlidesAndroid Development Slides
Android Development Slides
 
ITP / SED Day 4
ITP / SED Day 4ITP / SED Day 4
ITP / SED Day 4
 
All By Myself
All By MyselfAll By Myself
All By Myself
 
MILOFest 2010
MILOFest 2010MILOFest 2010
MILOFest 2010
 
Desenvolvimento Indolor com JQuery Mobile
Desenvolvimento Indolor com JQuery MobileDesenvolvimento Indolor com JQuery Mobile
Desenvolvimento Indolor com JQuery Mobile
 
Discussing Java's Future
Discussing Java's FutureDiscussing Java's Future
Discussing Java's Future
 
Messaging patterns
Messaging patternsMessaging patterns
Messaging patterns
 
Ready to Play: JavaScript / HTML5 Game Development
Ready to Play: JavaScript / HTML5 Game DevelopmentReady to Play: JavaScript / HTML5 Game Development
Ready to Play: JavaScript / HTML5 Game Development
 
The Many Hats of Building and Launching a Web Startup
The Many Hats of Building and Launching a Web Startup The Many Hats of Building and Launching a Web Startup
The Many Hats of Building and Launching a Web Startup
 
Javascript Views, Client-side or Server-side with NodeJS
Javascript Views, Client-side or Server-side with NodeJSJavascript Views, Client-side or Server-side with NodeJS
Javascript Views, Client-side or Server-side with NodeJS
 
node.js for front-end developers
node.js for front-end developersnode.js for front-end developers
node.js for front-end developers
 
Usability tour-pceu-2011
Usability tour-pceu-2011Usability tour-pceu-2011
Usability tour-pceu-2011
 
Errors and handling them. YOW nights Sydney 2011
Errors and handling them. YOW nights Sydney 2011Errors and handling them. YOW nights Sydney 2011
Errors and handling them. YOW nights Sydney 2011
 
Error Handling Done Differently
Error Handling Done DifferentlyError Handling Done Differently
Error Handling Done Differently
 
iPhone Python love affair
iPhone Python love affairiPhone Python love affair
iPhone Python love affair
 
Introduction to JavaScriptMVC
Introduction to JavaScriptMVCIntroduction to JavaScriptMVC
Introduction to JavaScriptMVC
 
STI Summit 2011 - Linked services
STI Summit 2011 - Linked servicesSTI Summit 2011 - Linked services
STI Summit 2011 - Linked services
 
international PHP2011_ilia alshanetsky_Hidden Features of PHP
international PHP2011_ilia alshanetsky_Hidden Features of PHPinternational PHP2011_ilia alshanetsky_Hidden Features of PHP
international PHP2011_ilia alshanetsky_Hidden Features of PHP
 

Recently uploaded

AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
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
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
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
 

Recently uploaded (20)

AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
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
 

Angry Erlang Rant

  • 1. YOU WILL REGRET THIS! My Other Mood is 'Even More Angry' Friday, June 10, 2011
  • 2. I'M GONNA TELL YOU A STORY In which I tell you how to behave - how dare I? Friday, June 10, 2011
  • 3. SOCKET.IO-ERLANG • Developed by Yurii Rashkovskii, Omar Yasin, Fred Hebert (me) • Used as a base demo app for this presentation • Allows to write neat front-ends for conversational websites Friday, June 10, 2011
  • 4. BIZARRO SOCKET.IO-ERLANG • 'Bad' socket.io-erlang used for the presentation • Freely substitutes dependencies and actual code for whatever purpose I have Friday, June 10, 2011
  • 6. APP STRUCTURE Bunch of supervisors Friday, June 10, 2011
  • 7. APP STRUCTURE Bunch of supervisors web server Friday, June 10, 2011
  • 8. APP STRUCTURE Bunch of supervisors transport handlers web server Friday, June 10, 2011
  • 9. APP STRUCTURE Bunch of supervisors Client code attaches here transport handlers web server Friday, June 10, 2011
  • 10. WE USE A WEB SERVER • We need a web server (the slide's title says just that (and also the previous slide)) • Oh, Carrying parameters and a connection around is annoying! • Let's use parametrised modules! Friday, June 10, 2011
  • 11. PARAMETRISED MODULES -­‐module(test_module,  [Param1]). some_method()  -­‐>  Param1. Equivalent to: -­‐module(test_non_pmod). some_method(Param1)  -­‐>  Param1. Friday, June 10, 2011
  • 12. PARAMETRISED MODULES 1> X = test_module:new(horror), X:some_method(). horror 2> test_non_pmod:some_method(sane). sane Friday, June 10, 2011
  • 13. PARAMETRISED MODULES • They are great! • We can use them as if they were objects! • They let us carry everything as one large parameter! • Let's do this! Friday, June 10, 2011
  • 14. PARAMETRISED MODULES • They are great! • We can use them as if they were objects! • They let us carry everything as one large parameter! • Let's do this! Friday, June 10, 2011
  • 16. I'LL TELL YOU WHAT 3> dbg:tp({X, some_method, 0}, [...]). ** exception error: no case clause matching {test_module,horror} 4> dbg:tp({test_module, some_method, 0}, [...]). * never matches anything * 5> dbg:tp({test_module, some_method, 1}, [...]). * will actually match stuff * Friday, June 10, 2011
  • 17. What is this I don't even... Friday, June 10, 2011
  • 18. I'LL TELL YOU WHAT • The parameters are global and they ghost values, become implicit function arguments. Errors out of nowhere. • They're based on a old fun hack ({Mod, Fun}:(Args)) • They mess up the concept of arity • They mess up tracing (previous slide!) • They were added because some library accepts callback modules and nothing else but might still need state around. No other reason. Friday, June 10, 2011
  • 19. I'll use them anyway (in my server) Friday, June 10, 2011
  • 20. YOU PROBABLY SHOULDN'T But you might not have a choice, so let's keep going Friday, June 10, 2011
  • 21. WHAT ELSE DO WE HAVE? •A supervision tree, of course! • Some of the supervisors are tricky and must interact with servers and dynamic children and ... • Who starts who? By which API? • We could probably just forget about supervisors, link stuff together and make it simpler • Let's do this! Friday, June 10, 2011
  • 22. IN THIS VERY SLIDE I PRETEND I MAKE THE CHANGES Friday, June 10, 2011
  • 24. APP STRUCTURE transport handlers were moved and no longer need a supervisor. They only use links. The code is more straightforward! Friday, June 10, 2011
  • 25. APP STRUCTURE transport handlers were moved and no longer need a supervisor. They only use links. The code is more straightforward! Friday, June 10, 2011
  • 26. What? ... my code is so much easier to read now! Friday, June 10, 2011
  • 27. I'LL TELL YOU WHAT • You need to add ad-hoc start/restart policies and make sure orderly shutdowns work fine with just links. Care to add tests? • You can no longer benefit from systool's application upgrades and downgrades as they depend on supervisors • You will need to take your app down! Friday, June 10, 2011
  • 28. It's okay, I'll do rolling upgrades through all nodes this should avoid downtime Friday, June 10, 2011
  • 29. NOT WITH LIVE SESSIONS! Nobody likes to be disconnected during a conversation! Would you disconnect this guy? Friday, June 10, 2011
  • 30. Stolen from Yurii's talk earlier today NOT WITH LIVE SESSIONS! Nobody likes to be disconnected! Friday, June 10, 2011
  • 31. Stolen from Yurii's talk earlier today NOT WITH LIVE SESSIONS! Nobody likes to be disconnected! Friday, June 10, 2011
  • 32. You're killing me. I'll leave the change in. Code is meant to be read first! Friday, June 10, 2011
  • 33. OK, AS LONG AS YOU LISTEN TO THE NEXT POINT Friday, June 10, 2011
  • 34. SURE, I'M HAPPY WITH MY APP • It's all done in OTP • Now Easier to read • Uses parametrized modules, hell yes! • It's time to start it! • Let's do this! Friday, June 10, 2011
  • 35. THIS IS GONNA BE FUN main(_) -> appmon:start(), sasl:start(normal, []), socketio:start(normal,[]), {ok, Pid} = socketio_listener:start([ {http_port, 7878}, {default_http_handler,?MODULE}]), EventMgr = socketio_listener:event_manager(Pid), ok = gen_event:add_handler(EventMgr, ?MODULE,[]), receive _ -> ok end. And it works! (believe me) Friday, June 10, 2011
  • 36. THIS IS GONNA BE FUN main(_) -> appmon:start(), sasl:start(normal, []), socketio:start(normal,[]), {ok, Pid} = socketio_listener:start([ {http_port, 7878}, {default_http_handler,?MODULE}]), EventMgr = socketio_listener:event_manager(Pid), ok = gen_event:add_handler(EventMgr, ?MODULE,[]), receive _ -> ok end. And it works! (believe me) Friday, June 10, 2011
  • 37. YOU, AGAIN!? You are worse than clippy What is it this time? Friday, June 10, 2011
  • 38. I'LL TELL YOU WHAT • The VM starts all applications under the Application Controller • Starting one outside of it means it is not supervised by it • No app failure strategy (permanent, transient, temporary) • No access to 'env' variables • No respect of start phases or dependencies Friday, June 10, 2011
  • 39. AND IT GETS WORSE • With bad default values (or overly defensive code) for env variables, bad things happen... • In this case, infinitely many web sockets opened for each client (before a patch to change that, because I forgot to listen to this hint) Friday, June 10, 2011
  • 40. DO THIS INSTEAD main(_) -> appmon:start(), application:start(sasl), application:start(misultin), application:start(socketio), {ok, Pid} = socketio_listener:start([ {http_port, 7878}, {default_http_handler,?MODULE}]), EventMgr = socketio_listener:event_manager(Pid), ok = gen_event:add_handler(EventMgr, ?MODULE,[]), receive _ -> ok end. And it works better! (believe me) Friday, June 10, 2011
  • 42. RIGHT Your OTP code is not worth much without that Friday, June 10, 2011
  • 43. One more thing... Friday, June 10, 2011
  • 44. DON'T LISTEN TO ME If your product might not ship because of this. Making it work is #1. Making it pretty is not. Friday, June 10, 2011
  • 45. HAPPY HACKING Hopefully you won't regret this Friday, June 10, 2011