lessons learned teaching a groovy grails course
Post on 10-Aug-2015
27 Views
Preview:
TRANSCRIPT
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
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
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)
CHARACTERISTICSGreat with algorithms, complexity etc
Not used to focus on code quality and testing
Not used to configuring servers
Never used CI
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@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' }
}
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: "[09]+" }}
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()
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
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
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
REFERENCESCourse home page
Full course description
top related