New developers and teams are now polyglot :
- they use multiple programming languages (Java, Javascript, Ruby, ...)
- they use multiple persistence store (RDBMS, NoSQL, Hadoop)
In this talk you will learn about the benefits if being polyglot: use the good language or framework for the good cause, select the good persistence for specific constraints.
This presentation will show how developer could mix the Java platform with other technologies such as NodeJS and AngularJS to build application in a more productive way. This is also the opportunity to talk about the new Command Query Responsibility Segregation (CQRS) pattern to allow developers to be more effective and deliver the proper application to the user quicker.
This presentation was delivered during Devfest Nantes 2014
2. Proud to be Polyglot!
Tugdual Grall
Technical Evangelist
tug@mongodb.com
@tgrall
3. Modern Applications
• Modern Applications Must
Manage any type of data
Scale
Be fault tolerant
Adapt to change
4. Current Architecture
• Mono-Technology
• Single “language/architecture”
• Single Database : RDBMS
!
• One size fits all approach
JSP/JSF
Services
Messaging
JTA
DAO/JPA
5. Is it good for me?
• Many files
• XML, Sources, ..
• Does Hibernate/JPA is good for all?
• Impedance mismatch
• Need to scale
• from 0 to 50millions users in 6 weeks
• How to add new features easily?
• changing code, updating data structure, ...
• and all this for yesterday!
10. Stay up!
.
.
.
Application
!
Scale out
Add more “Web” servers
RDBMS
!
Scale Up
Get bigger server
App
Server
RDBMS
11. Scaling out RDBMS
.
.
.
App
Server
.
.
.
Memcached
.
.
.
MySQL
• Run Many SQL Servers
!
• Data could be sharded
• Done by the application
code
!
• Caching Layer
12. NoSQL to Scale out!
.
.
.
Application
!
Scale out
Add more “Web” servers
NoSQL
!
Scale Out
Add more servers
App
Server
.
.
.
NoSQL
14. Polyglot Persistence
Big
Data/Analysis Document RDBMS
• Log
Capture
• Recommendations
• Predictions
• Ad
Campaign
• Products
• User
Profiles
• Game
Actions
• Sessions
• Shopping
Cart
• Financial
Data
• Reporting
15. Developer New Skills
• Understand the pros/cons of each solutions
– Programming API
– How to access the data? (API, Query Languages)
• Learn how to design data model
– De-normalizing and duplicate data is not a problem
• Integrate each solution to your application
• Note: This is something you already do !
– Operational RDBMS and Data Warehouse
16. Data Service Layer
• Wrap data call in Services
– loosely coupled
.
.
.
App
Server
17. Use Case : Personalization
WebSite
/
Application
Personalization Database
LogsLogs
Data Processing
Application
Data
18. Use Case : Mobile / API
PIM Database
• Legacy Application
• Product Information
NoSQL
• REST API
• Product Data
• Additional Metadata
20. Why multiple languages?
• Sometimes we have no choice
– HTML/CSS/JavaScript + Server Side
– Mobile Native Applications
• Java/.Net are slow movers
– Java EE 5.0 is still mainstream (2006)
• Many languages and frameworks
– Scala, Clojure, Groovy, Dart, Go, Ruby, Python,
F#, Erlang, Node.js, Rails, Play!, Grails, ...
21. Examples
• Realtime interaction with WebSockets :
– Wait for Java EE 7 to supported by your IT?
– Hack your app server and application with
Continuation ?
– Use Node.js and Socket.io ?
!
• Data Collection and Treatment?
– Find a library?
– Create your library?
– Use Java 8 and Lambdas?
– Use Scala?
22. Examples
• Simple CRUD Application
– Use the JavaEE stack with JPA and JSF?
– Use Spring ?
– Use tools like Play!, Grails, Rails, MEAN ?
23. How to chose?
• Maturity/Supportability
• Features Set
• Learning Curve
• Productivity
24. Polyglot Programming in Action
• Build a new database
– Save and retrieve data on disk
– Cache the data on RAM
– Build a query engine
– Build replication and sharding
– Build a Monitoring engine & console
– Build a Backup/Restore Solution
25. Polyglot Programming in Action
• Data access, caching, and replication
– C/C++ is the fastest way to interact with I/O
– Leverage existing Caching layer & I/O
– memory-mapped file
• Query & Indexing
– Leverage C/C++, and expose native JS engine
• Management
– Web Console : Java & HTML/CSS
– Agent : GoLang
29. Conclusion
• Use the good tool for the good task
– Do not try to “hack” something when you
have a simpler solution
– Think about your users first... so deliver and
get feedback
• Learning is part of our job !
– And this will help you and your project
• What about maintenance?
– Do you think it is easier to maintain complex
code?