Upgrade to Pro — share decks privately, control downloads, hide ads and more …

JSNation 2019: Stop the Software Apocalypse with Functional Programming

JSNation 2019: Stop the Software Apocalypse with Functional Programming

With the rise of software-based innovation, the business rules and flow controls are getting more complex. Software engineers do not only have to handle increasingly complicated problems, but they also carry greater responsibility for ensuring the quality of their code.

It’s clear that our tools and methods should evolve to build robust software. In this talk, we’ll explore how to leverage functional programming techniques to reduce the complexity and write safer JavaScript in a real-world scenario. Come to see what’s exciting about static analysis, pure functions, composition and immutability; and how these principles are a powerful tool to optimize your code for correctness.

Fernanda Andrade

June 07, 2019
Tweet

More Decks by Fernanda Andrade

Other Decks in Programming

Transcript

  1. Mutability let counter = x + 3; // counter =

    7 console.log(counter + x); // 25
  2. let counter = x + 3; // counter = 7

    console.log(counter + x); // 25 Where is x changing? Side effects
  3. ?

  4. function getX(value) { return value + 2; } getX(2); //

    4 getX(5); // 7 No mutation Different input
  5. Tests describe("...", function() { beforeEach(function() { // prepare the state

    }); context("when...", function() { it("returns...", function() { // expects something }); }); afterEach(function() { // clean the state }); });
  6. Tests describe("...", function() { context("when value is 2", function() {

    it("returns...", function() { return expect(getX(2)).to.be.equal(4); }); }); });
  7. Types interface User { name: string; age: number; } function

    changeProperty(property: string): string { return property.toUpperCase(); } const user: User = { name: "Joe", age: 50 }