SlideShare a Scribd company logo
1 of 75
Download to read offline
AngularJS in large
applications
AngularJS Meetup

ae nv/sa
Interleuvenlaan 27b, B-3001 Heverlee
T +32 16 39 30 60 - F +32 16 39 30 70
www.ae.be
Agenda






Introduction
Managing a large application
Communication through hypermedia
Break
Reusable components

 2
http://www.slideshare.net/AE_nv/angular-js-in-large-applications
http://ow.ly/sPVGy

#ajsugbe
 3
Introduction
 Glenn Dejaeger @glenndejaeger
 Experience: 2+ years

 Thomas Anciaux @thomaux
 Experience: 2+ years

 Pieter Herroelen @piether
 Experience: 1 year

We work for AE @AE_NV

 4
Project context







Enterprise environment
Master database system
CRUD
Spearhead
Internal project
Infrequent releases

 5
Project size

 17 developers, 4 js developers
 10k MD total
 LOC’s
 JavaScript: 7k
 Java REST layer: 11k
 Java total: 700k+

 6
PART 1

MANAGING A LARGE APPLICATION

 7
Historical Issues

APP

MODULES

FRAMEWORK

REQUIREJS

APP
.LESS

MODULES
.LESS

 8
Historical issues
 No real build
 Manual
 Monolithic

 RequireJS
 Karma

 9
Initial solutions
 Introduce Grunt
 And separate builds

 Remove dependency on RequireJS

 10
New Issues

APP

MODULES

FRAMEWORK

MODULES

BOOTSTRAP

ANGULAR

BOOTSTRAP

FRAMEWORK

FRAMEWORK

ANGULAR

ANGULAR
 11
New issues
<base href=“whatever/buildnr/”>
directive(“aDirective”, function(){
return {
...,
templateUrl: “relative/path/...”
...
}
});

 12
New issues
 Dependency management?
 Referencing HTML templates

 13
Dependency Management?
 Manual!
 Error prone
 Not feasible with a large set of dependencies

 Wrap dependencies with output
 Ugly!

 14
New Solution
 Introduce Bower
 Introduce $templateCache

 15
Bower
 Setup each project as a Bower module
 Publish versions independently
 Bower can target local or zipped folders
 Store the tagged versions anywhere you’d like

 16
$templateCache
 Angular service
 Registers templates by name
 Grunt task compiles and concatenates all HTML to
JS

 17
Conclusion
 Advantages
 Automation of build system
 Closer to pure angular (easy Karma setup etc.)
 Dependency management

 Disadvantages
 One big file per project/module
 Harder to use Chrome Dev tools

 18
QUESTIONS?

 19
PART 2

COMMUNICATION THROUGH
HYPERMEDIA
 20
Project needs
 A lot of similar functionality (CRUD)
 Hierarchical data
 Flexible UI: “A browser in a browser”
 Multiple tabs
 Links all over the place
...

 21
First approach
"municipality": {
"criteria": {
"groups": [["LABEL“,"POSTAL_CODE"]],
“label": {
"type": "TEXT_MEDIUM",
"operators": "ALPHA",
"common": true,
"mandatory": false
},
…
},
…
 22
First approach

CLIENT

DATA

SERVER

CONFIG

 23
First approach

http://www.youtube.com/watch?v=62RvRQuMVyg

 24
Richardson maturity model

http://martinfowler.com/articles/richardsonMaturityModel.html
 25
 26
Richardson maturity model

http://martinfowler.com/articles/richardsonMaturityModel.html
 27
Hypermedia

CLIENT

HYPERMEDIA

SERVER

 28
Hypermedia

CLIENT

JSON over HTTP

SERVER

 29
http://www.toddmgreen.com/wp-content/uploads/2011/12/Arthur-C-2.png
 30
Hypermedia
Content-type: application/hal+json

CLIENT

HYPERMEDIA

SERVER

 31
Hypermedia
Content-type: application/hal+json

SPEC

 32
Hypermedia
Content-type: application/hal+json

SPEC
CLIENT

SERVER

 33
Which specification?

 34
 35
HAL - Hypertext Application Language

http://stateless.co/hal_specification.html
 36
HAL

 37
"_links": {
"self": { "href": "/orders"}
},
"currentlyProcessing": 14,
"shippedToday": 20,
"_embedded": {
"ea:order": [
{
"_links": {
"self": { "href": "/orders/123" },
"ea:basket": { "href": "/baskets/98712" }
},
"total": 30.00
}
...
 38
"_links": {
"self": { "href": "/orders"}
},
"currentlyProcessing": 14,
"shippedToday": 20,
"_embedded": {
"ea:order": [
{
"_links": {
"self": { "href": "/orders/123" },
"ea:basket": { "href": "/baskets/98712" }
},
"total": 30.00
}
...
 39
"_links": {
"self": { "href": "/orders"}
},
"currentlyProcessing": 14,
"shippedToday": 20,
"_embedded": {
"ea:order": [
{
"_links": {
"self": { "href": "/orders/123" },
"ea:basket": { "href": "/baskets/98712" }
},
"total": 30.00
}
...
 40
EPiaAACBSwaADEtPoHTMD

<resource uri=“http://example.com/path”> ...

 41
JSON

• properties
• links
• embedded

$scope

objects

 42
JSON

• properties
• links
• embedded

$scope

functions

 43
follow() Replace content of directive with
resource behind link

Example:
<a ng-click=“links[‘children’].follow()”></a>

 44
function(method, data) Do an HTTP call
with the specified method and the specified data
in the request. Returns a promise.
Example:
$scope.links[‘save’](‘POST’, $scope.form).then(...);

 45
HAL

CLIENT

SERVER

 46
HAL

CLIENT

SERVER

LINK RELATIONS

 47
JSON

• properties
• links
• embedded

$scope

Recursive
structure

 48
JSON

$scope

HTML

• properties
• links
• embedded

• header

property

 49
JSON

$scope

<ng-include
src=“property+’.html’”>
</ng-include>

• properties
• links
• embedded

• header

HTML

property

 50
http://www.x17online.com/gisele-elephant.jpg

 51
Where is the model?

 52
http://www.x17online.com/gisele-elephant.jpg

 53
QUESTIONS?

 54
PART 2.5

BREAK

 55
PART 3

DEVELOPING REUSABLE
COMPONENTS
 56
 57
What is a component?

 58
What is a component?
 An identifiable part of a larger program or
construction
 Provides a particular function or group of related
functions
 Has its own responsibility

 59
What is a component?

COMPONENT

DIRECTIVE

 60
Grid component

 61
Grid component
directive(“grid”, function(){
return {
...
scope: {
data: ‘=‘,
columnDefs: ‘=‘,
sortable: ‘=‘,
filterable: ‘=‘
...
}
controller: ‘gridController’,
template: $templateCache.get(‘grid.html')
...
}
});
 62
Grid component
<div ng-init=“columnDefs=[
{field: ‘firstName’, title: ’firstname’},
{field: ‘lastName’, title: ’lastname’},
{field: ‘city’, title: ’city’},
{field: ‘title’, title: ’title’},
{field: ‘birthDate’, title:’birthdate’},
{field: ‘age’, title:’age’},
]”>
<div grid
data=“$scope.persons”
column-defs=“columnDefs”></div>
</div>

 63
Problem 1
 1 big controller
 Unreadable
 Unmaintainable
 No separation of concerns

 64
Solution

 Different services with their own responsibility
 Injected into controller
 Only logic, no state!

 65
Problem 2
 1 big object to configure all the columns
 Unreadable
 Static
 Error prone

 66
Solution

<div grid data=“$scope.persons”>
<div grid-column field=“firstName” title=“firstname”/>
<div grid-column field=“lastName” title=“lastname”/>
<div grid-column field=“city” title=“city”/>
<div grid-column field=“title” title=“title”/>
<div grid-column field=“birthDate” title=“birthdate”/>
<div grid-column field=“age” title=“age”/>
</div>

 67
What is a component?

COMPONENT

DIRECTIVE
DIRECTIVE
DIRECTIVE

 68
Grid component

directive(“grid”, function(){
return {
...
transclude: true
...
}
});

 69
Grid component
directive(“gridColumn”, function(){
return {
...
scope: {
field: ‘@‘,
title: ‘@‘,
hidden: ‘=‘
...
}
require: ‘^grid’,
link: function(scope, elem, attrs, gridCtrl){
...
}
...
});
 70
Communication between components
 Isolated scopes
 Don’t pollute other scopes
 No direct access to parent scope

 71
Communication between components
 Events
 Loosely coupled
 No control over listeners

 Shared services
 Tightly coupled
 Control over consumers

 72
Parting words
 Solved a number of problems
 Modularity of the build
 Interaction with a hypermedia back-end
 Modularity of the code

 Created a few new problems
 YMMV

 73
QUESTIONS?

 74
@ae_nv
linkedin.com/company/ae-nv-sa

More Related Content

Viewers also liked

Making Sense of Hypermedia APIs – Hype or Reality?
Making Sense of Hypermedia APIs – Hype or Reality?Making Sense of Hypermedia APIs – Hype or Reality?
Making Sense of Hypermedia APIs – Hype or Reality?
Akana
 
The hypermedia api
The hypermedia apiThe hypermedia api
The hypermedia api
Inviqa
 

Viewers also liked (8)

Hypermedia in API Design: Enterprise as an Early Adopter
Hypermedia in API Design: Enterprise as an Early AdopterHypermedia in API Design: Enterprise as an Early Adopter
Hypermedia in API Design: Enterprise as an Early Adopter
 
Making Sense of Hypermedia APIs – Hype or Reality?
Making Sense of Hypermedia APIs – Hype or Reality?Making Sense of Hypermedia APIs – Hype or Reality?
Making Sense of Hypermedia APIs – Hype or Reality?
 
The hypermedia api
The hypermedia apiThe hypermedia api
The hypermedia api
 
Why should i care about hypermedia
Why should i care about hypermediaWhy should i care about hypermedia
Why should i care about hypermedia
 
Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - M...
Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - M...Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - M...
Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - M...
 
Deep-dive into Microservice Outer Architecture
Deep-dive into Microservice Outer ArchitectureDeep-dive into Microservice Outer Architecture
Deep-dive into Microservice Outer Architecture
 
Hypermedia: The Missing Element to Building Adaptable Web APIs in Rails
Hypermedia: The Missing Element to Building Adaptable Web APIs in RailsHypermedia: The Missing Element to Building Adaptable Web APIs in Rails
Hypermedia: The Missing Element to Building Adaptable Web APIs in Rails
 
reveal.js 3.0.0
reveal.js 3.0.0reveal.js 3.0.0
reveal.js 3.0.0
 

Similar to AngularJS in large applications - AE NV

Similar to AngularJS in large applications - AE NV (20)

Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome
Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome
Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome
 
Why Kubernetes? Cloud Native and Developer Experience at Zalando - OWL Tech &...
Why Kubernetes? Cloud Native and Developer Experience at Zalando - OWL Tech &...Why Kubernetes? Cloud Native and Developer Experience at Zalando - OWL Tech &...
Why Kubernetes? Cloud Native and Developer Experience at Zalando - OWL Tech &...
 
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
Comment développer une application mobile en 8 semaines - Meetup PAUG 24-01-2023
 
Clean Architecture @ Taxibeat
Clean Architecture @ TaxibeatClean Architecture @ Taxibeat
Clean Architecture @ Taxibeat
 
Vuejs
VuejsVuejs
Vuejs
 
Node.js for enterprise - JS Conference
Node.js for enterprise - JS ConferenceNode.js for enterprise - JS Conference
Node.js for enterprise - JS Conference
 
Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017
Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017
Microservices in GO - Massimiliano Dessì - Codemotion Rome 2017
 
Final year project working documentation 2020
Final year project working documentation 2020Final year project working documentation 2020
Final year project working documentation 2020
 
Droidcon Berlin Barcamp 2016
Droidcon Berlin Barcamp 2016Droidcon Berlin Barcamp 2016
Droidcon Berlin Barcamp 2016
 
Web3Hub-GDSC presentation.pdf
Web3Hub-GDSC presentation.pdfWeb3Hub-GDSC presentation.pdf
Web3Hub-GDSC presentation.pdf
 
Micro service architecture
Micro service architectureMicro service architecture
Micro service architecture
 
Deep learning and streaming in Apache Spark 2.2 by Matei Zaharia
Deep learning and streaming in Apache Spark 2.2 by Matei ZahariaDeep learning and streaming in Apache Spark 2.2 by Matei Zaharia
Deep learning and streaming in Apache Spark 2.2 by Matei Zaharia
 
Camunda BPM 7.2: Tasklist and Javascript Forms SDK (English)
Camunda BPM 7.2: Tasklist and Javascript Forms SDK (English)Camunda BPM 7.2: Tasklist and Javascript Forms SDK (English)
Camunda BPM 7.2: Tasklist and Javascript Forms SDK (English)
 
Agile integration workshop Seattle
Agile integration workshop SeattleAgile integration workshop Seattle
Agile integration workshop Seattle
 
JavaScript Modules Past, Present and Future
JavaScript Modules Past, Present and FutureJavaScript Modules Past, Present and Future
JavaScript Modules Past, Present and Future
 
Big Data Tools in AWS
Big Data Tools in AWSBig Data Tools in AWS
Big Data Tools in AWS
 
Top Performance Problems in Distributed Architectures
Top Performance Problems in Distributed ArchitecturesTop Performance Problems in Distributed Architectures
Top Performance Problems in Distributed Architectures
 
Camel on Cloud by Christina Lin
Camel on Cloud by Christina LinCamel on Cloud by Christina Lin
Camel on Cloud by Christina Lin
 
Accessiblity 101 and JavaScript Frameworks
Accessiblity 101 and JavaScript Frameworks Accessiblity 101 and JavaScript Frameworks
Accessiblity 101 and JavaScript Frameworks
 
Vaadin & Web Components
Vaadin & Web ComponentsVaadin & Web Components
Vaadin & Web Components
 

More from AE - architects for business and ict

AE Foyer: Soa Integration Architecture and Api Management
AE Foyer: Soa Integration Architecture and Api ManagementAE Foyer: Soa Integration Architecture and Api Management
AE Foyer: Soa Integration Architecture and Api Management
AE - architects for business and ict
 
Building the digital enterprise for the age of the customer (part 2)
Building the digital enterprise for the age of the customer (part 2)Building the digital enterprise for the age of the customer (part 2)
Building the digital enterprise for the age of the customer (part 2)
AE - architects for business and ict
 

More from AE - architects for business and ict (14)

c-quilibrium R forecasting integration
c-quilibrium R forecasting integrationc-quilibrium R forecasting integration
c-quilibrium R forecasting integration
 
Legal aspects of using R
Legal aspects of using RLegal aspects of using R
Legal aspects of using R
 
AE Foyer - Value Driven Transformation
AE Foyer - Value Driven TransformationAE Foyer - Value Driven Transformation
AE Foyer - Value Driven Transformation
 
AE Foyer: Soa Integration Architecture and Api Management
AE Foyer: Soa Integration Architecture and Api ManagementAE Foyer: Soa Integration Architecture and Api Management
AE Foyer: Soa Integration Architecture and Api Management
 
AE Foyer: Information Management in the Digital Enterprise
AE Foyer: Information Management in the Digital EnterpriseAE Foyer: Information Management in the Digital Enterprise
AE Foyer: Information Management in the Digital Enterprise
 
AE Foyer: Embrace your customer get digital (handouts 18052015)
AE Foyer: Embrace your customer get digital (handouts 18052015)AE Foyer: Embrace your customer get digital (handouts 18052015)
AE Foyer: Embrace your customer get digital (handouts 18052015)
 
Trends in front end engineering_handouts
Trends in front end engineering_handoutsTrends in front end engineering_handouts
Trends in front end engineering_handouts
 
Embrace your customer, get digital!
Embrace your customer, get digital!Embrace your customer, get digital!
Embrace your customer, get digital!
 
Building the digital enterprise for the age of the customer (part 2)
Building the digital enterprise for the age of the customer (part 2)Building the digital enterprise for the age of the customer (part 2)
Building the digital enterprise for the age of the customer (part 2)
 
Building the digital enterprise for the age of the customer handouts
Building the digital enterprise for the age of the customer   handoutsBuilding the digital enterprise for the age of the customer   handouts
Building the digital enterprise for the age of the customer handouts
 
AE foyer: From Server Virtualization to Hybrid Cloud
AE foyer: From Server Virtualization to Hybrid CloudAE foyer: From Server Virtualization to Hybrid Cloud
AE foyer: From Server Virtualization to Hybrid Cloud
 
AE foyer on Mobile by Design 19/02/2014
AE foyer on Mobile by Design 19/02/2014AE foyer on Mobile by Design 19/02/2014
AE foyer on Mobile by Design 19/02/2014
 
AE Spot'On - Chris Potts - Enterprise investment: Combining EA and Investment...
AE Spot'On - Chris Potts - Enterprise investment: Combining EA and Investment...AE Spot'On - Chris Potts - Enterprise investment: Combining EA and Investment...
AE Spot'On - Chris Potts - Enterprise investment: Combining EA and Investment...
 
Process Mining in Package Delivery (Logistics) - AE nv
Process Mining in Package Delivery (Logistics) - AE nvProcess Mining in Package Delivery (Logistics) - AE nv
Process Mining in Package Delivery (Logistics) - AE nv
 

Recently uploaded

Microsoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdfMicrosoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdf
Overkill Security
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
FIDO Alliance
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
Muhammad Subhan
 

Recently uploaded (20)

AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Microsoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdfMicrosoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdf
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
 
How to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in PakistanHow to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in Pakistan
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
 

AngularJS in large applications - AE NV