(greach 2015) decathlon sport meeting
TRANSCRIPT
![Page 1: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/1.jpg)
Decathlon Sport Meeting
Alonso Torres, DEVELOPER
Sports, a new Grails discipline
Antonio de la Torre, DEVELOPER
Kaleidos
![Page 2: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/2.jpg)
Introduction
![Page 3: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/3.jpg)
What’s Decathlon Sport Meeting?
Intro
![Page 4: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/4.jpg)
Intro
Why want Decathlon to develop a Social Network?
● Decathlon’s mission is to make sports widely available
● Sport Meeting was created to take this one step further
![Page 5: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/5.jpg)
Intro
Who developed it?
Kaleidos
![Page 6: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/6.jpg)
What did it contributed to the community?
● 3 Pull Request to GrailsGRAILS-11647, GRAILS-11323, GRAILS-10763
● 6 open sourced plugins
Intro
![Page 7: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/7.jpg)
Intro
How is DSM?
100k registered users
1000 active sport proposals
35 sports
![Page 8: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/8.jpg)
Development Decisions
«The risk of a wrong decision is preferable to the terror of indecision.»
Maimónides (12th c.)
![Page 9: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/9.jpg)
Development decisions
Divided in
three applications● WEB, JOBS, API
and a plugin with business
logic and common code● CORE
JOBS
WEB API
CORE
![Page 10: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/10.jpg)
Development decisions
Command Objects
● Responsibility● Validate objects
○ accessing model to validate data
![Page 11: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/11.jpg)
Development decisions
Command ObjectsCheck if is a type
and a valid domain object
![Page 12: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/12.jpg)
Development decisions
Tests
● Start with Integration tests << due to odd behaviour
● and moving to Unit tests << less dependency
![Page 13: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/13.jpg)
Development decisions
Asynchronous processes and background jobs
● Asynchronous processes (platform-core)
○ Immediate email sending
○ Push notifications to mobile devices
![Page 14: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/14.jpg)
Development decisions
Asynchronous processes and background jobs
● Background jobs (quartz)
○ Quartz scheduler library
○ Tasks that are processed overnight■ Proposals clean up■ Mailing with interesting stuff (users, proposals)
![Page 15: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/15.jpg)
API Decisions
![Page 16: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/16.jpg)
API decisions
Trait with helpers to create responses: 4XX
![Page 17: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/17.jpg)
API decisions
Command Objects accepts input JSON < Magic happens
![Page 18: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/18.jpg)
API decisions
Command Objects accepts input JSON < Magic happens
![Page 19: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/19.jpg)
API decisions
Command Objects accepts input JSON < Magic happens
Binding Lists
![Page 20: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/20.jpg)
API decisions
Data Oriented Design (RESTful)
over
Screen Oriented Design
![Page 21: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/21.jpg)
Infrastructure decisions
![Page 22: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/22.jpg)
Infrastructure decisions
PostgreSQL as our main database
● Open-Source and very mature
● Highly scalability
● Widely used
![Page 23: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/23.jpg)
Infrastructure decisions
MongoDB as a secondary storage for denormalized data
● Optimize read and searches by storing documents
● Filter, sorting, querying
● Highly availability
![Page 24: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/24.jpg)
Infrastructure decisions
MongoDB to store statistics and usage data
● Fire and forget model
● Map-reduce to extract the information
![Page 25: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/25.jpg)
Infrastructure decisions
MongoDB for geolocalized data
● Great support of geolocalization
● Aggregation pipeline
![Page 26: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/26.jpg)
Infrastructure decisions
Terracotta as a Hibernate second-level cache and HTTP sessions
● Dual licensing (community and commercial)
● Problems scaling (on the community product)
● Decided to change to Redis
![Page 27: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/27.jpg)
Infrastructure decisions
Releases upload to a Nexus repository
● Upload all the software revisions
● “release plugin” can manage this
● Could be easily automated for a continuous
delivery
![Page 28: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/28.jpg)
Awesome Tools
«If I have seen further it is only by standing on the shoulders of giants.»
Isaac Newton
![Page 29: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/29.jpg)
Awesome tools
Java Melody Plugin
● Allows monitoring of requests and JVM state
● Saved us in several occasions
![Page 30: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/30.jpg)
![Page 31: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/31.jpg)
Awesome tools
Build Test Data Plugin
● Creates complex objects from your constraints
![Page 32: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/32.jpg)
Awesome tools
Build Test Data Plugin
● Creates complex objects from your constraints
![Page 33: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/33.jpg)
Awesome tools
Build Test Data Plugin
● Creates complex objects from your constraints
Check constraints and relationships and creates the necessary objects
![Page 34: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/34.jpg)
PostgresSQL Extensions plugin
Awesome tools
● Disclaimer: created by @ilopmar & @alotor inside
Kaleidos
● Provides native access to PSQL native types:
HSTORE, Arrays, JSON...
![Page 35: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/35.jpg)
PostgresSQL Extensions plugin
Awesome tools
![Page 36: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/36.jpg)
Awesome tools
Platform Core plugin
● Asynchronous task is a bliss
● Maintained by the Grails-core team
![Page 37: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/37.jpg)
Awesome tools
Platform Core plugin
![Page 38: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/38.jpg)
Know your tools
![Page 39: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/39.jpg)
Awesome tools
GPars
● Easy parallelization inside the Groovy core
● Provides DSL’s and an easy API to parallelize
expensive tasks
● Sometimes difficult to work with GORM
![Page 40: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/40.jpg)
Awesome tools
GPars
![Page 41: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/41.jpg)
Awesome tools
GPars
Five threads at the same time
![Page 42: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/42.jpg)
Awesome tools
GPars
we need a transaction within the new thread
![Page 43: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/43.jpg)
Awesome tools
Groovy Metaprogramming
● Sometimes the magic is fun :)
● We developed a system with metaprogramming to
easily create new types of notification
![Page 44: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/44.jpg)
Awesome tools
![Page 45: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/45.jpg)
Awesome tools
Grails & Spring
● Problem: we wanted different implementations in
development and “real” environments
● Examples: notifications, file storage...
![Page 46: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/46.jpg)
Awesome tools
![Page 47: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/47.jpg)
Awesome tools
Inject a generic “fileService”
![Page 48: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/48.jpg)
Awesome tools
Alias the necessary bean per environment
![Page 49: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/49.jpg)
Difficult Challenges
![Page 50: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/50.jpg)
Difficult Challenges
Migration Grails 2.1.5 → 2.4.4
![Page 51: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/51.jpg)
Difficult Challenges
Migration Grails 2.1.5 → 2.4.4
● Upgrade Grails and it’s dependencies
● Package changes, API changes…
● DataBinding and Command objects changes
![Page 52: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/52.jpg)
Difficult Challenges
URL’s internationalization
● Grails doesn’t support out-of-the-box multi-language URL’s
![Page 53: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/53.jpg)
Difficult Challenges
Tests pollution
● With 1500+ tests if you’re polluting one of your
tests is a big issue
● If this happens to you check:
by @tednaleidhttp://bit.ly/1FlJs75
![Page 54: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/54.jpg)
Difficult Challenges
API Documentation
● There is no easy way to keep an up-to-date API
documentation with Grails REST support
● Our solution: the documentation as GSP’s allow us to
reuse certain common part’s (like messages structure)
![Page 55: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/55.jpg)
Difficult Challenges
MongoDB Plugin
● Mongodb’s GORM plugin had unexpected
behaviour
● We finally decided to use the low-level API when
accessing MongoDB
![Page 56: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/56.jpg)
Going Forward
![Page 57: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/57.jpg)
Going forward...
● Currently the application is only available for
spanish users
● Decathlon is present in 27 countries
Travel abroad!
![Page 58: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/58.jpg)
Going forward...
● Decathlon Sport Meeting will be opening their API
● We hope to create an application ecosystem
around the social network
Opening the API
![Page 59: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/59.jpg)
Going forward...
● First application using DSM API
● Was done during the ΠWEEK
Sport Spot
![Page 60: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/60.jpg)
Going forward...
![Page 61: (Greach 2015) Decathlon Sport Meeting](https://reader030.vdocuments.mx/reader030/viewer/2022020116/55a790311a28ab35478b4660/html5/thumbnails/61.jpg)
See you on track!