Upload
vulcanminds
View
1.204
Download
0
Embed Size (px)
Citation preview
Designing a Play Framework
Application
By VulcanMinds
What is the Play Framework BTW ?
Play Framework
Open Source Web framework written
in Java/ScalaServer-side
stateless or share-nothing
frameworkProbably created
by frustrated Java geeks tired of complex Java Web App stack
Play is also ideal as a Dev platform
with fast incremental
features list dev life-cycle
MVC stack with great Template
Engine, Persistence and Testing engines.
Cloud-aware and NoSQL friendly
Extremely convenient to
write REST- JSON based middleware
functionality.
UTF-8 is the gold standard in
Play.
Renders well for Functional, Unit Tests and well
suited with Selenium based
GUI testing.
Also integrates with CI server like Calimoucho
Has lots of out-of-the-box modules
(as side-orders for you if you need!)
Great File-upload support
Sensible Convention over miserable
configurable XMLs
Not too many specs, over-
architected mess!
Full stack -Comes with Compiler, Embedded
server,Hibernate,Logger,tTestrunner,
Email,Template engine,Scala ….that’s AHA!
So many more things!
Why Play BTW?• Think over deeply and get your own answers
Play Web Application
Design
Why use Play at all? Are you convinced?
Are you sure? Is your application a Web Application or a
Web site?
How much is static content versus dynamic
content ratio?
Do you want it fast and do you believe in TDD?
Is your Application the next killer-App or just
another moth that also crawled the room?
Are you conventional RDBMS rookie or the
new generation NOSQL explorer who wants to scale out or loose your wallet to sharky and cannibal
RDBMS product pushers?
How does your Data look like and how you are fore-seeing it to
grow? Will it morph or become fluid? Will your
App dev framework support it?
Are your customers /employees
increasingly shouting the BYOD slogan?
(Browsers are morphing to every
shape and every size and status=ubiquitous)
Does your application work in an Antarctic
cave or a portable Data center,
sharing/supporting Cloud authentication
and provisioning protocols?
Dont you want to exploit the new multi-core asynchronous
(threading) available in the intelligent chips for
performance and throughput?
Do you want to leverage the new
Actors-based horizontally scalable,
functional programming advances to make your
app delight to your developers and
responsive to your users/customers?
Are you tired of the legacy Java stack for
web app development?
Do you want one of the best designed state-of-
the-art stack for building your applications?
Play Framework App – Design considerations finally!
•Where is the features –list of your Application?
•Next…Modularize .. You should be able to otherwise I doubt your intention to do a clean job!
•Where is the use-cases list?
•What your user base will use to access this app? Desktop browsers, handhelds and smart-phones, what else?
•How many users will access ? 20-50 or 1K to 100K or 1M to 5 M? How many concurrent?
• Security – want to go standalone or federated or cloud-ish like for e.g. OAuth,…blah blah blah?
•Database NOSQL or SQL ? Take a tutorial/weekend course for getting started with NOSQL magic like MongoDB/Cassandra to make your future life easier if you haven’t done that already!
•With SQL RDBMS consider using the built-in entity framework based wrapper APIs.
•With NOSQL like MongoDB your schema is fluid like the morphing aliens in the movies. Enjoy the freedom!
•Consider building a REST –JSON based app wrapper library to access your app functionality with any device. Your application’s taste is really the REST APIs that flavor it! Design it with artistic elegance!
Play Framework App – Design considerations finally!
•Designing Models.
•Play supports Model objects that aren’t dumb! The model integrity should be maintained by the model itself.
•Designing Controllers
• Segregate controllers by the functionality for easier maintenance
•Chaining controllers is a bad idea.
•Map methods to route URLs cleanly in REST-ful way consistently!
•Designing Views
•Use templates wisely to organize the bricks of your view content.
• If using REST-ful API back-end and rich-front-end like JQuery/ Ext-JS or you-name it …use the JSON speak to have a stateless conversation with the back-end as much as possible. Use Ajax magic to exchange content wherever user refuses to drink coffee waiting for it!
•Use the inbuilt scheduler module to schedule jobs at startup or otherwise.
•Use available addon modules like GAE, PDF generator, MongoDB or secure social like oauth1 / 2 , openID blah blah if needed.