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

Challenges in Scaling a Rapidly Growing Ember A...

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

Challenges in Scaling a Rapidly Growing Ember App and Team

Ember.js allows us to build ambitious web applications, but particular challenges arise with large apps, large teams, and rapid growth. We'll talk about how we build Intercom and some of the lessons we've learned in the past two years.

Avatar for Lorcan Coyle

Lorcan Coyle

October 28, 2016
Tweet

More Decks by Lorcan Coyle

Other Decks in Technology

Transcript

  1. Challenges in Scaling a Rapidly Growing Ember App and Team

    Lorcan Coyle - Intercom October 28 2016
  2. • makes messaging apps for businesses that help them understand

    & talk to consumers. • mission to make web business personal
  3. Intercom and Ember • Intercom is an ember-app (backend is

    rails) • migrated from a rails monolith, starting early 2014
  4. Big App & Big Team • large surface area •

    >50 contributors with >10 commits so far in 2016
  5. Big Teams and Big Apps • single code-base for the

    front-end • many engineers • engineer fungibility
  6. Engineer Fungibility • strong conventions are crucial! opinionatedness pays off!!!

    • ❤ ember ❤ • code looks much the same everywhere in the app • moving teams • changing code • onboarding engineers
  7. Software Evolution • Lehman’s laws of software evolution • as

    a system evolves, its complexity increases unless work is done to maintain or reduce it
  8. Shrinking the Codebase • finding and eliminating dead code •

    removing unnecessary libraries/modules • depending on third-party libraries • extracting functionality into addons
  9. Improving Startup Time • measure time to render • defer

    loading of 3rd party scripts • service workers • just in time loading
  10. Tracking Ember’s Release Cycle • often late to upgrade, occasionally

    quite late • never ran betas • ultimately got stuck on 1.12 • initial component render times significantly slower with Glimmer 1
  11. Tracking the Release Cycle • often late to upgrade, occasionally

    quite late • never ran betas • ultimately got stuck on 1.12 • initial component render times significantly slower with Glimmer 1 • wake up call for us
  12. Fixing our Problem • link-to is the default way of

    doing this in ember • must be an quicker way • let’s write a helper (v. fast) • done.
  13. Sharing our Solution • this actually looks useful • let’s

    build an ember addon and open-source it • https://github.com/intercom/ember-href-to
  14. ember-href-to • In the last year • thirty commits •

    sixteen from seven public contributors • some fairly significant, e.g., upgrading to support latest version of ember
  15. Engaging with Community • great! but maybe this is so

    helpful it should just be part of the framework? • let’s write an RFC • https://github.com/emberjs/rfcs/pull/92 • led to discussions on a routing service, and fed into another RFC • https://github.com/emberjs/rfcs/pull/95
  16. ember-model / ember-data • we chose ember-model • ember-data pre-beta,

    hadn’t settled on an API • worked great but now we’re migrating our code to ember-data • linking models
  17. Computed Properties or Logic in Templates • balance to be

    struck here • more/better logic in templates • ember-truth-helpers • ember-composable-helpers
  18. Computed Property Macros • found common patterns, extracted these into

    computed property macros • ternary • trim • subtractFrom • ember-computed-template-string • (presented by Serena Fritsch at EmberCamp 2016)
  19. Code Bloat - God Models • representation of a customer

    • if everyone is responsible, nobody is responsible • ends up as a dumping ground • slower to retrieve • more difficult to grok
  20. Message Editor • two way binding hell • dirty tracking

    hell • difficulties with model validity
  21. Dirty Tracking Hell • our message editor is pretty complicated

    • message model has a bunch of sub-relationships • just observe model.isDirty and autosave… easy right?
  22. Data Down Actions Up • explicitly mutate the model •

    check did the model change? • schedule an autosave
  23. Model Validation • want to know whether we can set

    a message live • great choices here: • ember-changeset - for form validation • ember-cp-validations - for complex model validation
  24. Ember Concurrency • async is hard • ember-concurrency allows us

    to eliminate complex code • droppable ajax calls • task groups to tie actions together
  25. Continuous Deployment • ember-cli-deploy • since February, before 1.0, some

    rough edges • lots of great plugins • ember-cli-deploy populates index.html • but Intercom is a rails app
  26. Continuous Deployment • double deploy (backend & frontend) - not

    great • takes longer, harder to rollback • later wrote an api endpoint that takes asset revision hashes and spits our the right data in our index.html’s view • rapid rollbacks, bisects using query params
  27. Testing • previously heavy on acceptance tests, very few unit

    tests • component integration tests to the rescue! • tests much faster, so we write many many more
  28. Testing • previously heavy on acceptance tests, very few unit

    tests • component integration tests to the rescue! • tests much faster, so we write many many more • ember-data-factory-guy • traits, test setup very easy
  29. Ember Watson • migrating big codebases is sometimes very tedious,

    mechanical work • e.g., eliminating deprecations • https://github.com/abuiles/ember- watson