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

Don't Rewrite, React!

Don't Rewrite, React!

Legacy web applications live all around us. But in today's ES6 world what do we do with all these apps? Sure we would each love to say "Let's rewrite it!" But what do we do when that's not an option.

Enter React.

Let's face it, most apps take year to build. Time, money... it's not something you can easily toss aside for the latest JS Framework hotness. The great thing about React is that it's a library. A library that can easily be integrated to bring these legacy apps into an ES6/one-page world.

In this session we are going to talk about what React is, what it can do, and how to integrate it into your existing legacy apps.

Sara Gibbons

May 20, 2017
Tweet

More Decks by Sara Gibbons

Other Decks in Technology

Transcript

  1. Tech Debt Buildup time size GOAL TECH DEBT CODE BASE

    UNCONTROLLED TECH DEBT MONETARY INVESTMENT ACTUAL TECH DEBT
  2. Ability To Change time + progress cost of change TECH

    DEBT ABILITY TO RESPOND TO CHANGE ACTUAL COST OF CHANGE OPTIMAL COST OF CHANGE
  3. Developers = Software engineers want to… • do cool stuff

    • fix things • solve problems • learn & work with new technologies Software engineers don’t want to… • waste their time • become stagnate
  4. Groupthink group•think The practice of thinking or making decisions as

    a group in a way that discourages creativity or individual responsibility
  5. Technical Debt • Managing technical debt on a project is

    hard. • Inherit debt when you join a project. • Hits tipping point where reversing it seems unobtainable.
  6. New Technologies • As soon as we choose a technology

    it is outdated. • Seems like each time you Google you find a new/better solution • Expereince with new technologies lead to more career opportunities
  7. Developer Ego • Our industry creates a self-promoting culture. •

    We are constantly evaluating ourselves to others. • “Fake it until you make it” • To be successful we need to be self promoting.
  8. Developer Laziness • We write programs to save time/steps/energy •

    Value efficient code • We automate ourselves • We don’t see the point of working on something we consider dumb
  9. Rewrite vs. Re-engineer • Re-engineering is not sexy • No

    career opportunity increase • We’ve spent X amount of time working on the same crappy code we wanted to run away from Rewrite!
  10. Missed Considerations • Large monetary investment in current software. •

    Business depends on software success. • Large codebase = huge amounts of business logic • Code written with good intentions
  11. What is React? re•act Flexible JavaScript library for building user

    interfaces. A template language to bundle HTML & JS, ultimately rendering HTML. View layer.
  12. What’s So Great About React? • Integrate into existing JS

    friendly applications • Small/Simple components • New hotness • Small learning curve • Large community
  13. Using an MVC Framework time size MVC FRAMEWORK ORIGINAL CODE

    BASE MONETARY INVESTMENT MVC DEV BEGINS OMG!
  14. Using an MVC Framework Only works when… • Lots of

    time • Lots of developers • Lots of money • Business is pivoting • Tech stack is outdated & prohibiting growth Essentially a rewrite.
  15. • Incrementally add w/small components an new functionality • Integrates

    with current app Using React • Continuous deployment continues • Initial dev investment to configure project • Some pieces my need more dev time if you don’t have an API endpoint
  16. Tools — Package Manager A piece of software that lets

    you manage the dependencies (external code written by you or someone else) that your project needs to work correctly. pack•age man•ag•er package.json
  17. npm Package Manager — npm Default package manager we all

    know and love. Bundled with each Node.js release By default has non-deterministic installs (no lock file).
  18. yarn Package Manager — yarn Use deterministic installs because it

    uses a lockfile to lockdown all the dependencies recursively at the application level.
  19. Tools — Bundler Load all the dependencies of your application

    into a single bundle, or JavaScript file, that can be executed in the browser. bundler
  20. web•pack Bundler — webpack Works out of the box. No

    additional tools needed. Build process defined through a config file.
  21. ba•bel Tools — Babel JavaScript transpiler that converts edge JavaScript

    into plain old ES5 JavaScript that can run in any browser. Packaged as an node module. .babelrc configuration file
  22. > touch webpack.config.js webpack config Create webpack config… A JavaScript

    file that exports an object. Contains settings webpack will use for build.
  23. webpack.config.js entry: name of top level file, or array of

    files to include in build output: settings for the build/compile of the output
  24. > yarn add --dev babel-core babel-loader Install our transpiler… babel-loader:

    This package allows transpiling JavaScript files using Babel and webpack. babel-core: Babel compiler core. babel
  25. .babelrc > yarn add --dev babel-preset-env babel-preset-react Install language modules

    for Babel… babel-preset-env: Babel preset that can automatically determine the plugins and polyfills you need based on your supported environments. babel-preset-react: Babel preset for all React plugins.
  26. > yarn add --dev react react-dom react Add React to

    our package… react-dom: Adds ability to insert react components into the DOM. react: React core.
  27. Where to start? Start with easy & simple components. GOAL:

    Introduce React to project with minimal development slowdown. • Small • Testable • High reusability
  28. External Plugins What outside tools are you bringing in? Can

    a React component replace it? • Modal • Date Picker • Select2
  29. New Features - How much will it use JavaScript? •

    What is the UI impact of the new feature? • Old Architecture vs. New React Structure? Is… technical debt + time to rework later greater than time to develop now in React?
  30. API • Eventually will need your own data layer. •

    Start simple. Begin with GET requests. • Replace setting of properties to a GET request to API.
  31. UI Kit • Package/Library of standard elements & styles. •

    Use across multiple projects. Warning! Not recommended until near complete, or have need to duplicate components to different project.
  32. Setting Up For React 1. Package manager (yarn) 2. Bundler

    (webpack) 3. Transpiler (babel) 4. webpack.config.js 5. .babelrc 6. Add dependencies
  33. Gameplan 1. Figure out your basic components 2. External Plugins

    3. Third Party Integrations 4. New Features 5. API 6. UI Kit Each phase… - Continue to create boilerplate elements - Test all the things!