http://www.opitz-consulting.com/go/3-4-898
JavaScript-Anwendungen werden immer leistungsfähiger, aber auch immer komplexer. Wie kann eine Anwendung trotz wachsender Größe wartbar und testbar bleiben? Entwurfsmuster wie Data Binding, Dependency Injection und Modularisierung helfen, dieses Ziel zu erreichen.
Tobias Bosch erläuterte in seinem Vortrag bei der WebTechConference am 17.10.2012 in Mainz die Konzepte und verdeutlicht sie an einem Beispiel mit AngularJS und jQuery Mobile.
--
Zukunft?! Wir arbeiten dran.
Mobile Solutions by OPITZ CONSULTING
http://www.opitz-consulting.com/go/3-4-898
Über uns:
Als führender Projektspezialist für ganzheitliche IT-Lösungen tragen wir zur Wertsteigerung der Organisationen unserer Kunden bei und bringen IT und Business in Einklang. Mit OPITZ CONSULTING als zuverlässigem Partner können sich unsere Kunden auf ihr Kerngeschäft konzentrieren und ihre Wettbewerbsvorteile nachhaltig absichern und ausbauen.
Über unsere IT-Beratung: http://www.opitz-consulting.com/go/3-8-10
Unser Leistungsangebot: http://www.opitz-consulting.com/go/3-8-874
Karriere bei OPITZ CONSULTING: http://www.opitz-consulting.com/go/3-8-5
44. jQuery Mobile und AngularJS
Das Problem:
Die DOM-Manipulationen von
jQuery Mobile und AngularJS
müssen koordiniert werden!
45. jQuery Mobile und AngularJS
Die Lösung:
jQuery Mobile Angular Adapter
46. jQuery Mobile Angular Adapter
Koordination von jQuery Mobile und AngularJS
Erweiterungen für mobile Web-Apps
Open Source unter
https://github.com/tigbro/
jquery-mobile-angular-adapter
48. Dependency Injection ist ein Entwurfsmuster
und dient dazu, die Abhängigkeiten zwischen
Komponenten zu minimieren.
Es überträgt die Verantwortung für das
Erzeugen und die Verknüpfung von Objekten an
ein extern konfigurierbares Framework
http://de.wikipedia.org/wiki/Dependency_Injection
49. Dependency Injection ist ein Entwurfsmuster
und dient dazu, die Abhängigkeiten zwischen
Komponenten zu minimieren.
Es überträgt die Verantwortung für das
Erzeugen und die Verknüpfung von Objekten an
ein extern konfigurierbares Framework
http://de.wikipedia.org/wiki/Dependency_Injection
52. Beispiel: Backend-Anbindung
var readUrl = 'https://secure.openkeyval.org/';
function read(key, success) {
var url = readUrl + key;
waitdialog.show();
jsonp(url, function(data) {
success(data);
waitdialog.hide();
});
}
53. Beispiel: Backend-Anbindung
var readUrl = 'https://secure.openkeyval.org/';
function read(key, success) {
var url = readUrl + key;
waitdialog.show();
jsonp(url, function(data) {
success(data);
waitdialog.hide();
});
}
54. Beispiel: Backend-Anbindung
var readUrl = 'https://secure.openkeyval.org/';
function read(key, success) {
var url = readUrl + key;
waitdialog.show();
jsonp(url, function(data) {
success(data);
waitdialog.hide();
});
}
55. Beispiel: Backend-Anbindung
waitDialog
todoController todoStore key value
key value key value ... ...
refreshTodos ... read ...
todoStore waitDialog
jsonp jsonp
key value
... ...
created by
Factories
56. Beispiel: Backend-Anbindung
waitDialog
todoController todoStore key value
key value key value ... ...
refreshTodos ... read ...
todoStore waitDialog
jsonp jsonp
key value
... ...
created by
Dependency Injection
57. Angular JS
Declarative MVC with
UI Templates Dependency Injection
Two-Way Framework
Data Binding
http://angularjs.org/#/
58. Services und DI mit Angular
function jsonpFactory() {
// returns jsonp function
// ...
}
function waitdialogFactory() {
// returns waitdialog object
// ...
}
59. Services und DI mit Angular
var module = angular.module("todo", []);
60. Services und DI mit Angular
var module = angular.module("todo", []);
module.factory('jsonp', jsonpFactory);
module.factory('waitdialog', waitdialogFactory);
61. Services und DI mit Angular
var module = angular.module("todo", []);
module.factory('jsonp', jsonpFactory);
module.factory('waitdialog', waitdialogFactory);
function todoStoreFactory(jsonp, waitdialog) {
function read(key, success) {
// use jsonp, waitdialog here
}
return {
read: read
};
}
62. Services und DI mit Angular
var module = angular.module("todo", []);
module.factory('jsonp', jsonpFactory);
module.factory('waitdialog', waitdialogFactory);
function todoStoreFactory(jsonp, waitdialog) {
function read(key, success) {
// use jsonp, waitdialog here
}
return {
read: read
};
}
todoStoreFactory.$inject = ['jsonp', 'waitdialog'];
63. Services und DI mit Angular
var module = angular.module("todo", []);
module.factory('jsonp', jsonpFactory);
module.factory('waitdialog', waitdialogFactory);
function todoStoreFactory(jsonp, waitdialog) {
// ...
}
todoStoreFactory.$inject = ['jsonp', 'waitdialog'];
module.factory('todoStore', todoStoreFactory);
64. Controller und DI mit Angular
function TodoController($scope, todoStore) {
...
}
TodoController.$inject = ['$scope', 'todoStore'];
module.controller("rylc.TodoController", TodoController);
65. Controller und DI mit Angular
function TodoController($scope, todoStore) {
...
}
TodoController.$inject = ['$scope', 'todoStore'];
module.controller("rylc.TodoController", TodoController);
66. Controller und DI mit Angular
function TodoController($scope, todoStore) {
...
}
TodoController.$inject = ['$scope', 'todoStore'];
module.controller("rylc.TodoController", TodoController);
67. jQuery Mobile Angular Adapter
Koordination von jQuery Mobile und AngularJS
Erweiterungen für mobile Web-Apps
Open Source unter
https://github.com/tigbro/
jquery-mobile-angular-adapter
87. In the hive 11: nectar and pollen
by Max xx, http://www.flickr.com/photos/max_westby/4567762490
Books
By Rodrigo Galindez, http://www.flickr.com/photos/rodrigogalindez/4637637337/
IMG_1300-Edit
by Susan E Adams, http://www.flickr.com/photos/susanad813/3912914836/
Doble Via
by amslerPIX, http://www.flickr.com/photos/amslerpix/6242266697/
MacBook Pro Keyboard
by superstrikertwo, http://www.flickr.com/photos/superstrikertwo/4989727256/
Stubborn Last Drop
by RogueSun Media, http://www.flickr.com/photos/shuttercat7/627798443/