lessons learned teaching a groovy grails course

35
LESSONS LEARNED TEACHING A GROOVY/GRAILS COURSE Jacob Aae Mikkelsen

Upload: jacobaae

Post on 10-Aug-2015

26 views

Category:

Software


2 download

TRANSCRIPT

LESSONS LEARNED TEACHING AGROOVY/GRAILS COURSE

Jacob Aae Mikkelsen

AGENDACourse description

The Students

Example questions

Results

Reflections

JACOB AAE MIKKELSENSenior Engineer at Lego

Microservice based architechture on JVM

Previously 4 years at Gennemtænkt IT

Consultant on Groovy and Grails

External Associate Professor - University of SouthernDenmark

@JacobAae

Blogs The Grails Diary

DM844 - WEB DEVELOPMENT WITHGROOVY AND GRAILS

THE PRACTICAL INFOUniversity level (3rd & 4th year)

Full-stack Course

42 Students

2 * 2 hours teaching each week

GOALTo bridge the gap between the theoretical academicworld and the outside practical world

Practical project

4 parts

14 groups of 3 student

Same proposal → 14 very different results

TECHNOLOGIES

EVALUATIONGroup project

Written report

Oral exam

FORMAL EVALUATION GOALS (1)Design an application in an MVC web framework,including the separation of logic and presentation

Apply and demonstrate the use of tools for static codeanalysis

Apply and demonstrate the use of tools for test coverage

Evaluate and comment on code quality, for example. bycode review

Use version control and semantic versioning with a groupof other developers

FORMAL EVALUATION GOALS (2)Analyze and test the security in web applications

Configure a cloud based hosting server for awebapplikation with database access

Use continous integration and automate the proces oftesting and deploying

Implement the designed webapplication, with support formultiple languages, responsive design and asynchronousupdates (one-page-app)

THE STUDENTS

CHARACTERISTICS75% Computer Science

25% Software Engineering

CHARACTERISTICSGreat with algorithms, complexity etc

Not used to focus on code quality and testing

Not used to configuring servers

Never used CI

SNIPPETSString toString() {    return this.firstName+" "+this.lastName}

SNIPPETSclass SalaryServiceSpec extends Specification {

    def setup() {    }

    def cleanup() {    }

    void "test something"() {    }}

SNIPPETSdef createNewProject(params) {    def projectOwner = ProjectOwner.get(params.projectOwnerID)    def project = new Project(title:params.projectTitle,        shortDescription: params.projectShortDesc,        description: params.projectDesc, projectOwner:projectOwner    )    project.save(failOnError: true)    projectOwner.addToProjects(project)}

SNIPPETSdef findProjectRequest() {    ProductRequest theProject = ProductRequest.findById(theId)

    return theProject}

SNIPPETS} else if(areaIn.bookings.getClass() == org.codehaus.groovy.runtime.NullObject){

SNIPPETS@Build(Area)class AreaUnitSpec extends Specification{    void "Show build method"(){        setup:        Area.build(name: 'Pitch One')

        when:        Area area = Area.findByName('Pitch One')

        then:        area        area.name == 'Pitch One'    }

}

EXAMPLE QUESTIONSLets look at a few of the questions I received during the

course

PERFORMANCE ISSUEBrowser hangs on create on some of the classeswhen using scaffolded views

PERFORMANCE ISSUEclass Patient {    Integer patId    String name    String phone    String email

    static constraints = {      name size: 2..255      email email: true      patId range: 1..100000, unique: true      phone size: 8..12, matches: "[0­9]+"    }}

USING DATECREATEDWe would like to use dateCreated in validation, assome of the dates cannot be set in the past (atcreation time)

Not set before it is saved - cannot use new Date()on edit

DATA MODELLING WITH EMBEDDEDCLASSES

For a delivery company, we have a delivery havingtwo embedded delivery points each having anembedded address. Gorm cannot handle this(naming clash)

GEB TESTINGThe Geb test fails because the bottom bar is on top ofthe button

when: "we click next"JavascriptExecutor executor = (JavascriptExecutor) driverexecutor.executeScript("window.scrollBy(0,500)")$("input", name: "Next").click()

RESULTS

PROJECT OUTCOMESome of the results

https://crashh.me/dm844/

https://www.temporaria.me/

https://www.fmind.me

https://ss-software.dk/

https://www.pconnector.me/

https://clubadmin.dk

REFLECTIONS

FEEDBACKLearned new stuff

Lots of waiting while compiling and running tests

Real work-life experience

UP’SDynamic scaffolding - and speed to get started

Great Project results

Engaging students (most of them)

Helpfull in Facebook Group

Wow-factors

GORM

AST transformations

Spock - where clause for testing

DOWN’SHuge workload

Hard to compare different projects

RECOMMENDATIONSNext iteration

Point to Github student pack

Use Grails 3

Fixating the project description

THANKSJetbrains for IntelliJ educational license for all students

Digital Ocean For vouchers for servers

QUESTIONS?