Jan reher may 2013

Preview:

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.

Citation preview

We chose Grails and Groovyfor a real-world project.

Was it wise?

Jan Reher, Systematic

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?

3

Founded in 1985430 employees, 400 in Denmark

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

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

jan.reher@systematic.com

MS, Computer ScienceBS, Mathematics, Physics15 years at Systematic

4

5

Demo

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

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

8

Product framework

<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

Product framework, objectsSavingsAccountRequest

Edit form

SavingsAccountRequest

Java (JAXB) object

SavingsAccountRequest

Grails object

bindData()

IsomorphicMapper

Back-endWeb service operation

10

11

Product Framework, labels

BetaltPALSkatForegaaende5AarFoerUudnyttetPALSkat

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

12

Testing

• Unit tests in Spock

• Integration tests in Spock

• Automated GUI tests in Geb and Spock

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

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!

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!

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

17

Using Groovy on the back-end

• Groovy/Java interaction works fine

• Slow compilation• Long turn-around• Ungroovy code

Mistake!

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 (#)

Happy notes

GrailsGroovySpockGebOnline resources and communityBooksProject enthusiasmProject benefits

Hooray!

20

We chose Grails and Groovyfor a real-world project.

Was it wise?