jan reher may 2013

21
We chose Grails and Groovy for a real-world project. Was it wise? Jan Reher, Systematic

Upload: gr8conf

Post on 17-May-2015

1.170 views

Category:

Technology


0 download

DESCRIPTION

At Systematic we are using Groovy technologies to build a fairly standard 4-tier Java web application for a customer. This lecture describes our experience. We will tell you about the choices we made, how we built up knowledge about Groovy, what our biggest mistake was, and how we dealt with it. We used Grails for the user interface, pure Groovy for implementing web services, Geb for automating tests of the user interface, and Spock for automated tests in general. We will tell you where these technologies provided great benefits, and where they were the source of trouble and frustration. This lecture does not presuppose deep knowledge about Grails and Groovy. It should be of interest to any professional software developer who is considering replacing Java with Grails and Groovy. Systematic A/S is a Danish software house headquartered in Århus. We employ about 450 people in 7 nations. We provide solutions for the defence, healthcare and public sector.

TRANSCRIPT

Page 1: Jan reher may 2013

We chose Grails and Groovyfor a real-world project.

Was it wise?

Jan Reher, Systematic

Page 2: Jan reher may 2013

2

Topics

• The system we built• Technologies that start with a G• Mistakes made, lessons learned• The presentation I would have liked to hear

two years ago

• Was it wise?

Page 3: Jan reher may 2013

3

Founded in 1985430 employees, 400 in Denmark

• Defence• Healthcare• Public Sector• Intelligence and National Security

Page 4: Jan reher may 2013

Jan Reher

Does:• Software design• Programming• Technical leadership• Requirements elicitation• Workshop facilitation• Teaching• Knowledge networking• Process improvement

Likes:• Most of what he does• C++• Functional programming• Tolkien• Gardening• Karate• Desk-top role playing games

[email protected]

MS, Computer ScienceBS, Mathematics, Physics15 years at Systematic

4

Page 5: Jan reher may 2013

5

Demo

Page 6: Jan reher may 2013

6

Property Trading Process

Account Switching Process

e-nettet.dk

Two major features

Work started August 2011First version in production May 2013

Work started August 2012First version in production 2014

Page 7: Jan reher may 2013

Backend

Business logic

Common Component

Portal Actor System

Internet Explorer

HTTPS

HTTPSHTTPSMQ

Common Component

Common Component

Business logic

Business logic

HTTPSMQ

Data base

Architecture

No security

Session level OCES (X.509)securitySession data only

Per-call OCES (X.509)security

Internet,no security

SOAP, WSDL, XSD

Java, JAXB, JPAOracle WebLogic

Oracle DB

GrailsOracle WebLogic

Internet Explorer

7

Page 8: Jan reher may 2013

8

Product framework

Page 9: Jan reher may 2013

<complextype name=”SavingsAccountRequest”>…</complextype>

class SavingsAccountRequest {// fields// constraints}

<g:render template=”…”/>…

savingsAccountRequest/_show.gsp

class SavingsAccountRequest {// fields// getters and setters}

JAXB

manually

manually

<g:render template=”…”/>…

savingsAccountRequest/_edit.gsp

SavingsAccountRequest.java

SavingsAccountRequest.xsd

Product framework, types

SavingsAccountRequest.groovy

ISOMORPHIC

ISOMORP

HICISOMORPHIC

Specification

View

Model

DTO

9

Page 10: Jan reher may 2013

Product framework, objectsSavingsAccountRequest

Edit form

SavingsAccountRequest

Java (JAXB) object

SavingsAccountRequest

Grails object

bindData()

IsomorphicMapper

Back-endWeb service operation

10

Page 11: Jan reher may 2013

11

Product Framework, labels

BetaltPALSkatForegaaende5AarFoerUudnyttetPALSkat

Betalt PAL skat foregående 5 år før uudnyttet PAL skat

Page 12: Jan reher may 2013

12

Testing

• Unit tests in Spock

• Integration tests in Spock

• Automated GUI tests in Geb and Spock

Page 13: Jan reher may 2013

Not surveying the Grails landscape

Spring WS plugin ?JSON RESTful API for GORM plugin ?Something else?

Therefore:• Look for third-party solutions• Invest in background knowledge

Backend

Business logic

Common Component

Portal Actor System

Internet Explorer

HTTPS

HTTPSHTTPSMQ

Common Component

Common Component

Business logic

Business logic

HTTPSMQ

Data base

Mistake!

13

Page 14: Jan reher may 2013

14

Believing that Groovy is just Java

Programmer quote:The biggest mistake was to think that you can just ”write Java in Groovy”. You end up getting the worst of both.

Lesson: Invest in learning Groovy.

Mistake!

Page 15: Jan reher may 2013

15

Not investing in education

Programmer quote:

The biggest mistake was lack of initial education, understanding and preparation for developing Grails applications.This can be due to a downside of another tool we are using: Scrum. The fact we had to deliver functionality a very short time after project start didn't leave time for proper education and understanding of the framework. We still have to live with code written at that time.

Lesson:• Invest in learning Grails.• Grow experts

Mistake!

Quote from grails.org:Build modern, sophisticated and robustGroovy web applications in record time!

Page 16: Jan reher may 2013

Letting the consultant work aloneMist

ake!

Programmer quote:The biggest mistake was to let a consultant do all the difficult stuff alone, instead of acting as a consultant, and helping us do the the difficult stuff.

Lesson: Get an expert. Have him teach and coach. Do not let him work alone.

16

Page 17: Jan reher may 2013

17

Using Groovy on the back-end

• Groovy/Java interaction works fine

• Slow compilation• Long turn-around• Ungroovy code

Mistake!

Page 18: Jan reher may 2013

18

The biggest mistake

Not surveying the Grails landscapeBelieving that Groovy is just JavaNot investing in educationLetting the consultant work aloneUsing Groovy on the back-end

Mistake!

Letting the consultant work alone

Page 19: Jan reher may 2013

page (#)

Happy notes

GrailsGroovySpockGebOnline resources and communityBooksProject enthusiasmProject benefits

Hooray!

Page 20: Jan reher may 2013

20

We chose Grails and Groovyfor a real-world project.

Was it wise?

Page 21: Jan reher may 2013