Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Pourquoi vous devriez utiliser Groovy
Search
Cédric Champeau
November 25, 2014
Programming
280
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Pourquoi vous devriez utiliser Groovy
Talk donné au FinistJUG.
Cédric Champeau
November 25, 2014
More Decks by Cédric Champeau
See All by Cédric Champeau
Integrating Python and Java easily using (Micronaut) GraalPy
melix
0
94
JSol'Ex : traitement d'images solaires en Java
melix
0
280
JSol'Ex : solar image processing in Java
melix
0
900
Ecrire un microservice Java natif avec Micronaut et GraalVM
melix
1
260
Micronaut Test Resources
melix
1
320
Micronaut Test Resources
melix
1
490
AlpesJUG: Micronaut Test Resources
melix
0
170
Micronaut_Test_Resources.pdf
melix
0
270
Consommation électrique du foyer
melix
0
320
Other Decks in Programming
See All in Programming
人間の目はかわらない、だからJPEGは30年もつ
yuzneri
12
18k
Android CLI
fornewid
0
220
使いながら育てる Claude Code — 開発フローの1コマンド化 × 繰り返し指摘の自動仕組み化
shiki_kakaku
0
1.8k
2年かけて Deno に DOMMatrix を実装した話 / How I implemented DOMMatrix in Deno over two years
petamoriken
0
210
「寝てても仕事が進む」Claude Codeで組む第二の脳
tomoyafujita2016
0
330
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
290
5分で問診!Composer セキュリティ健康診断
codmoninc
0
1k
What's New in Android 2026
veronikapj
0
260
Laravel Boostに学ぶ、AIにPHPを書かせる技術 〜OSSの実装から蒸留するエージェント制御の王道〜
kentaroutakeda
3
700
【やさしく解説 設計編・中級 #6】良いアーキテクチャとは ~ 一本の登り道の、行き先 ~
panda728
PRO
0
210
in-process GraphQL のすすめ #ginzajs
izumin5210
0
260
数百円から始めるRuby電子工作
tarosay
0
160
Featured
See All Featured
KATA
mclloyd
PRO
35
15k
How GitHub (no longer) Works
holman
316
150k
Fireside Chat
paigeccino
42
4k
Typedesign – Prime Four
hannesfritz
42
3.1k
Visualization
eitanlees
152
17k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
490
What's in a price? How to price your products and services
michaelherold
247
13k
What does AI have to do with Human Rights?
axbom
PRO
1
2.3k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
Side Projects
sachag
455
43k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
240
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
280
Transcript
N'ayez pas peur de faire du @CedricChampeau
Made in Nantes
Scripting
log.message "Releasing Groovy $version with user: $user" def desc =
"Release of $version" def date = new Date().format("yyyy-MM-dd'T'HH:mm:ss.SSSZ") def remoteCall = { String url, List params, Closure onFailure -> def p = ['curl', "-m", "3600", "-u", "$user:$key", *params, url].execute() int code = p.waitFor() def resp = p.text log.message "${resp}" if (code!=0 || resp.toLowerCase().contains('error') ) { onFailure(code) System.exit(code) } }
DSLs
remoteSession { scp { from { localDir "$buildDir/application " }
into { remoteDir '/usr/local/myapp' } timeout 10.minutes } }
Java friendly
@Immutable @ToString class Person { String name int age String
greet(String them) { "Hello $them, my name is $name" } }
Dynamic
@ToString class Person { String name int age } def
storage = [new Person(name:'Cédric', age:35), new Person(name:'Hugues', age:44)] Person.metaClass.static.methodMissing = { String name, args -> if (name.startsWith('findBy')) { String prop = (name - 'findBy').toLowerCase() storage.findAll { it."$prop" == args[0]} } } println Person.findByAge(35)
Static
@ToString class Person { String name int age } @CompileStatic
void erreurDeCompil() { println Person.findByAge(35) }
Functional
new URL('http://beta.groovy-lang.org').text .split(' ') .findAll { it == 'Groovy' }
.size()
Microservices?
@Grab('com.h2database:h2:1.3.179') import grails.persistence.* @Entity @Resource(uri='books') class Book { String title
}
Builds
apply plugin: 'groovy' repositories { jcenter() } dependencies { compile
'org.codehaus.groovy:groovy:2.3.4-beta-3' }
Android
notify(NOTIFICATION_ID) { smallIcon = R.drawable.ic_action_alarms largeIcon = cachedBitmap contentTitle =
'Time left' contentText = "$timeLeft (Elapsed: ${rounded}%)" contentIntent = pendingActivityIntent(0, intent(WearPresentationActivity), FLAG_UPDATE_CURRENT) ongoing = true style = bigTextStyle { bigText """Time left for your presentation: $timeLeft Elapsed time: ${rounded}%) """ } }
Templating
layout 'layouts/main.groovy', true, pageTitle: 'The Groovy programming language - Mailing-lists',
mainContent: contents { div(id: 'content', class: 'page-1') { div(class: 'row') { div(class: 'row-fluid') { div(class: 'col-lg-3') { include template: 'includes/community-navbar.groovy' } div(class: 'col-lg-8 col-lg-pull-0') { include template: 'includes/contribute-button.groovy' h1 { i(class: 'fa fa-envelope-o') {} yield ' Mailing-lists' } ...
Et tant d'autres...
None
Merci ! @CedricChampeau