SlideShare ist ein Scribd-Unternehmen logo
1 von 26
Downloaden Sie, um offline zu lesen
Introduction to 
Łukasz Tenerowicz 
lukasz.tenerowicz@gmail.com 
lukasz.tenerowicz@itsilesia.com
Disadvantages of web apps in Java ? 
● Hard configuration (e.g. XML soup ) 
● Large amounts of boilerplate code ( vs. 
scripting languages like PHP, Python) 
itsilesia.com e: info@itsilesia.com
Grails = No disadvantages of Java 
● Convention over configuration - like in 
RoR 
● Groovy as a primary language 
○ Short syntax 
○ Easy! 
○ Functional elements 
● Configuration also in Groovy 
itsilesia.com e: info@itsilesia.com
… + its advantages 
● Lots of libraries 
○ Spring ( DI, Transactions, Spring Security ) 
○ Hibernate 
○ Quartz 
○ Lots of APIs ( e.g. Amazon Web Services Java 
SDK) 
● Deployment via .war file 
● ~20 years of JVM development 
itsilesia.com e: info@itsilesia.com
About Grails 
● version 1.0 in 2008 
● Looks similar to Ruby on Rails 
○ MVC 
○ convention over configuration 
○ console 
● Based on Spring MVC, Hibernate 
● Used in LinkedIn, Netflix, Sky TV, 
Vodafone 
itsilesia.com e: info@itsilesia.com
Folder structure source : https://grails.org/Quick+Start 
itsilesia.com e: info@itsilesia.com
Our first task will be ...
Hello World! 
What else ? :D
Controller 
itsilesia.com e: info@itsilesia.com 
● Class name and 
method name maps to 
an URL 
○ /hello/index 
○ /hello/show
Controller - parameters 
● URL parameters are mapped to method 
arguments 
itsilesia.com e: info@itsilesia.com 
● Also accessible 
from params map
Hello world! 
● render(“Hello world”) 
● render(“Hello “ + user) 
● Views! ${user} 
● render(view: ‘index’, model: [user: ‘user’]) 
● return [user: ‘user’] 
● redirect(action: ‘index’) 
● GSP -> g:if, g:each 
itsilesia.com e: info@itsilesia.com
But that’s all static HTML... 
Give me the DB!
Domain classes 
What our application is all about
Domain classes 
● Mapped to database via GORM 
○ Class is table, property is column 
● Constraints 
○ nullable, unique, blank, size, ... 
● Relations 
○ hasMany, belongsTo 
● Properties 
itsilesia.com e: info@itsilesia.com
Domain classes - constraints 
itsilesia.com e: info@itsilesia.com
Domain classes - relationships 
itsilesia.com e: info@itsilesia.com
Domain classes - properties 
itsilesia.com e: info@itsilesia.com
Domain class: finders and other functions 
● Person.findByName(‘asdf’) 
○ Person.findByNameAndAge(‘asdf’, 16) 
○ Person.findAllBy...And… 
● Person.save() 
○ Person.discard() 
○ Person.refresh() 
itsilesia.com e: info@itsilesia.com
Data binding 
Powerful!!!
Databinding of a domain class 
itsilesia.com e: info@itsilesia.com
Validation 
● Domains and all classes with 
@Validateable 
● Occurs on obj.validate() or during 
databinding 
● If any constraints are violated, error 
codes are added to obj.errors map 
● Those errors can be rendered via i18n 
codes 
itsilesia.com e: info@itsilesia.com
Internationalisation - i18n 
● Based on codes found in /grails-app/ 
i18n/messages.properties 
● Tags : <g:message code=”com.some.code” /> 
● So yes, we can render errors too! 
○ <g:message error=”${object.errors}” /> 
itsilesia.com e: info@itsilesia.com
Dependency 
Injection 
Easier than ever!
Other features 
Maybe next workshops :P
Other features 
● REST controllers - http://grails. 
org/doc/latest/guide/webServices.html 
● Spring Security - http://grails.org/plugin/spring-security-core 
● Database migrations - http://grails.org/plugin/database-migration 
itsilesia.com e: info@itsilesia.com
Thank you! 
Questions ?

Weitere ähnliche Inhalte

Was ist angesagt?

HKG18-120 - Devicetree Schema Documentation and Validation
HKG18-120 - Devicetree Schema Documentation and Validation HKG18-120 - Devicetree Schema Documentation and Validation
HKG18-120 - Devicetree Schema Documentation and Validation Linaro
 
WSDM Cup 2017: Vandalism Detection
WSDM Cup 2017: Vandalism DetectionWSDM Cup 2017: Vandalism Detection
WSDM Cup 2017: Vandalism DetectionAlexey Grigorev
 
CIKM Cup 2016: Cross-Device Linking
CIKM Cup 2016: Cross-Device LinkingCIKM Cup 2016: Cross-Device Linking
CIKM Cup 2016: Cross-Device LinkingAlexey Grigorev
 
Large Scale Vandalism Detection in Knowledge Bases: PyData Berlin 2017
Large Scale Vandalism Detection in Knowledge Bases: PyData Berlin 2017Large Scale Vandalism Detection in Knowledge Bases: PyData Berlin 2017
Large Scale Vandalism Detection in Knowledge Bases: PyData Berlin 2017Alexey Grigorev
 
Kickstarting Your Mongo Education with MongoDB University
Kickstarting Your Mongo Education with MongoDB UniversityKickstarting Your Mongo Education with MongoDB University
Kickstarting Your Mongo Education with MongoDB UniversityJuan Carlos Farah
 
Marco Cecconi, Software Developer @ Stack Exchange - The architecture of Stac...
Marco Cecconi, Software Developer @ Stack Exchange - The architecture of Stac...Marco Cecconi, Software Developer @ Stack Exchange - The architecture of Stac...
Marco Cecconi, Software Developer @ Stack Exchange - The architecture of Stac...How to Web
 
Avito Duplicate Ads Detection @ kaggle
Avito Duplicate Ads Detection @ kaggleAvito Duplicate Ads Detection @ kaggle
Avito Duplicate Ads Detection @ kaggleAlexey Grigorev
 
Big Data Day LA 2015 - How to model anything in Redis by Josiah Carlson of Ze...
Big Data Day LA 2015 - How to model anything in Redis by Josiah Carlson of Ze...Big Data Day LA 2015 - How to model anything in Redis by Josiah Carlson of Ze...
Big Data Day LA 2015 - How to model anything in Redis by Josiah Carlson of Ze...Data Con LA
 

Was ist angesagt? (12)

HKG18-120 - Devicetree Schema Documentation and Validation
HKG18-120 - Devicetree Schema Documentation and Validation HKG18-120 - Devicetree Schema Documentation and Validation
HKG18-120 - Devicetree Schema Documentation and Validation
 
WSDM Cup 2017: Vandalism Detection
WSDM Cup 2017: Vandalism DetectionWSDM Cup 2017: Vandalism Detection
WSDM Cup 2017: Vandalism Detection
 
CIKM Cup 2016: Cross-Device Linking
CIKM Cup 2016: Cross-Device LinkingCIKM Cup 2016: Cross-Device Linking
CIKM Cup 2016: Cross-Device Linking
 
Redis 맛보기
Redis 맛보기Redis 맛보기
Redis 맛보기
 
The Appy Hour
The Appy HourThe Appy Hour
The Appy Hour
 
Hadoop @ eBuddy
Hadoop @ eBuddyHadoop @ eBuddy
Hadoop @ eBuddy
 
Large Scale Vandalism Detection in Knowledge Bases: PyData Berlin 2017
Large Scale Vandalism Detection in Knowledge Bases: PyData Berlin 2017Large Scale Vandalism Detection in Knowledge Bases: PyData Berlin 2017
Large Scale Vandalism Detection in Knowledge Bases: PyData Berlin 2017
 
Kickstarting Your Mongo Education with MongoDB University
Kickstarting Your Mongo Education with MongoDB UniversityKickstarting Your Mongo Education with MongoDB University
Kickstarting Your Mongo Education with MongoDB University
 
Marco Cecconi, Software Developer @ Stack Exchange - The architecture of Stac...
Marco Cecconi, Software Developer @ Stack Exchange - The architecture of Stac...Marco Cecconi, Software Developer @ Stack Exchange - The architecture of Stac...
Marco Cecconi, Software Developer @ Stack Exchange - The architecture of Stac...
 
Neo4j: Graph-like power
Neo4j: Graph-like powerNeo4j: Graph-like power
Neo4j: Graph-like power
 
Avito Duplicate Ads Detection @ kaggle
Avito Duplicate Ads Detection @ kaggleAvito Duplicate Ads Detection @ kaggle
Avito Duplicate Ads Detection @ kaggle
 
Big Data Day LA 2015 - How to model anything in Redis by Josiah Carlson of Ze...
Big Data Day LA 2015 - How to model anything in Redis by Josiah Carlson of Ze...Big Data Day LA 2015 - How to model anything in Redis by Josiah Carlson of Ze...
Big Data Day LA 2015 - How to model anything in Redis by Josiah Carlson of Ze...
 

Ähnlich wie Grails workshops

Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015Jorg Janke
 
Ln monitoring repositories
Ln monitoring repositoriesLn monitoring repositories
Ln monitoring repositoriessnyff
 
Labeling all the Things with the WDI Skill Labeler
Labeling all the Things with the WDI Skill Labeler Labeling all the Things with the WDI Skill Labeler
Labeling all the Things with the WDI Skill Labeler Kwame Porter Robinson
 
Front-End Developer's Career Roadmap
Front-End Developer's Career RoadmapFront-End Developer's Career Roadmap
Front-End Developer's Career RoadmapWebStackAcademy
 
JavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkJavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkAlive Kuo
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScriptJorg Janke
 
PGConf APAC 2018 - High performance json postgre-sql vs. mongodb
PGConf APAC 2018 - High performance json  postgre-sql vs. mongodbPGConf APAC 2018 - High performance json  postgre-sql vs. mongodb
PGConf APAC 2018 - High performance json postgre-sql vs. mongodbPGConf APAC
 
Life in CSE.pptx
Life in CSE.pptxLife in CSE.pptx
Life in CSE.pptxVedVekhande
 
Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
 Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ... Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...Andy Maleh
 
HTML5 New Features and Resources
HTML5 New Features and ResourcesHTML5 New Features and Resources
HTML5 New Features and ResourcesRon Reiter
 
Ballerina Tutorial @ SummerSOC 2019
Ballerina Tutorial @ SummerSOC 2019Ballerina Tutorial @ SummerSOC 2019
Ballerina Tutorial @ SummerSOC 2019kshanth2101
 
Andriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsAndriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsOWASP Kyiv
 
Python for PHP developers
Python for PHP developersPython for PHP developers
Python for PHP developersbennuttall
 
Ledingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartLedingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartMukesh Singh
 
JRuby: Pushing the Java Platform Further
JRuby: Pushing the Java Platform FurtherJRuby: Pushing the Java Platform Further
JRuby: Pushing the Java Platform FurtherCharles Nutter
 
Parallel programing in web applications - public.pptx
Parallel programing in web applications - public.pptxParallel programing in web applications - public.pptx
Parallel programing in web applications - public.pptxGuy Bary
 
BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2 BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2 Linaro
 
Big Data in 200 km/h | AWS Big Data Demystified #1.3
Big Data in 200 km/h | AWS Big Data Demystified #1.3  Big Data in 200 km/h | AWS Big Data Demystified #1.3
Big Data in 200 km/h | AWS Big Data Demystified #1.3 Omid Vahdaty
 

Ähnlich wie Grails workshops (20)

Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015
 
Ln monitoring repositories
Ln monitoring repositoriesLn monitoring repositories
Ln monitoring repositories
 
Labeling all the Things with the WDI Skill Labeler
Labeling all the Things with the WDI Skill Labeler Labeling all the Things with the WDI Skill Labeler
Labeling all the Things with the WDI Skill Labeler
 
Front-End Developer's Career Roadmap
Front-End Developer's Career RoadmapFront-End Developer's Career Roadmap
Front-End Developer's Career Roadmap
 
JavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkJavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web framework
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
 
PGConf APAC 2018 - High performance json postgre-sql vs. mongodb
PGConf APAC 2018 - High performance json  postgre-sql vs. mongodbPGConf APAC 2018 - High performance json  postgre-sql vs. mongodb
PGConf APAC 2018 - High performance json postgre-sql vs. mongodb
 
Life in CSE.pptx
Life in CSE.pptxLife in CSE.pptx
Life in CSE.pptx
 
Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
 Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ... Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
 
TinkerPop 2020
TinkerPop 2020TinkerPop 2020
TinkerPop 2020
 
HTML5 New Features and Resources
HTML5 New Features and ResourcesHTML5 New Features and Resources
HTML5 New Features and Resources
 
Ballerina Tutorial @ SummerSOC 2019
Ballerina Tutorial @ SummerSOC 2019Ballerina Tutorial @ SummerSOC 2019
Ballerina Tutorial @ SummerSOC 2019
 
Andriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsAndriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tips
 
Python for PHP developers
Python for PHP developersPython for PHP developers
Python for PHP developers
 
Ledingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartLedingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @Lendingkart
 
JRuby: Pushing the Java Platform Further
JRuby: Pushing the Java Platform FurtherJRuby: Pushing the Java Platform Further
JRuby: Pushing the Java Platform Further
 
Parallel programing in web applications - public.pptx
Parallel programing in web applications - public.pptxParallel programing in web applications - public.pptx
Parallel programing in web applications - public.pptx
 
BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2 BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2
 
Big Data in 200 km/h | AWS Big Data Demystified #1.3
Big Data in 200 km/h | AWS Big Data Demystified #1.3  Big Data in 200 km/h | AWS Big Data Demystified #1.3
Big Data in 200 km/h | AWS Big Data Demystified #1.3
 
Learn TypeScript from scratch
Learn TypeScript from scratchLearn TypeScript from scratch
Learn TypeScript from scratch
 

Kürzlich hochgeladen

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 

Kürzlich hochgeladen (20)

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 

Grails workshops

  • 1. Introduction to Łukasz Tenerowicz lukasz.tenerowicz@gmail.com lukasz.tenerowicz@itsilesia.com
  • 2. Disadvantages of web apps in Java ? ● Hard configuration (e.g. XML soup ) ● Large amounts of boilerplate code ( vs. scripting languages like PHP, Python) itsilesia.com e: info@itsilesia.com
  • 3. Grails = No disadvantages of Java ● Convention over configuration - like in RoR ● Groovy as a primary language ○ Short syntax ○ Easy! ○ Functional elements ● Configuration also in Groovy itsilesia.com e: info@itsilesia.com
  • 4. … + its advantages ● Lots of libraries ○ Spring ( DI, Transactions, Spring Security ) ○ Hibernate ○ Quartz ○ Lots of APIs ( e.g. Amazon Web Services Java SDK) ● Deployment via .war file ● ~20 years of JVM development itsilesia.com e: info@itsilesia.com
  • 5. About Grails ● version 1.0 in 2008 ● Looks similar to Ruby on Rails ○ MVC ○ convention over configuration ○ console ● Based on Spring MVC, Hibernate ● Used in LinkedIn, Netflix, Sky TV, Vodafone itsilesia.com e: info@itsilesia.com
  • 6. Folder structure source : https://grails.org/Quick+Start itsilesia.com e: info@itsilesia.com
  • 7. Our first task will be ...
  • 8. Hello World! What else ? :D
  • 9. Controller itsilesia.com e: info@itsilesia.com ● Class name and method name maps to an URL ○ /hello/index ○ /hello/show
  • 10. Controller - parameters ● URL parameters are mapped to method arguments itsilesia.com e: info@itsilesia.com ● Also accessible from params map
  • 11. Hello world! ● render(“Hello world”) ● render(“Hello “ + user) ● Views! ${user} ● render(view: ‘index’, model: [user: ‘user’]) ● return [user: ‘user’] ● redirect(action: ‘index’) ● GSP -> g:if, g:each itsilesia.com e: info@itsilesia.com
  • 12. But that’s all static HTML... Give me the DB!
  • 13. Domain classes What our application is all about
  • 14. Domain classes ● Mapped to database via GORM ○ Class is table, property is column ● Constraints ○ nullable, unique, blank, size, ... ● Relations ○ hasMany, belongsTo ● Properties itsilesia.com e: info@itsilesia.com
  • 15. Domain classes - constraints itsilesia.com e: info@itsilesia.com
  • 16. Domain classes - relationships itsilesia.com e: info@itsilesia.com
  • 17. Domain classes - properties itsilesia.com e: info@itsilesia.com
  • 18. Domain class: finders and other functions ● Person.findByName(‘asdf’) ○ Person.findByNameAndAge(‘asdf’, 16) ○ Person.findAllBy...And… ● Person.save() ○ Person.discard() ○ Person.refresh() itsilesia.com e: info@itsilesia.com
  • 20. Databinding of a domain class itsilesia.com e: info@itsilesia.com
  • 21. Validation ● Domains and all classes with @Validateable ● Occurs on obj.validate() or during databinding ● If any constraints are violated, error codes are added to obj.errors map ● Those errors can be rendered via i18n codes itsilesia.com e: info@itsilesia.com
  • 22. Internationalisation - i18n ● Based on codes found in /grails-app/ i18n/messages.properties ● Tags : <g:message code=”com.some.code” /> ● So yes, we can render errors too! ○ <g:message error=”${object.errors}” /> itsilesia.com e: info@itsilesia.com
  • 24. Other features Maybe next workshops :P
  • 25. Other features ● REST controllers - http://grails. org/doc/latest/guide/webServices.html ● Spring Security - http://grails.org/plugin/spring-security-core ● Database migrations - http://grails.org/plugin/database-migration itsilesia.com e: info@itsilesia.com