SlideShare a Scribd company logo
N(G)-Apps, One Core
Alan Hietala
@alanhietala
Sr Software Developer @ecobee
Core
ng-app
ng-app
ng-app
ng-app
ng-app
web apps
mobile apps
remote teams
!
on
!
1 API
A Puzzle of Paint - Brent Danley
Core Architecture
Connection Manager	
• All ThermostatServices make their data calls here
• Facade created to our bare metal API’s.
• Hides details of authentication from the developer
• provides a clean interface for actions that are more
complicated within the API itself.
Thermostat Services
• Rely on connection manager for data
• master service that splits the api json into bits
• Thermostat Service contains many task specific
services that process those bits of json
Core Thermostat Services
• Thermostat service gets update
• Updates sub services
• Business Logic in sub services
PollData()
updateSubServices()
Thermostat
Service
updateData(data)
createVacation()
Vacation Service
updateData(data)
updateSomeSetting()
Settings Service
updateData(data)
changeSetPoint()
Setpoint Service
Model Factories
• Raw API data often not in the best format for data
binding
• Model Factories create angular specific models
• Our sub services use the factory to create the data
objects controllers watch.
Example ModelFactory
angular.module('myApp')
.factory('ScheduleModelFactory', function () {
return {
makeModel: function (rawData) {
// transform the raw data into a great model
return awesomeModel;
}
};
});
Service using a
ModelFactory
angular.module('myApp')
.factory('ScheduleService', function (ScheduleModelFactory) {
return {
scheduleModel: null, // controllers will watch this
update: function (rawData) {
this.scheduleModel = ScheduleModelFactory.makeModel(rawData);
}
};
});
Controllers Example
angular.module('myApp')
.controller('SetTemperatureCtrl', function ($scope, SetPointService) {
$scope.viewSetPoint = 23;
$scope.setPointService = SetPointService;
$scope.$watch(‘setPointService.setPoint’, function (newValue) {
$scope.viewSetPoint = newValue;
};
$scope.changeSetPoint = function (newSetPoint) {
$scope.setPointService.changeSetPoint(newSetPoint);
}
});
Inject sub service you need
Business logic? Ram it Down
Untitled - Etno Deos
Core enforces Business
Rules
• Throwing errors from core important for developers
down stream
• Downstream devs don’t have to know all the business
rules.
• We don’t rely on an API call failures business rules
client side ensure speed.
Overriding core
• What if core doesn’t quite meet an apps needs?
• Create override module
• Use a decorator
Override Module
!
!
angular.module(“myApp”, [“overrideModule”]);
!
!
!
!
!
!
Angular takes the last loaded version if two
modules have the same service defined.
Decorator
angular.module('myApp', ['myLibrary'])
.config(function ($provide) {
$provide.decorator(‘serviceName’, function ($delegate) {
var patchedFunction = function () {
// do something here
}
$delegate.functionToPatch = patchedFunction;
return $delegate;
});
});
Angular Sanctioned Monkey Patching
DI Makes this all simple
• All of the architecture above is based heavily on DI
• We create many interchangeable parts
• Each encapsulates a single idea
• If any part of an idea changes we update one area
Core is Sacred
Protected - Hartwig HKD
How do we Protect it?
Broken Window Theory
• if you don’t fix broken
windows people will break
more
• Applies to code bases too
• Refactoring when you find
problems becomes central
Unit tests
Make things better, not
worse
you won’t change
things you’re scared of
breaking
Tests are Documentation
• BDD style tests ensures they read like a spec
• If tests are up to date so is your software spec
describe(‘Vacation Service’, function () {
describe(‘updateVacation()’, function() {
it(‘should update a vacation with the new date and time’, function () {
// test details
});
!
it(‘should throw and error when the start date is after the end date’, function () {
// test details
});
});
});
Karma Advantages
• Run tests on all your target browsers
• Catch browser specific bugs Date.parse anyone?
• Good code coverage tools ties in with CI systems
easily
Code Review
gerrit
Review Board
Change Log
• V1.0.1 - Added net new feature
• V1.0.0 - changed business logic around thermostats
Problem
• How do we avoid breaking changes in core affecting
downstream code unexpectedly?
• Where we started wasn’t very ideal
Started with Sync Scripts
• With 2 apps had one copy services from the other
• As apps started to diverge the exclude list grew
• needed a better solution
Dependency Management
Bower
Bower to the rescue
• Bit the bullet and moved common services to it’s own
repo
• Set up bower in our applications to pull our new
tagged core repo.
How do we do it?
{
"name": "myApp",
"version": "1.0.0",
"dependencies": {
….
"mylibrary": “git@github.com:mycompany/mylibrary.git#v1.2.11",
….
}
}
In project bower.json
In core bower.json
{
"name": "mylibrary",
"private": "true",
"version": "1.2.11",
"main": “dist/mylibrary.min.js”
…
}
Tag in git
git tag -a v1.2.11 -m “mylibrary version message”
Other benefits
• Forces conversations about what goes into core
services more thinking time is a good thing
• Easy rollback if change breaks your app.
• Dev controls what core version to use and upgrade
timing
In Summary
• Broke core into small services
• Abstracted connections
• model factories transform API data for frontend use
• Protect core with Unit testing, Dependency
Management, Code Reviews
• Angular makes this all easy
Thanks!
!
!
Questions?
Covered
• Services
• Sub Services
• Model Factories
• Controller interaction
• Connection Manager
• Dependency
Management
• Unit testing with Karma
• Code Review Tools
• Override modules
• Decorators
• Change Logs

More Related Content

What's hot

Practical Patterns for Developing a Cross-product Cross-version App
Practical Patterns for Developing a Cross-product Cross-version AppPractical Patterns for Developing a Cross-product Cross-version App
Practical Patterns for Developing a Cross-product Cross-version App
Atlassian
 
Infrastructure as Code
Infrastructure as CodeInfrastructure as Code
Infrastructure as Code
Leandro Rosa
 
Preparing for Data Residency and Custom Domains
Preparing for Data Residency and Custom DomainsPreparing for Data Residency and Custom Domains
Preparing for Data Residency and Custom Domains
Atlassian
 
The art of Azure Functions (unit) testing and monitoring
The art of Azure Functions (unit) testing and monitoringThe art of Azure Functions (unit) testing and monitoring
The art of Azure Functions (unit) testing and monitoring
Massimo Bonanni
 
Rails 5 – most effective features for apps upgradation
Rails 5 – most effective features for apps upgradationRails 5 – most effective features for apps upgradation
Rails 5 – most effective features for apps upgradation
Andolasoft Inc
 
Declaring Server App Components in Pure Java
Declaring Server App Components in Pure JavaDeclaring Server App Components in Pure Java
Declaring Server App Components in Pure Java
Atlassian
 
The art of Azure Functions (unit) testing and monitoring
The art of Azure Functions (unit) testing and monitoringThe art of Azure Functions (unit) testing and monitoring
The art of Azure Functions (unit) testing and monitoring
Massimo Bonanni
 
Angular 2.0: Getting ready
Angular 2.0: Getting readyAngular 2.0: Getting ready
Angular 2.0: Getting ready
Axilis
 
Setting Up Development Environment For Google App Engine & Python | Talentica
Setting Up Development Environment For Google App Engine & Python | TalenticaSetting Up Development Environment For Google App Engine & Python | Talentica
Setting Up Development Environment For Google App Engine & Python | Talentica
Talentica Software
 
Enterprise Beacon Object Hive - Siebel Version Control
Enterprise Beacon Object Hive - Siebel Version ControlEnterprise Beacon Object Hive - Siebel Version Control
Enterprise Beacon Object Hive - Siebel Version Control
Milind Waikul
 
What's New in Jira Cloud for Developers
What's New in Jira Cloud for DevelopersWhat's New in Jira Cloud for Developers
What's New in Jira Cloud for Developers
Atlassian
 
Big ideas in small packages - How microservices helped us to scale our vision
Big ideas in small packages  - How microservices helped us to scale our visionBig ideas in small packages  - How microservices helped us to scale our vision
Big ideas in small packages - How microservices helped us to scale our vision
Sebastian Schleicher
 
Creating Event Driven Serverless Applications - Sandeep - Adobe - Serverless ...
Creating Event Driven Serverless Applications - Sandeep - Adobe - Serverless ...Creating Event Driven Serverless Applications - Sandeep - Adobe - Serverless ...
Creating Event Driven Serverless Applications - Sandeep - Adobe - Serverless ...
CodeOps Technologies LLP
 
DevIntersections 2014 Web API Slides
DevIntersections 2014 Web API SlidesDevIntersections 2014 Web API Slides
DevIntersections 2014 Web API Slides
Brady Gaster
 
Stateful patterns in Azure Functions
Stateful patterns in Azure FunctionsStateful patterns in Azure Functions
Stateful patterns in Azure Functions
Massimo Bonanni
 
Lwc presentation
Lwc presentationLwc presentation
Lwc presentation
Nithesh N
 
Infrastructure as code
Infrastructure as codeInfrastructure as code
Infrastructure as code
Aakash Singhal
 
Alfresco/Activiti Modeler Application - Andras Popovics - 2019
Alfresco/Activiti Modeler Application - Andras Popovics - 2019Alfresco/Activiti Modeler Application - Andras Popovics - 2019
Alfresco/Activiti Modeler Application - Andras Popovics - 2019
András Popovics
 
An Exploration of Cross-product App Experiences
An Exploration of Cross-product App ExperiencesAn Exploration of Cross-product App Experiences
An Exploration of Cross-product App Experiences
Atlassian
 
Rob Gruhl and Erik Erikson - What We Learned in 18 Serverless Months at Nords...
Rob Gruhl and Erik Erikson - What We Learned in 18 Serverless Months at Nords...Rob Gruhl and Erik Erikson - What We Learned in 18 Serverless Months at Nords...
Rob Gruhl and Erik Erikson - What We Learned in 18 Serverless Months at Nords...
ServerlessConf
 

What's hot (20)

Practical Patterns for Developing a Cross-product Cross-version App
Practical Patterns for Developing a Cross-product Cross-version AppPractical Patterns for Developing a Cross-product Cross-version App
Practical Patterns for Developing a Cross-product Cross-version App
 
Infrastructure as Code
Infrastructure as CodeInfrastructure as Code
Infrastructure as Code
 
Preparing for Data Residency and Custom Domains
Preparing for Data Residency and Custom DomainsPreparing for Data Residency and Custom Domains
Preparing for Data Residency and Custom Domains
 
The art of Azure Functions (unit) testing and monitoring
The art of Azure Functions (unit) testing and monitoringThe art of Azure Functions (unit) testing and monitoring
The art of Azure Functions (unit) testing and monitoring
 
Rails 5 – most effective features for apps upgradation
Rails 5 – most effective features for apps upgradationRails 5 – most effective features for apps upgradation
Rails 5 – most effective features for apps upgradation
 
Declaring Server App Components in Pure Java
Declaring Server App Components in Pure JavaDeclaring Server App Components in Pure Java
Declaring Server App Components in Pure Java
 
The art of Azure Functions (unit) testing and monitoring
The art of Azure Functions (unit) testing and monitoringThe art of Azure Functions (unit) testing and monitoring
The art of Azure Functions (unit) testing and monitoring
 
Angular 2.0: Getting ready
Angular 2.0: Getting readyAngular 2.0: Getting ready
Angular 2.0: Getting ready
 
Setting Up Development Environment For Google App Engine & Python | Talentica
Setting Up Development Environment For Google App Engine & Python | TalenticaSetting Up Development Environment For Google App Engine & Python | Talentica
Setting Up Development Environment For Google App Engine & Python | Talentica
 
Enterprise Beacon Object Hive - Siebel Version Control
Enterprise Beacon Object Hive - Siebel Version ControlEnterprise Beacon Object Hive - Siebel Version Control
Enterprise Beacon Object Hive - Siebel Version Control
 
What's New in Jira Cloud for Developers
What's New in Jira Cloud for DevelopersWhat's New in Jira Cloud for Developers
What's New in Jira Cloud for Developers
 
Big ideas in small packages - How microservices helped us to scale our vision
Big ideas in small packages  - How microservices helped us to scale our visionBig ideas in small packages  - How microservices helped us to scale our vision
Big ideas in small packages - How microservices helped us to scale our vision
 
Creating Event Driven Serverless Applications - Sandeep - Adobe - Serverless ...
Creating Event Driven Serverless Applications - Sandeep - Adobe - Serverless ...Creating Event Driven Serverless Applications - Sandeep - Adobe - Serverless ...
Creating Event Driven Serverless Applications - Sandeep - Adobe - Serverless ...
 
DevIntersections 2014 Web API Slides
DevIntersections 2014 Web API SlidesDevIntersections 2014 Web API Slides
DevIntersections 2014 Web API Slides
 
Stateful patterns in Azure Functions
Stateful patterns in Azure FunctionsStateful patterns in Azure Functions
Stateful patterns in Azure Functions
 
Lwc presentation
Lwc presentationLwc presentation
Lwc presentation
 
Infrastructure as code
Infrastructure as codeInfrastructure as code
Infrastructure as code
 
Alfresco/Activiti Modeler Application - Andras Popovics - 2019
Alfresco/Activiti Modeler Application - Andras Popovics - 2019Alfresco/Activiti Modeler Application - Andras Popovics - 2019
Alfresco/Activiti Modeler Application - Andras Popovics - 2019
 
An Exploration of Cross-product App Experiences
An Exploration of Cross-product App ExperiencesAn Exploration of Cross-product App Experiences
An Exploration of Cross-product App Experiences
 
Rob Gruhl and Erik Erikson - What We Learned in 18 Serverless Months at Nords...
Rob Gruhl and Erik Erikson - What We Learned in 18 Serverless Months at Nords...Rob Gruhl and Erik Erikson - What We Learned in 18 Serverless Months at Nords...
Rob Gruhl and Erik Erikson - What We Learned in 18 Serverless Months at Nords...
 

Viewers also liked

4 g technology
4 g  technology4 g  technology
4 g technology
sonu_kushwah10
 
Web design company budnet
Web design company   budnetWeb design company   budnet
Web design company budnet
Webdesign Coimbatore
 
Месячник с 13 по 18 апреля
Месячник с 13 по 18 апреляМесячник с 13 по 18 апреля
Месячник с 13 по 18 апреля
Titenko1
 
Bloodborne pathogens 2014
Bloodborne pathogens 2014Bloodborne pathogens 2014
Bloodborne pathogens 2014
Mdunnam
 
Domestic violence 2014
Domestic violence 2014Domestic violence 2014
Domestic violence 2014
Mdunnam
 
Что должен знать будущий первоклассник
Что должен знать будущий первоклассникЧто должен знать будущий первоклассник
Что должен знать будущий первоклассник
Titenko1
 
караяни
караяникараяни
караяни
Titenko1
 
Права ребенка (классный час для начальной школы)
Права ребенка (классный час для начальной школы)Права ребенка (классный час для начальной школы)
Права ребенка (классный час для начальной школы)
Titenko1
 
инструкция по регистрации электронно журнала
инструкция по регистрации электронно журналаинструкция по регистрации электронно журнала
инструкция по регистрации электронно журнала
Titenko1
 
Readiciderevised
ReadiciderevisedReadiciderevised
Readiciderevised
jhopehumphrey
 
Kvm简介
Kvm简介Kvm简介
Kvm简介
zhangjunli
 
NHGSA Yearbook 2014
NHGSA Yearbook 2014NHGSA Yearbook 2014
NHGSA Yearbook 2014
GraniteStateAmbassadors
 
Беспризорность и безназдорность
Беспризорность и безназдорностьБеспризорность и безназдорность
Беспризорность и безназдорность
Titenko1
 
Breed vol 01
Breed vol 01Breed vol 01
Breed vol 01
Fouzia Baig
 
Прадедушка шелаева валерия
Прадедушка шелаева валерияПрадедушка шелаева валерия
Прадедушка шелаева валерия
Titenko1
 
Bahan bahan
Bahan bahanBahan bahan
Bahan bahan
Sutrisno Lazyboy
 
Bloodborne Pathogens Training
Bloodborne Pathogens TrainingBloodborne Pathogens Training
Bloodborne Pathogens Training
Mdunnam
 
Аутизм
АутизмАутизм
Аутизм
Titenko1
 
Презентация
ПрезентацияПрезентация
Презентация
Titenko1
 

Viewers also liked (20)

Pentax
PentaxPentax
Pentax
 
4 g technology
4 g  technology4 g  technology
4 g technology
 
Web design company budnet
Web design company   budnetWeb design company   budnet
Web design company budnet
 
Месячник с 13 по 18 апреля
Месячник с 13 по 18 апреляМесячник с 13 по 18 апреля
Месячник с 13 по 18 апреля
 
Bloodborne pathogens 2014
Bloodborne pathogens 2014Bloodborne pathogens 2014
Bloodborne pathogens 2014
 
Domestic violence 2014
Domestic violence 2014Domestic violence 2014
Domestic violence 2014
 
Что должен знать будущий первоклассник
Что должен знать будущий первоклассникЧто должен знать будущий первоклассник
Что должен знать будущий первоклассник
 
караяни
караяникараяни
караяни
 
Права ребенка (классный час для начальной школы)
Права ребенка (классный час для начальной школы)Права ребенка (классный час для начальной школы)
Права ребенка (классный час для начальной школы)
 
инструкция по регистрации электронно журнала
инструкция по регистрации электронно журналаинструкция по регистрации электронно журнала
инструкция по регистрации электронно журнала
 
Readiciderevised
ReadiciderevisedReadiciderevised
Readiciderevised
 
Kvm简介
Kvm简介Kvm简介
Kvm简介
 
NHGSA Yearbook 2014
NHGSA Yearbook 2014NHGSA Yearbook 2014
NHGSA Yearbook 2014
 
Беспризорность и безназдорность
Беспризорность и безназдорностьБеспризорность и безназдорность
Беспризорность и безназдорность
 
Breed vol 01
Breed vol 01Breed vol 01
Breed vol 01
 
Прадедушка шелаева валерия
Прадедушка шелаева валерияПрадедушка шелаева валерия
Прадедушка шелаева валерия
 
Bahan bahan
Bahan bahanBahan bahan
Bahan bahan
 
Bloodborne Pathogens Training
Bloodborne Pathogens TrainingBloodborne Pathogens Training
Bloodborne Pathogens Training
 
Аутизм
АутизмАутизм
Аутизм
 
Презентация
ПрезентацияПрезентация
Презентация
 

Similar to AngularJSTO presentation

Angular js firebase-preso
Angular js firebase-presoAngular js firebase-preso
Angular js firebase-preso
Avinash Kondagunta
 
Fed London - January 2015
Fed London - January 2015Fed London - January 2015
Fed London - January 2015
Phil Leggetter
 
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB
 
How to Build Front-End Web Apps that Scale - FutureJS
How to Build Front-End Web Apps that Scale - FutureJSHow to Build Front-End Web Apps that Scale - FutureJS
How to Build Front-End Web Apps that Scale - FutureJS
Phil Leggetter
 
Unleash the power of Serverless Computing
Unleash the power of Serverless ComputingUnleash the power of Serverless Computing
Unleash the power of Serverless Computing
Gaurav Madaan
 
Azure functions
Azure functionsAzure functions
Azure functions
vivek p s
 
Building a scalable API with Grails
Building a scalable API with GrailsBuilding a scalable API with Grails
Building a scalable API with Grails
Tanausu Cerdeña
 
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on KubernetesUltimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
kloia
 
Azure Serverless Toolbox
Azure Serverless ToolboxAzure Serverless Toolbox
Azure Serverless Toolbox
Johan Eriksson
 
First Look at Azure Logic Apps (BAUG)
First Look at Azure Logic Apps (BAUG)First Look at Azure Logic Apps (BAUG)
First Look at Azure Logic Apps (BAUG)
Daniel Toomey
 
[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...
[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...
[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...
CocoaHeads Tricity
 
Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...
Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...
Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...
MongoDB
 
Patterns and practices for building enterprise-scale HTML5 apps
Patterns and practices for building enterprise-scale HTML5 appsPatterns and practices for building enterprise-scale HTML5 apps
Patterns and practices for building enterprise-scale HTML5 apps
Phil Leggetter
 
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...
Tokyo Azure Meetup
 
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Phil Leggetter
 
#SpFestSea azr203 Azure functions lessons learned
#SpFestSea azr203 Azure functions lessons learned#SpFestSea azr203 Azure functions lessons learned
#SpFestSea azr203 Azure functions lessons learned
Vincent Biret
 
Azure Functions Real World Examples
Azure Functions Real World Examples Azure Functions Real World Examples
Azure Functions Real World Examples
Yochay Kiriaty
 
Angular Ivy- An Overview
Angular Ivy- An OverviewAngular Ivy- An Overview
Angular Ivy- An Overview
Jalpesh Vadgama
 
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud EnvironmentsTools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
VMware Tanzu
 
JAX 2014 - The PaaS to a better IT architecture.
JAX 2014 - The PaaS to a better IT architecture.JAX 2014 - The PaaS to a better IT architecture.
JAX 2014 - The PaaS to a better IT architecture.
Sebastian Faulhaber
 

Similar to AngularJSTO presentation (20)

Angular js firebase-preso
Angular js firebase-presoAngular js firebase-preso
Angular js firebase-preso
 
Fed London - January 2015
Fed London - January 2015Fed London - January 2015
Fed London - January 2015
 
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
 
How to Build Front-End Web Apps that Scale - FutureJS
How to Build Front-End Web Apps that Scale - FutureJSHow to Build Front-End Web Apps that Scale - FutureJS
How to Build Front-End Web Apps that Scale - FutureJS
 
Unleash the power of Serverless Computing
Unleash the power of Serverless ComputingUnleash the power of Serverless Computing
Unleash the power of Serverless Computing
 
Azure functions
Azure functionsAzure functions
Azure functions
 
Building a scalable API with Grails
Building a scalable API with GrailsBuilding a scalable API with Grails
Building a scalable API with Grails
 
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on KubernetesUltimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
 
Azure Serverless Toolbox
Azure Serverless ToolboxAzure Serverless Toolbox
Azure Serverless Toolbox
 
First Look at Azure Logic Apps (BAUG)
First Look at Azure Logic Apps (BAUG)First Look at Azure Logic Apps (BAUG)
First Look at Azure Logic Apps (BAUG)
 
[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...
[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...
[CocoaHeads Tricity] Andrzej Dąbrowski - Dependency injection and testable ar...
 
Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...
Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...
Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...
 
Patterns and practices for building enterprise-scale HTML5 apps
Patterns and practices for building enterprise-scale HTML5 appsPatterns and practices for building enterprise-scale HTML5 apps
Patterns and practices for building enterprise-scale HTML5 apps
 
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...
 
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
 
#SpFestSea azr203 Azure functions lessons learned
#SpFestSea azr203 Azure functions lessons learned#SpFestSea azr203 Azure functions lessons learned
#SpFestSea azr203 Azure functions lessons learned
 
Azure Functions Real World Examples
Azure Functions Real World Examples Azure Functions Real World Examples
Azure Functions Real World Examples
 
Angular Ivy- An Overview
Angular Ivy- An OverviewAngular Ivy- An Overview
Angular Ivy- An Overview
 
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud EnvironmentsTools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
Tools and Recipes to Replatform Monolithic Apps to Modern Cloud Environments
 
JAX 2014 - The PaaS to a better IT architecture.
JAX 2014 - The PaaS to a better IT architecture.JAX 2014 - The PaaS to a better IT architecture.
JAX 2014 - The PaaS to a better IT architecture.
 

Recently uploaded

What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
aymanquadri279
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
Peter Muessig
 

Recently uploaded (20)

What is Master Data Management by PiLog Group
What is Master Data Management by PiLog GroupWhat is Master Data Management by PiLog Group
What is Master Data Management by PiLog Group
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
 

AngularJSTO presentation

  • 1. N(G)-Apps, One Core Alan Hietala @alanhietala Sr Software Developer @ecobee Core ng-app ng-app ng-app ng-app ng-app
  • 2. web apps mobile apps remote teams ! on ! 1 API A Puzzle of Paint - Brent Danley
  • 4. Connection Manager • All ThermostatServices make their data calls here • Facade created to our bare metal API’s. • Hides details of authentication from the developer • provides a clean interface for actions that are more complicated within the API itself.
  • 5. Thermostat Services • Rely on connection manager for data • master service that splits the api json into bits • Thermostat Service contains many task specific services that process those bits of json
  • 6. Core Thermostat Services • Thermostat service gets update • Updates sub services • Business Logic in sub services PollData() updateSubServices() Thermostat Service updateData(data) createVacation() Vacation Service updateData(data) updateSomeSetting() Settings Service updateData(data) changeSetPoint() Setpoint Service
  • 7. Model Factories • Raw API data often not in the best format for data binding • Model Factories create angular specific models • Our sub services use the factory to create the data objects controllers watch.
  • 8. Example ModelFactory angular.module('myApp') .factory('ScheduleModelFactory', function () { return { makeModel: function (rawData) { // transform the raw data into a great model return awesomeModel; } }; });
  • 9. Service using a ModelFactory angular.module('myApp') .factory('ScheduleService', function (ScheduleModelFactory) { return { scheduleModel: null, // controllers will watch this update: function (rawData) { this.scheduleModel = ScheduleModelFactory.makeModel(rawData); } }; });
  • 10. Controllers Example angular.module('myApp') .controller('SetTemperatureCtrl', function ($scope, SetPointService) { $scope.viewSetPoint = 23; $scope.setPointService = SetPointService; $scope.$watch(‘setPointService.setPoint’, function (newValue) { $scope.viewSetPoint = newValue; }; $scope.changeSetPoint = function (newSetPoint) { $scope.setPointService.changeSetPoint(newSetPoint); } }); Inject sub service you need
  • 11. Business logic? Ram it Down Untitled - Etno Deos
  • 12. Core enforces Business Rules • Throwing errors from core important for developers down stream • Downstream devs don’t have to know all the business rules. • We don’t rely on an API call failures business rules client side ensure speed.
  • 13. Overriding core • What if core doesn’t quite meet an apps needs? • Create override module • Use a decorator
  • 14. Override Module ! ! angular.module(“myApp”, [“overrideModule”]); ! ! ! ! ! ! Angular takes the last loaded version if two modules have the same service defined.
  • 15. Decorator angular.module('myApp', ['myLibrary']) .config(function ($provide) { $provide.decorator(‘serviceName’, function ($delegate) { var patchedFunction = function () { // do something here } $delegate.functionToPatch = patchedFunction; return $delegate; }); }); Angular Sanctioned Monkey Patching
  • 16. DI Makes this all simple • All of the architecture above is based heavily on DI • We create many interchangeable parts • Each encapsulates a single idea • If any part of an idea changes we update one area
  • 17. Core is Sacred Protected - Hartwig HKD How do we Protect it?
  • 18. Broken Window Theory • if you don’t fix broken windows people will break more • Applies to code bases too • Refactoring when you find problems becomes central
  • 19. Unit tests Make things better, not worse you won’t change things you’re scared of breaking
  • 20. Tests are Documentation • BDD style tests ensures they read like a spec • If tests are up to date so is your software spec describe(‘Vacation Service’, function () { describe(‘updateVacation()’, function() { it(‘should update a vacation with the new date and time’, function () { // test details }); ! it(‘should throw and error when the start date is after the end date’, function () { // test details }); }); });
  • 21. Karma Advantages • Run tests on all your target browsers • Catch browser specific bugs Date.parse anyone? • Good code coverage tools ties in with CI systems easily
  • 23. Change Log • V1.0.1 - Added net new feature • V1.0.0 - changed business logic around thermostats
  • 24. Problem • How do we avoid breaking changes in core affecting downstream code unexpectedly? • Where we started wasn’t very ideal
  • 25. Started with Sync Scripts • With 2 apps had one copy services from the other • As apps started to diverge the exclude list grew • needed a better solution
  • 27. Bower to the rescue • Bit the bullet and moved common services to it’s own repo • Set up bower in our applications to pull our new tagged core repo.
  • 28. How do we do it? { "name": "myApp", "version": "1.0.0", "dependencies": { …. "mylibrary": “git@github.com:mycompany/mylibrary.git#v1.2.11", …. } } In project bower.json In core bower.json { "name": "mylibrary", "private": "true", "version": "1.2.11", "main": “dist/mylibrary.min.js” … } Tag in git git tag -a v1.2.11 -m “mylibrary version message”
  • 29. Other benefits • Forces conversations about what goes into core services more thinking time is a good thing • Easy rollback if change breaks your app. • Dev controls what core version to use and upgrade timing
  • 30. In Summary • Broke core into small services • Abstracted connections • model factories transform API data for frontend use • Protect core with Unit testing, Dependency Management, Code Reviews • Angular makes this all easy
  • 32. Covered • Services • Sub Services • Model Factories • Controller interaction • Connection Manager • Dependency Management • Unit testing with Karma • Code Review Tools • Override modules • Decorators • Change Logs