Transcript
Page 1: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Can You tell me how to get to Sesame Street?

I wanna be a Grails rookie star there!

Fernando Redondo RamírezFernando Redondo Ramírez

@@pronoide_ferpronoide_fer

Page 2: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

RoadmapRoadmap

• About me

• A brief introduction…

• Hands on! • Hands on!

Page 3: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

AboutAbout MeMe• Entrepreneur and Business Manager at Pronoide

since 2003

• Java & Friends Trainer (JEE, Spring, Groovy, Maven, Jenkins, Sonar,

Weblogic, Jboss, Websphere, Disco dancing and so )

• Doing things with Java from 1999 on

• Computer Engineer

• Happily married and proud father of two children who• Happily married and proud father of two children who

love all Sesame Street stuff

Page 4: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

A A briefbrief introductionintroduction

- Just another Grails speech (jags)?

- Yes indeed!, but:

• We’ll build it all from scratch

• We’ll leverage Grails 2.3

• We’re going to do a lot of tests

• We’ll deal with the whole app• We’ll deal with the whole app

code

• We won’t use Scaffolding ;)

• No plugins are necessary

Page 5: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

A A briefbrief introductionintroduction- But, What is Grails?

- Grails isn’t only another web development framework, but it’sa full web development platform:• Embedded Servlet Container (Tomcat)

• Database Manager (H2 database)

• Scaffolding

• Dependency management through Gant• Dependency management through Gant(and Maven)

• Application packaging (war)

• Test runner (unit, integration, functional) (Junit, Spock)

• Uses Groovy language

• Extensible with plugins

• And much more!

Page 6: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

A A briefbrief introductionintroduction

- Grails App Architecture

- Grails paradigms (more buzz words)

• NIH (Not Invented Here)

• CoC (Convention over Configuration)

• DRY (Don’t Repeat Yourself)

Page 7: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

HandsHands onon ((LaterLater at home)! at home)!

Before start, you have to…

1. Install Git in your computerhttp://git-scm.com/book/en/Getting-Started-Installing-Git

2. Download Groovy/Grails Tool Suite 3.5 https://spring.io/tools/ggts/all

3. Start Groovy/Grails Tool Suite 3.5 (GGTS) and choose

or create a workspace (remember run it with a JDK)or create a workspace (remember run it with a JDK)

4. Download http://pronoide.com/downloads/javacro2014-grails2-

sesamestreet.zip and unzip it into workspace folder.

5. Pace yourself! It’s all quite straightforward…

Page 8: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage I: Create web application

i. Create webapp (create-app sesame-street)

note: it’s not necessary if you choose the Git way. (see

appendix at the end of this)

Page 9: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage II: Create domain

ii. Create the domain classes (create-domain-class

sesamestreet.Muppet)

Page 10: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage II: Create domain

iii. Define properties, constants, constraints and mappings

Page 11: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage II: Create domain

iv. Let’s complete the unit test (Spock’s way)

Page 12: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage II: Create domain

v. Run unit tests (test-app)

Page 13: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage II: Create domain

vi. Create an integration test (create-integration-test ),

and run it (test-app integration:)

Page 14: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage II: Create domain

vii. Let’s change database config and run again (test-app

integration:)

Page 15: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage III: Create business layer

viii. We have to create the service skeleton

(create-service sesamestret.MuppetDiscovery)

Page 16: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage III: Create business layer

ix. First, let’s write the unit test and run it (test-app

-unit sesamestreet.MuppetDiscoveryServiceUnitTests)

Page 17: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage III: Create business layer

x. Implement this service and its logging

Page 18: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage III: Create business layer

xi. Create an integration test and run all tests (test-app)

Page 19: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage IV: Create web layer

xii. Create our controller and its code

(create-controller sesamestreet.MuppetDiscovery)

Page 20: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage IV: Create web layer

xiii. First of all, let’s write down a unit test for the controller

Page 21: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage IV: Create web layer

xiv. Create integration test for controller too!

Page 22: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage IV: Create web layer

xv. Let’s write down the initial GSP page of searches

Page 23: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage IV: Create web layer

xvi. GSP page for the best matched muppet

Page 24: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage IV: Create web layer

xvii. GSP page for no matched muppets

Page 25: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage IV: Create web layer

xviii. Presentation fine tuning (main.gsp/main.css)

Page 26: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage V: Run Webapp

xix. Start the web application (run-app)

Page 27: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage V: Run Webapp

xx. Load initial data and map default controller

Page 28: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage V: Run Webapp

xxi. Play with the database

Page 29: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

Stage V: Run Webapp

xxii. Play with the webapp

Page 30: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

We'reWe're done!done!

I wish I had had this app 4 years ago

for entertaining the kids… But at

the present time, a new period

begins at home: Superheroes and

fairies, but that remains for my next

year JavaCro talk…year JavaCro talk…

Page 31: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

ThanksThanks!!@pronoide_fer

https://github.com/fredondo/

[email protected]

http://pronoide.com

Page 32: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

ApendixApendix: : HandsHands onon ((LaterLater at home)! at home)! Navigate along the proyect code with git presenter

1. Install jruby or rubyhttp://jruby.org/getting-startedhttps://www.ruby-lang.org/en/installation/

2. Install git presenter (gem install git_presenter)

3. When the code is ready use the "git-presenter init" command to initialize

4. Once it is initialized you can start the presentation with "git-presenter start"presenter start"

5. Then use the following commands to navigate the presentation

• next/n: move to the next slide (commit)

• back/b: move to the back slide (commit)

• end/e: move to the end of presentation

• start/s: move to the start of presentation

• list/l : list slides in presentation

• help/h: display this message

Page 33: JavaCro'14 - Can You Tell Me How to Get to Sesame Street I wanna be a Grails star there – Fernando Redondo Ramírez

ApendixApendix: : Stage I: Create web application

i. Import webapp (File/Import/Git/Proyect from Git)

note: it’s compulsory if you choose the git way


Top Related