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
500
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
Integrating Python and Java easily using (Micronaut) GraalPy
melix
0
38
JSol'Ex : traitement d'images solaires en Java
melix
0
210
JSol'Ex : solar image processing in Java
melix
0
630
Ecrire un microservice Java natif avec Micronaut et GraalVM
melix
1
200
Micronaut Test Resources
melix
1
270
Micronaut Test Resources
melix
1
440
AlpesJUG: Micronaut Test Resources
melix
0
110
Micronaut_Test_Resources.pdf
melix
0
210
Consommation électrique du foyer
melix
0
280
Other Decks in Programming
See All in Programming
概念モデル→論理モデルで気をつけていること
sunnyone
2
170
Compose Multiplatform × AI で作る、次世代アプリ開発支援ツールの設計と実装
thagikura
0
150
テストコードはもう書かない:JetBrains AI Assistantに委ねる非同期処理のテスト自動設計・生成
makun
0
300
そのAPI、誰のため? Androidライブラリ設計における利用者目線の実践テクニック
mkeeda
2
300
もうちょっといいRubyプロファイラを作りたい (2025)
osyoyu
1
430
今だからこそ入門する Server-Sent Events (SSE)
nearme_tech
PRO
3
210
さようなら Date。 ようこそTemporal! 3年間先行利用して得られた知見の共有
8beeeaaat
3
1.4k
FindyにおけるTakumi活用と脆弱性管理のこれから
rvirus0817
0
510
Design Foundational Data Engineering Observability
sucitw
3
200
HTMLの品質ってなんだっけ? “HTMLクライテリア”の設計と実践
unachang113
4
2.8k
アルテニア コンサル/ITエンジニア向け 採用ピッチ資料
altenir
0
100
時間軸から考えるTerraformを使う理由と留意点
fufuhu
16
4.8k
Featured
See All Featured
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Producing Creativity
orderedlist
PRO
347
40k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.9k
Code Review Best Practice
trishagee
70
19k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
Designing for humans not robots
tammielis
253
25k
Mobile First: as difficult as doing things right
swwweet
224
9.9k
Raft: Consensus for Rubyists
vanstee
140
7.1k
Automating Front-end Workflow
addyosmani
1370
200k
Thoughts on Productivity
jonyablonski
70
4.8k
[RailsConf 2023] Rails as a piece of cake
palkan
57
5.8k
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