SlideShare a Scribd company logo
1 of 16
A Play Framework Tutorial
Assist-Software Romania- Marius Carp
What is Play Framework
• An open-source modern web framework
• Based on a lightweight, stateless, web-friendly architecture.
• Built on Akka, Play provides predictable and minimal resource consumption
• Developer friendly
• Has great support for Eclipse and Intellij IDEA.
• Provides RESTful by default
• Has a built-in JSON module and extensive NoSQL & Big Data Support.
• There are libraries for everything - most of which can be used in Play.
System Requirements
• Install JDK 1.6 or later.
• Install Scala (general-purpose language designed to support clear, concise and
type-safe programming). Optional, but good to have, you may also use Java.
• Install SBT is an open source build tool for Scala and Java projects, similar to
Java's Maven or Ant.
• Install Play Framework through a tool called Typesafe Activator.
• Install PostgreSQL.
• Install pgAdmin is a comprehensive PostgreSQL database design and
management system.
Game Play Tutorial
• Let's create a new vanilla Play Scala application and name it scala-game. Here
is the command you need to run it in command-line:
• To start your game from command-line run from your project root folder:
• or (recommanded)
• To view your work go to: http://localhost:9000/
Game Configuration Tutorial
• To add more experience to your Play skills add the following dependencies to
your build.sbt file:
• Slick - a modern database query and access library for Scala.
-It allows you to work with stored data and gives you full control
• PostgreSQL JDBC is necessary to connect to PostgreSQL database
Game Configuration Tutorial
• Then, create a database and add its credentials to application.config file.
• Add a package named dao to your app folder
• Define database tables and set it in configuration
• Uncomment evolution plugin and set it enabled
• Play Framework's Evolutions will create tables and relations between them
(primary keys, indexes, sequences etc...) for you.
Game Configuration Tutorial
• We have to specify to which database to connect creating a trait
named PostgresSupport and define an implicit database
Loading Textures in Play Framework
• Create a package models and in it a case class named Player
• Play tracks your database evolutions using several
evolution scripts located in the db/evolutions directory.
• The first script is named 1.sql.
• We just need to map the models to tabels.
• PostgreSQL will generate a PrimaryKey for the player
using AutoInc:
Loading Textures in Play Framework
• A GET HTTP request will be made to this route "/„ when a user first time accesses our application .
• The entire list of routes can be found in the conf/routes file
• Each route consists of an HTTP method and URI pattern, both associated with a call to an Action generator.
• An Action is basically a request => result function that handles a request and generates a result to be sent to the client.
• A Controller is nothing more than a singleton object that generates Action values.
Play Framework Game modes
• You can chose to Play in two ways:
• Single player using Play Scala template
• Multi player using one of the following JavaScript frameworks: AngularJS, BackboneJS, EmberJS, ExtJS, DustJS .
• Adding a new player and get players list using Slick.
• players list (players is the mapped table)
• add new player
Single Player
A Play Scala template
• Is a simple text file, that contains small blocks of Scala code.
• Can generate any text-based format, such as HTML, XML or CSV.
• Allow web designers to easily work with the templates.
• Templates are compiled as standard Scala functions.
• If you create a views/Application/index.scala.html template file,
it will generate a views.html.Application.indexfunction.
Single Player
A Play Scala template
• In index.scala.html we have the player list
• Play Framework will render the page server-side.
• Adding players to the game is as simple as that: submit a form
using POST to this route /player/single
Multi Player
• You will have two separated applications in one project:
• API Backend (presistent data)
• Frontend side (making AJAX calls to the server)- in public folder.
• To test your calls use Postman.
• Make a GET call to /player/multi
• This will execute controllers.Application.findAll and it will return a list
of players in JSON format.
Multi Player
• Example:
• To add a player use POST method to this route /player/multi with the
following JSON body:
{
"name": "Newbie",
"level": 1
}
Game Features
• Amazon S3 module (Scala) - allows you to list, get, add and remove items from a S3 bucket.
• Authentication and Authorization module (Scala) - offers Authentication and Authorization features to Play2.x applications.
• Deadbolt 2 Plugin -powerful authorisation mechanism for defining access rights to certain controller methods
• Dust Plugin – provides support for the dust client side template language (DustJS).
• Memcached Plugin - provides a memcached based cache implementation.
• MongoDB Salat, Casbah Plugin (Scala) - provides managed MongoDB access and object mapping using Salat and Casbah
• Redis Plugin (Java and Scala) - provides a redis based cache implementation
• SecureSocial (Java and Scala) - an authentication module supporting OAuth, OAuth2, OpenID, Username/Password and
custom authentication schemes.
Most popular Players
• LinkedIn
• The Guardian
• Twitter
• Foursquare
• Coursera
• Klout
• Walmart
More details here: http://assist-software.net/blog/how-play-work-play-framework-tutorial

More Related Content

What's hot

okuyama_20101101_nosqlafternoon
okuyama_20101101_nosqlafternoonokuyama_20101101_nosqlafternoon
okuyama_20101101_nosqlafternoonTakahiro Iwase
 
OpenStack Keystone with LDAP
OpenStack Keystone with LDAPOpenStack Keystone with LDAP
OpenStack Keystone with LDAPJesse Pretorius
 
OGDC2012 Lua In Game_Mr. Van, Nguyen Ngoc
OGDC2012 Lua In Game_Mr. Van, Nguyen NgocOGDC2012 Lua In Game_Mr. Van, Nguyen Ngoc
OGDC2012 Lua In Game_Mr. Van, Nguyen NgocBuff Nguyen
 
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016Dylan Butler
 
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...Sencha
 
How to run appache spark on windows(in sbt console)
How to run appache spark on windows(in sbt console)How to run appache spark on windows(in sbt console)
How to run appache spark on windows(in sbt console)Ankit Kaneri
 
My first powershell script
My first powershell scriptMy first powershell script
My first powershell scriptDavid Cobb
 
Monitor Micro-service with MicroProfile metrics
Monitor Micro-service with MicroProfile metricsMonitor Micro-service with MicroProfile metrics
Monitor Micro-service with MicroProfile metricsRudy De Busscher
 
All your data belong to us - The Active Objects Plugin
All your data belong to us - The Active Objects PluginAll your data belong to us - The Active Objects Plugin
All your data belong to us - The Active Objects PluginSamuel Le Berrigaud
 
Windows Azure Blob Storage
Windows Azure Blob StorageWindows Azure Blob Storage
Windows Azure Blob Storageylew15
 
Backup and Restore SQL Server Databases in Microsoft Azure
Backup and Restore SQL Server Databases in Microsoft AzureBackup and Restore SQL Server Databases in Microsoft Azure
Backup and Restore SQL Server Databases in Microsoft AzureDatavail
 
Running on Elastic Beanstalk
Running on Elastic BeanstalkRunning on Elastic Beanstalk
Running on Elastic BeanstalkAlex Verdyan
 

What's hot (20)

okuyama_20101101_nosqlafternoon
okuyama_20101101_nosqlafternoonokuyama_20101101_nosqlafternoon
okuyama_20101101_nosqlafternoon
 
OpenStack Keystone with LDAP
OpenStack Keystone with LDAPOpenStack Keystone with LDAP
OpenStack Keystone with LDAP
 
OGDC2012 Lua In Game_Mr. Van, Nguyen Ngoc
OGDC2012 Lua In Game_Mr. Van, Nguyen NgocOGDC2012 Lua In Game_Mr. Van, Nguyen Ngoc
OGDC2012 Lua In Game_Mr. Van, Nguyen Ngoc
 
Presentation
PresentationPresentation
Presentation
 
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
 
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
 
How to run appache spark on windows(in sbt console)
How to run appache spark on windows(in sbt console)How to run appache spark on windows(in sbt console)
How to run appache spark on windows(in sbt console)
 
SQLite 3
SQLite 3SQLite 3
SQLite 3
 
Sqlite
SqliteSqlite
Sqlite
 
My first powershell script
My first powershell scriptMy first powershell script
My first powershell script
 
Monitor Micro-service with MicroProfile metrics
Monitor Micro-service with MicroProfile metricsMonitor Micro-service with MicroProfile metrics
Monitor Micro-service with MicroProfile metrics
 
All your data belong to us - The Active Objects Plugin
All your data belong to us - The Active Objects PluginAll your data belong to us - The Active Objects Plugin
All your data belong to us - The Active Objects Plugin
 
eCAP Developer Walkthru
eCAP Developer WalkthrueCAP Developer Walkthru
eCAP Developer Walkthru
 
Getting Started with SQLite
Getting Started with SQLiteGetting Started with SQLite
Getting Started with SQLite
 
Introduction to AJAX
Introduction to AJAXIntroduction to AJAX
Introduction to AJAX
 
JavaCro'14 - Continuous deployment tool – Aleksandar Dostić and Emir Džaferović
JavaCro'14 - Continuous deployment tool – Aleksandar Dostić and Emir DžaferovićJavaCro'14 - Continuous deployment tool – Aleksandar Dostić and Emir Džaferović
JavaCro'14 - Continuous deployment tool – Aleksandar Dostić and Emir Džaferović
 
Windows Azure Blob Storage
Windows Azure Blob StorageWindows Azure Blob Storage
Windows Azure Blob Storage
 
Backup and Restore SQL Server Databases in Microsoft Azure
Backup and Restore SQL Server Databases in Microsoft AzureBackup and Restore SQL Server Databases in Microsoft Azure
Backup and Restore SQL Server Databases in Microsoft Azure
 
ppt
pptppt
ppt
 
Running on Elastic Beanstalk
Running on Elastic BeanstalkRunning on Elastic Beanstalk
Running on Elastic Beanstalk
 

Similar to How to Play at Work - A Play Framework Tutorial

XPages -Beyond the Basics
XPages -Beyond the BasicsXPages -Beyond the Basics
XPages -Beyond the BasicsUlrich Krause
 
[DanNotes] XPages - Beyound the Basics
[DanNotes] XPages - Beyound the Basics[DanNotes] XPages - Beyound the Basics
[DanNotes] XPages - Beyound the BasicsUlrich Krause
 
Learn Electron for Web Developers
Learn Electron for Web DevelopersLearn Electron for Web Developers
Learn Electron for Web DevelopersKyle Cearley
 
UKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basicsUKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basicsUlrich Krause
 
PLSSUG - Troubleshoot SQL Server performance problems like a Microsoft Engineer
PLSSUG - Troubleshoot SQL Server performance problems like a Microsoft EngineerPLSSUG - Troubleshoot SQL Server performance problems like a Microsoft Engineer
PLSSUG - Troubleshoot SQL Server performance problems like a Microsoft EngineerMarek Maśko
 
Extension Library - Viagra for XPages
Extension Library - Viagra for XPagesExtension Library - Viagra for XPages
Extension Library - Viagra for XPagesUlrich Krause
 
Google appenginejava.ppt
Google appenginejava.pptGoogle appenginejava.ppt
Google appenginejava.pptYoung Alista
 
Access Data from XPages with the Relational Controls
Access Data from XPages with the Relational ControlsAccess Data from XPages with the Relational Controls
Access Data from XPages with the Relational ControlsTeamstudio
 
Intro JavaScript
Intro JavaScriptIntro JavaScript
Intro JavaScriptkoppenolski
 
Play Framework and Activator
Play Framework and ActivatorPlay Framework and Activator
Play Framework and ActivatorKevin Webber
 
How to generate customized java 8 code from your database
How to generate customized java 8 code from your databaseHow to generate customized java 8 code from your database
How to generate customized java 8 code from your databaseSpeedment, Inc.
 
Silicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your databaseSilicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your databaseSpeedment, Inc.
 
06 integrate elasticsearch
06 integrate elasticsearch06 integrate elasticsearch
06 integrate elasticsearchErhwen Kuo
 
PowerShellForDBDevelopers
PowerShellForDBDevelopersPowerShellForDBDevelopers
PowerShellForDBDevelopersBryan Cafferky
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformAntonio Peric-Mazar
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disquszeeg
 
Sanger, upcoming Openstack for Bio-informaticians
Sanger, upcoming Openstack for Bio-informaticiansSanger, upcoming Openstack for Bio-informaticians
Sanger, upcoming Openstack for Bio-informaticiansPeter Clapham
 
ELK Ruminating on Logs (Zendcon 2016)
ELK Ruminating on Logs (Zendcon 2016)ELK Ruminating on Logs (Zendcon 2016)
ELK Ruminating on Logs (Zendcon 2016)Mathew Beane
 

Similar to How to Play at Work - A Play Framework Tutorial (20)

XPages -Beyond the Basics
XPages -Beyond the BasicsXPages -Beyond the Basics
XPages -Beyond the Basics
 
[DanNotes] XPages - Beyound the Basics
[DanNotes] XPages - Beyound the Basics[DanNotes] XPages - Beyound the Basics
[DanNotes] XPages - Beyound the Basics
 
Learn Electron for Web Developers
Learn Electron for Web DevelopersLearn Electron for Web Developers
Learn Electron for Web Developers
 
UKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basicsUKLUG 2012 - XPages, Beyond the basics
UKLUG 2012 - XPages, Beyond the basics
 
PLSSUG - Troubleshoot SQL Server performance problems like a Microsoft Engineer
PLSSUG - Troubleshoot SQL Server performance problems like a Microsoft EngineerPLSSUG - Troubleshoot SQL Server performance problems like a Microsoft Engineer
PLSSUG - Troubleshoot SQL Server performance problems like a Microsoft Engineer
 
Extension Library - Viagra for XPages
Extension Library - Viagra for XPagesExtension Library - Viagra for XPages
Extension Library - Viagra for XPages
 
Google appenginejava.ppt
Google appenginejava.pptGoogle appenginejava.ppt
Google appenginejava.ppt
 
Access Data from XPages with the Relational Controls
Access Data from XPages with the Relational ControlsAccess Data from XPages with the Relational Controls
Access Data from XPages with the Relational Controls
 
Intro JavaScript
Intro JavaScriptIntro JavaScript
Intro JavaScript
 
Play Framework and Activator
Play Framework and ActivatorPlay Framework and Activator
Play Framework and Activator
 
How to generate customized java 8 code from your database
How to generate customized java 8 code from your databaseHow to generate customized java 8 code from your database
How to generate customized java 8 code from your database
 
Silicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your databaseSilicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your database
 
06 integrate elasticsearch
06 integrate elasticsearch06 integrate elasticsearch
06 integrate elasticsearch
 
PowerShellForDBDevelopers
PowerShellForDBDevelopersPowerShellForDBDevelopers
PowerShellForDBDevelopers
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API Platform
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disqus
 
Sanger, upcoming Openstack for Bio-informaticians
Sanger, upcoming Openstack for Bio-informaticiansSanger, upcoming Openstack for Bio-informaticians
Sanger, upcoming Openstack for Bio-informaticians
 
Flexible compute
Flexible computeFlexible compute
Flexible compute
 
Hibernate java and_oracle
Hibernate java and_oracleHibernate java and_oracle
Hibernate java and_oracle
 
ELK Ruminating on Logs (Zendcon 2016)
ELK Ruminating on Logs (Zendcon 2016)ELK Ruminating on Logs (Zendcon 2016)
ELK Ruminating on Logs (Zendcon 2016)
 

More from AssistSoftware

L2L Entrepreneurship 2nd Newsletter
L2L Entrepreneurship 2nd NewsletterL2L Entrepreneurship 2nd Newsletter
L2L Entrepreneurship 2nd NewsletterAssistSoftware
 
L2L Entrepreneurship Newsletter
L2L Entrepreneurship NewsletterL2L Entrepreneurship Newsletter
L2L Entrepreneurship NewsletterAssistSoftware
 
Bonafide comunicat de presa
Bonafide   comunicat de presaBonafide   comunicat de presa
Bonafide comunicat de presaAssistSoftware
 
ASSIST Software Brochure
ASSIST Software BrochureASSIST Software Brochure
ASSIST Software BrochureAssistSoftware
 
ASSIST Software - Software Development & Outsourcing Company Romania, Eastern...
ASSIST Software - Software Development & Outsourcing Company Romania, Eastern...ASSIST Software - Software Development & Outsourcing Company Romania, Eastern...
ASSIST Software - Software Development & Outsourcing Company Romania, Eastern...AssistSoftware
 
Assist software awesome scala
Assist software   awesome scalaAssist software   awesome scala
Assist software awesome scalaAssistSoftware
 

More from AssistSoftware (6)

L2L Entrepreneurship 2nd Newsletter
L2L Entrepreneurship 2nd NewsletterL2L Entrepreneurship 2nd Newsletter
L2L Entrepreneurship 2nd Newsletter
 
L2L Entrepreneurship Newsletter
L2L Entrepreneurship NewsletterL2L Entrepreneurship Newsletter
L2L Entrepreneurship Newsletter
 
Bonafide comunicat de presa
Bonafide   comunicat de presaBonafide   comunicat de presa
Bonafide comunicat de presa
 
ASSIST Software Brochure
ASSIST Software BrochureASSIST Software Brochure
ASSIST Software Brochure
 
ASSIST Software - Software Development & Outsourcing Company Romania, Eastern...
ASSIST Software - Software Development & Outsourcing Company Romania, Eastern...ASSIST Software - Software Development & Outsourcing Company Romania, Eastern...
ASSIST Software - Software Development & Outsourcing Company Romania, Eastern...
 
Assist software awesome scala
Assist software   awesome scalaAssist software   awesome scala
Assist software awesome scala
 

Recently uploaded

VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingShane Coughlan
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Anthony Dahanne
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfRTS corp
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonApplitools
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 

Recently uploaded (20)

VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 

How to Play at Work - A Play Framework Tutorial

  • 1. A Play Framework Tutorial Assist-Software Romania- Marius Carp
  • 2. What is Play Framework • An open-source modern web framework • Based on a lightweight, stateless, web-friendly architecture. • Built on Akka, Play provides predictable and minimal resource consumption • Developer friendly • Has great support for Eclipse and Intellij IDEA. • Provides RESTful by default • Has a built-in JSON module and extensive NoSQL & Big Data Support. • There are libraries for everything - most of which can be used in Play.
  • 3. System Requirements • Install JDK 1.6 or later. • Install Scala (general-purpose language designed to support clear, concise and type-safe programming). Optional, but good to have, you may also use Java. • Install SBT is an open source build tool for Scala and Java projects, similar to Java's Maven or Ant. • Install Play Framework through a tool called Typesafe Activator. • Install PostgreSQL. • Install pgAdmin is a comprehensive PostgreSQL database design and management system.
  • 4. Game Play Tutorial • Let's create a new vanilla Play Scala application and name it scala-game. Here is the command you need to run it in command-line: • To start your game from command-line run from your project root folder: • or (recommanded) • To view your work go to: http://localhost:9000/
  • 5. Game Configuration Tutorial • To add more experience to your Play skills add the following dependencies to your build.sbt file: • Slick - a modern database query and access library for Scala. -It allows you to work with stored data and gives you full control • PostgreSQL JDBC is necessary to connect to PostgreSQL database
  • 6. Game Configuration Tutorial • Then, create a database and add its credentials to application.config file. • Add a package named dao to your app folder • Define database tables and set it in configuration • Uncomment evolution plugin and set it enabled • Play Framework's Evolutions will create tables and relations between them (primary keys, indexes, sequences etc...) for you.
  • 7. Game Configuration Tutorial • We have to specify to which database to connect creating a trait named PostgresSupport and define an implicit database
  • 8. Loading Textures in Play Framework • Create a package models and in it a case class named Player • Play tracks your database evolutions using several evolution scripts located in the db/evolutions directory. • The first script is named 1.sql. • We just need to map the models to tabels. • PostgreSQL will generate a PrimaryKey for the player using AutoInc:
  • 9. Loading Textures in Play Framework • A GET HTTP request will be made to this route "/„ when a user first time accesses our application . • The entire list of routes can be found in the conf/routes file • Each route consists of an HTTP method and URI pattern, both associated with a call to an Action generator. • An Action is basically a request => result function that handles a request and generates a result to be sent to the client. • A Controller is nothing more than a singleton object that generates Action values.
  • 10. Play Framework Game modes • You can chose to Play in two ways: • Single player using Play Scala template • Multi player using one of the following JavaScript frameworks: AngularJS, BackboneJS, EmberJS, ExtJS, DustJS . • Adding a new player and get players list using Slick. • players list (players is the mapped table) • add new player
  • 11. Single Player A Play Scala template • Is a simple text file, that contains small blocks of Scala code. • Can generate any text-based format, such as HTML, XML or CSV. • Allow web designers to easily work with the templates. • Templates are compiled as standard Scala functions. • If you create a views/Application/index.scala.html template file, it will generate a views.html.Application.indexfunction.
  • 12. Single Player A Play Scala template • In index.scala.html we have the player list • Play Framework will render the page server-side. • Adding players to the game is as simple as that: submit a form using POST to this route /player/single
  • 13. Multi Player • You will have two separated applications in one project: • API Backend (presistent data) • Frontend side (making AJAX calls to the server)- in public folder. • To test your calls use Postman. • Make a GET call to /player/multi • This will execute controllers.Application.findAll and it will return a list of players in JSON format.
  • 14. Multi Player • Example: • To add a player use POST method to this route /player/multi with the following JSON body: { "name": "Newbie", "level": 1 }
  • 15. Game Features • Amazon S3 module (Scala) - allows you to list, get, add and remove items from a S3 bucket. • Authentication and Authorization module (Scala) - offers Authentication and Authorization features to Play2.x applications. • Deadbolt 2 Plugin -powerful authorisation mechanism for defining access rights to certain controller methods • Dust Plugin – provides support for the dust client side template language (DustJS). • Memcached Plugin - provides a memcached based cache implementation. • MongoDB Salat, Casbah Plugin (Scala) - provides managed MongoDB access and object mapping using Salat and Casbah • Redis Plugin (Java and Scala) - provides a redis based cache implementation • SecureSocial (Java and Scala) - an authentication module supporting OAuth, OAuth2, OpenID, Username/Password and custom authentication schemes.
  • 16. Most popular Players • LinkedIn • The Guardian • Twitter • Foursquare • Coursera • Klout • Walmart More details here: http://assist-software.net/blog/how-play-work-play-framework-tutorial