Rapid Application Development
mit Grails und AngularJS
Stefan Glase
Stefan Scheidt
Ihre Sprecher
Stefan.Glase@opitz-consulting.com
twitter/stefanglase
github/codescape
Stefan.Scheidt@opitz-consulting.com
twitter/stefanscheidt
github/stefanscheidt
© OPITZ CONSULTING GmbH 2011 Seite 3<Präsentationstitel – bitte im Folienmaster ändern>
Mission
Wir entwickeln gemeinsam mit allen
Branchen Lösungen, die dazu führen, dass
sich diese Organisationen besser entwickeln
als ihr Wettbewerb.
Unsere Dienstleistung erfolgt
partnerschaftlich und ist auf eine langjährige
Zusammenarbeit angelegt.
Leistungsangebot
Business IT Alignment
Business Information Management
Business Process Management
Anwendungsentwicklung
SOA und System-Integration
IT-Infrastruktur-Management
Märkte
Branchenübergreifend
Über 600 Kunden
29%
Industrie / Versorger /
Telekommunikation
29%
Handel / Logistik /
Dienstleistungen
42%
Öffentliche Auftraggeber / Banken und
Versicherungen / Vereine und Verbände
Eckdaten
Gründung 1990
400 Mitarbeiter
9 Standorte
Frontend-Architekturen
"Multi-Page Web Apps"
Browser Server
Model
View
Controller
Backend
HTML-Page
UI Values
Data
Request
Response
HTML
"Single Page Web Apps"
Browser Server
Model
View
Controller
BackendData
Laufzeit-Sicht "Single Page"
Web Server
REST
Endpoints
Browser
HTML
+ CSS
+ JavaScript
HTML
+ CSS
+ JavaScript
Request
Response:
JSON, HTML
Initiales
Laden
JavaScript
aktualisiert DOM
erleichtern
interaktives UI
unterstützen
"Thin Server Architecture"
bedeuten
Client-Server-Entwicklung
ermöglichen
Offline-Betrieb
sind bereits
länger im Einsatz
ermöglichen SEO
erleichtern
Bookmarking
Multi-Page-Apps Single-Page-Apps
Grails
"Grails is an Open Source, full stack, web application
framework for the JVM. It takes advantage of the
Groovy programming language and convention over
configuration to provide a productive and stream-
lined development experience."
http://grails.org
Spring Groovy
Hibernate SiteMesh
Grails
Technologie-Unterbau
grails-app
- conf
- controllers
- domain
- i18n
- services
- taglib
- utils
- views
lib
scripts
src
- groovy
- java
test
- integration
- unit
web-app
Einheitliche Verzeichnisstruktur
grails-app/conf/
hibernate/
spring/
resources
ApplicationResources
BootStrap
BuildConfig
Config
DataSource
UrlMappings
Konfiguration
Fachklassenmodellierung
class Person {
String firstname
String lastname
String email
static constraints = {
firstname(blank: false)
lastname(blank: false)
email(unique: true, email: true)
}
String toString() {
"$firstname $lastname ($email)"
}
}
„Groovyness“
new File('beispiel.txt').eachLine {
line -> println line
}
new Person(
firstname: 'Max', lastname: 'Mustermann'
).save()
100.times {
println 'Hello World'
}
Plugins
Demo: Grails
http://www.flickr.com/photos/dissolved/2514697398/
AngularJS
"AngularJS is a structural framework for dynamic web
apps. [...] It attempts to minimize the impedance
mismatch between document centric HTML and what
an application needs by creating new HTML
constructs."
http://docs.angularjs.org/guide/introduction
AngularJS im Überblick
Declarative
UI Templates
Framework
MVC with
Dependency Injection
Two-Way
Data Binding
Demo: AngularJS
Grails
&
AngularJS
Aufgabenverteilung
Web Server
REST
Endpoints
Browser
HTML
+ CSS
+ JavaScript
Request Response: JSON
AngularJS
Grails
Optionen für die Integration bei der
Entwicklung:
Separate Projekte
AngularJS-App eingebettet als Asset
Demo
Bewertung und Fazit
Fazit (1)
Grails ermöglicht die produktive Entwicklung von Multi-
Page-Apps und des Backends für Single-Page-Apps.
AngularJS ermöglicht eine produktive Entwicklung von
Single-Page-Apps als Konsument eines REST-Backends.
Fazit (2)
Eine Trennung in separate Projekte erlaubt die
Entkopplung von Frontend und Backend bei
Entwicklung und im Betrieb.
Da AngularJS optional nur Teile einer Page
"kontrollieren" kann, ist auch eine Mischung von Multi-
Page- und Single-Page-Architektur möglich.
Beispiel-Code
https://github.com/opitzconsulting/tasklist-grails-angular
Links
http://grails.org
http://angularjs.org
Grails in Action, 2nd Ed., Ch. 14
http://angular-tips.com/blog/2013/08/
my-workflow-with-lineman/
Herzlichen Dank für
Ihre Aufmerksamkeit!
youtube.com/opitzconsulting
twitter.com/OC_WIRE
slideshare.net/opitzconsulting
xing.com/net/opitzconsulting

Rapid Application Development mit Grails und AngularJS