SlideShare a Scribd company logo
1 of 59
Making things simple
By Robert Roose
 religion
 -noun. a set of beliefs concerning the cause,
nature, and purpose of code, which guide
programmers through the creation of software,
usually involving devotional and ritual
observations and/or gatherings, and often
containing standards governing the style of
development practices
 Advantages
 Terse
 Clarity
 Easier maintainability
 Encourages immutability
 Forces better designs
 Better testability
 Less bugs
 Disadvantages
 Difficult to design
 Difficult to visualize
 Hard for the inexperienced unenlightened
 Generally slower
 Functional programming: it’s just for those
academic types
 Functional programming: it’s fun, but it
doesn’t make money
 It makes you a better programmer
 It’s an alternative perspective of how to describe
good software design
 OOP is bad
 Side effects are evil
 Immutability is good
 Less code means less bugs
 Not everything can be side effect free
 Limitations in languages, tools, OSs…
 Bureaucracy keeps things complicated
 Not everyone follows the same religion
 Businesses aren’t about pretty math
problems
 Less code
 Less buggy code
 Happier customers
 Cheaper code
 Easier maintainability
 Quicker development
 Once developers know the ropes
What is ?
Evented I/O framework for theV8
JavaScript engine
Huh?
Takes JavaScript beyond the
browser
 Provides an easy way to build scalable
network programs
 Generally fast
 Great at concurrency
 Asynchronous everything
 Almost never blocks
 Web applications
 Especially real-time web apps
 Network applications
 Distributed systems
 General purpose applications
In node, everything runs in parallel,
except your code
Single-threaded event loop
Something isn’t right here…
But there’s only one thread
 Use processes!
 Easily scale across distributed systems
 Much safer than threads
 No need to worry about states
 Use load balancer to distribute work
 HAProxy
 nginx
 multi-node
 Simple designs
 Efficient applications
 High concurrency
 Blazingly fast for end users
 Dynamic, weakly typed multi-paradigm
scripting language
 Prototype-based
 Functional
 Imperative
 Lisp in C’s clothing
 Lots of design errors
 Lots of implementation errors
 Lots of bad books
 Lots of amateurs
 No, but it can be forced
 It’s prototype-based
 It has objects, but not classes
 It doesn’t have class-oriented inheritance – it has
prototype-oriented inheritance
 There are lots of different ways to achieve the
same thing
 Really depends on your religion
 It supports the concepts of functional
programming
 Certainly not pure
 More functional than object-oriented
 Again, it depends on your religion
 Treat variables as constants
 Think of everything as immutable
 Don’t rely on side effects
 Avoid confusion
 Return a new object instead of modifying
 Can be used as a (non-pure) functional
language
 Just use what works
 Underscore.js
 Utility-belt JavaScript library
 wu.js
 For laziness
 node-utils
 (plug)
Underscore.js
starting
reading file1.txt
got file1.txt
reading file2.txt
got file2.txt
reading file3.txt
got file3.txt
getting google
got google
...
File 1, File 2, File 3, 3bb0f168fbf8c9b0324cbf2fea1266ea
starting
reading file1.txt
reading file2.txt
reading file3.txt
getting google
got file1.txt
got file2.txt
got file3.txt
got google
...
File 1, File 2, File 3, ba5eaf36ca6e688d33ff53a466de01e1
starting
reading file1.txt
reading file2.txt
reading file3.txt
getting google
got file1.txt
got file2.txt
got file3.txt
got google
...
File 1, File 2, File 3, 065b003da0d66b14924086c8c8a1d7a6
 Attempt to expose the good parts of
JavaScript
 It’s just JavaScript
 Compiles one-to-one into the equivalent
JavaScript
 Makes JavaScript simpler
starting
reading file1.txt
reading file2.txt
reading file3.txt
getting google
got file1.txt
got file2.txt
got file3.txt
got google
...
File 1, File 2, File 3, 3290579989c493c338dcf52327442c10
 scale-example
 comet-example
Only just scratched the surface
 JavaScript
 JavaScript:TheWorld’s Most Misunderstood
Programming Language
 The Little JavaScripter
 JavaScript as a Functional Language
 Higher-Order JavaScript
 Functional Programming – Eloquent JavaScript
 Douglas Crockford
 Node.js
 How to Node
 Node Documentation
 Understanding node.js
 Combined benchmark
 Ryan Dahl
 CoffeeScript
 CoffeeScript Site
 Functional Programming
 Functional Programming Doesn'tWork (and what
to do about)
 Why functional programming doesn't catch on
 http://twitter.com/summatix
 http://www.robertroose.info/
 http://bitbucket.org/summatix
 https://github.com/summatix
 http://bitbucket.org/shivercube
 https://github.com/shivercube

More Related Content

What's hot

Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18
Pierre Joye
 
HTTP::Parser::XS - writing a fast & secure XS module
HTTP::Parser::XS - writing a fast & secure XS moduleHTTP::Parser::XS - writing a fast & secure XS module
HTTP::Parser::XS - writing a fast & secure XS module
Kazuho Oku
 

What's hot (10)

Александр Махомет "Beyond the code или как мониторить ваш PHP сайт"
Александр Махомет "Beyond the code или как мониторить ваш PHP сайт"Александр Махомет "Beyond the code или как мониторить ваш PHP сайт"
Александр Махомет "Beyond the code или как мониторить ваш PHP сайт"
 
Applied Shell Scripting - stills to time-lapse
Applied Shell Scripting - stills to time-lapseApplied Shell Scripting - stills to time-lapse
Applied Shell Scripting - stills to time-lapse
 
Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18
 
STP201 Efficiency at Scale - AWS re: Invent 2012
STP201 Efficiency at Scale - AWS re: Invent 2012STP201 Efficiency at Scale - AWS re: Invent 2012
STP201 Efficiency at Scale - AWS re: Invent 2012
 
HTTP::Parser::XS - writing a fast & secure XS module
HTTP::Parser::XS - writing a fast & secure XS moduleHTTP::Parser::XS - writing a fast & secure XS module
HTTP::Parser::XS - writing a fast & secure XS module
 
Chenli linux-kerne-community
Chenli linux-kerne-communityChenli linux-kerne-community
Chenli linux-kerne-community
 
Basic testing with selenium
Basic testing with seleniumBasic testing with selenium
Basic testing with selenium
 
5 things MySql
5 things MySql5 things MySql
5 things MySql
 
OSDC 2016 - DNS for Developers by Jan-Piet Mens
OSDC 2016 - DNS for Developers by Jan-Piet MensOSDC 2016 - DNS for Developers by Jan-Piet Mens
OSDC 2016 - DNS for Developers by Jan-Piet Mens
 
Web Development with Python and Django
Web Development with Python and DjangoWeb Development with Python and Django
Web Development with Python and Django
 

Similar to Functional node.js

Novice Programmers Workshop
Novice Programmers WorkshopNovice Programmers Workshop
Novice Programmers Workshop
Alec Clews
 
Passing The Joel Test In The PHP World
Passing The Joel Test In The PHP WorldPassing The Joel Test In The PHP World
Passing The Joel Test In The PHP World
Lorna Mitchell
 
Better Functional Design through TDD
Better Functional Design through TDDBetter Functional Design through TDD
Better Functional Design through TDD
Phil Calçado
 
Developer Fundamentals - Logging
Developer Fundamentals - LoggingDeveloper Fundamentals - Logging
Developer Fundamentals - Logging
Axel Irriger
 

Similar to Functional node.js (20)

Java And Community Support
Java And Community SupportJava And Community Support
Java And Community Support
 
The Development History of PVS-Studio for Linux
The Development History of PVS-Studio for LinuxThe Development History of PVS-Studio for Linux
The Development History of PVS-Studio for Linux
 
Novice Programmers Workshop
Novice Programmers WorkshopNovice Programmers Workshop
Novice Programmers Workshop
 
Passing The Joel Test In The PHP World
Passing The Joel Test In The PHP WorldPassing The Joel Test In The PHP World
Passing The Joel Test In The PHP World
 
Untangling spring week8
Untangling spring week8Untangling spring week8
Untangling spring week8
 
Cs121 Unit Test
Cs121 Unit TestCs121 Unit Test
Cs121 Unit Test
 
Put to the Test
Put to the TestPut to the Test
Put to the Test
 
The Professional Programmer
The Professional ProgrammerThe Professional Programmer
The Professional Programmer
 
Pragmatic programmer
Pragmatic programmerPragmatic programmer
Pragmatic programmer
 
Top 10 Scalability Mistakes
Top 10 Scalability MistakesTop 10 Scalability Mistakes
Top 10 Scalability Mistakes
 
Top 30 Scalability Mistakes
Top 30 Scalability MistakesTop 30 Scalability Mistakes
Top 30 Scalability Mistakes
 
The Art of Evolutionary Algorithms Programming
The Art of Evolutionary Algorithms ProgrammingThe Art of Evolutionary Algorithms Programming
The Art of Evolutionary Algorithms Programming
 
Better Functional Design through TDD
Better Functional Design through TDDBetter Functional Design through TDD
Better Functional Design through TDD
 
01.intro
01.intro01.intro
01.intro
 
The Junior Developer Survival Guide - GDI Ann Arbor 2/10/15
The Junior Developer Survival Guide -  GDI Ann Arbor 2/10/15The Junior Developer Survival Guide -  GDI Ann Arbor 2/10/15
The Junior Developer Survival Guide - GDI Ann Arbor 2/10/15
 
A Backpack to go the Extra-Functional Mile (a hitched hike by the PROWESS pro...
A Backpack to go the Extra-Functional Mile (a hitched hike by the PROWESS pro...A Backpack to go the Extra-Functional Mile (a hitched hike by the PROWESS pro...
A Backpack to go the Extra-Functional Mile (a hitched hike by the PROWESS pro...
 
Developer Fundamentals - Logging
Developer Fundamentals - LoggingDeveloper Fundamentals - Logging
Developer Fundamentals - Logging
 
Oracle SOA Suite 11g Troubleshooting Methodology (whitepaper)
Oracle SOA Suite 11g Troubleshooting Methodology (whitepaper)Oracle SOA Suite 11g Troubleshooting Methodology (whitepaper)
Oracle SOA Suite 11g Troubleshooting Methodology (whitepaper)
 
Six reasons to learn JavaScript
Six reasons to learn JavaScriptSix reasons to learn JavaScript
Six reasons to learn JavaScript
 
Welsh, Ben: The framework fix: how to build better archives by helping news n...
Welsh, Ben: The framework fix: how to build better archives by helping news n...Welsh, Ben: The framework fix: how to build better archives by helping news n...
Welsh, Ben: The framework fix: how to build better archives by helping news n...
 

Recently uploaded

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

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
 
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...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

Functional node.js