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
Human Talks: N'ayez pas peur de faire du Groovy
Search
Cédric Champeau
November 18, 2014
Programming
4
480
Human Talks: N'ayez pas peur de faire du Groovy
Slides du lightning talk donné à HumanTalks Nantes.
Cédric Champeau
November 18, 2014
Tweet
Share
More Decks by Cédric Champeau
See All by Cédric Champeau
JSol'Ex : traitement d'images solaires en Java
melix
0
120
JSol'Ex : solar image processing in Java
melix
0
470
Ecrire un microservice Java natif avec Micronaut et GraalVM
melix
1
140
Micronaut Test Resources
melix
1
230
Micronaut Test Resources
melix
1
380
AlpesJUG: Micronaut Test Resources
melix
0
66
Micronaut_Test_Resources.pdf
melix
0
170
Consommation électrique du foyer
melix
0
240
Micronaut AOT: optimiser vos application pour le JIT et GraalVM
melix
0
200
Other Decks in Programming
See All in Programming
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
200
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
4
350
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
1
260
Jakarta EE meets AI
ivargrimstad
0
280
テストコードのガイドライン 〜作成から運用まで〜
riku929hr
5
940
Spatial Rendering for Apple Vision Pro
warrenm
0
150
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
950
各クラウドサービスにおける.NETの対応と見解
ymd65536
0
170
fs2-io を試してたらバグを見つけて直した話
chencmd
0
240
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
950
Recoilを剥がしている話
kirik
5
7.2k
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1031
460k
Reflections from 52 weeks, 52 projects
jeffersonlam
347
20k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Agile that works and the tools we love
rasmusluckow
328
21k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
32
2.7k
Gamification - CAS2011
davidbonilla
80
5.1k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
910
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Producing Creativity
orderedlist
PRO
342
39k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
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