SlideShare a Scribd company logo
1 of 53
Download to read offline
Scala and Java EE 7 Development
Experiences
Peter A. Pilgrim
Independent Contractor, Java Champion
Biography
■  Completed Java Sybase
course in 1998
■  Founded JAVAWUG
2004-2010
■  Independent Contractor
■  Blue-chip business:
Digitas Lbi, Barclays
Retail, Transform
September 2013
Java EE 7
Developer
Handbook
•  Overview of Scala
•  Java EE 7 architecture and design
•  Using Gradle as a build tool
•  How to create beans in Scala with dependency injection
•  JAX-RS endpoints
•  Servlet Endpoints
•  JMS Messaging
•  Scala adoption advice and hints for sustainable team
development
“The right architecture to the right application. Not all of us work
for Facebook or Twitter. If you look at their "web site" the
navigation is quite simple… For them, statelessness and NoSQL is
mandatory. But when you work on a "web application” then you
deal with complex flow management. Their problem is elsewhere :
fewer users but complex long time running transactional flows.
Stateful architecture are mandatory.
Antonio Gonclaves
Why Java EE Lost and Spring Won
http://java.dzone.com/articles/why-java-ee-lost-and-spring
Scalable Language
12/05/2014 XeNoNiQUe.co.uk (c) 2011 7
Still has a very bright future
Purely Object-Oriented
Statically-typed
Functional
JVM Language
Typing Derived from “Pascal” Tree of
Computer Language
<variableName> [: [ <Type> ]
personName: String
taxRate: Float
density: Double
found: False
persion: Person
May 12, 2014 Xenonique ©2013 8
Variables and Values
Assignment less programming
Prefer val over var

var x = 10.0; x = 10 + x
val y = 10.0
val z: Float = x
var t: Int = 42; t = t * 2
9
Scala Class
class Person (

val firstName: String

val lastName: String,

val height: Float,

val age: Int ) { 

// Write your definition here 
}

May 12, 2014 Xenonique ©2013 10
Instances of Scala Classes

val p1 = new Person( "Billy",
"Mitchell", 5.10F, 42 )

val p2 = new Person( "Kat",
"Moon", 5.8F, 39 )
May 12, 2014 Xenonique ©2013 11
Companion Objects
object Person {
private records = List[Person]()
def apply(fn: String, ln: String,
h: Float, a: Int): Person = {
val p = new Person(fn, ln, h, a );
records = p :: records.reverse // O(1)
return p
}
def recordCount() = records.size 
}
May 12, 2014 Xenonique ©2013 12
Case Classes

class Transmission( driveTrain:
String )
May 12, 2014 Xenonique ©2013 13
Scala Functions

val isEven: (Int => Boolean) = (k: Int) => k % 2 == 0



•  Functions are values, values are object
•  Ergo, functions are objects in Scala

May 12, 2014 Xenonique ©2013 14
Scala Code
def uniqueSorted[Symbol]( p: List[Symbol] ): List[Symbol] = {
val myOrdering = 
Ordering.fromLessThan[Symbol]( 
_.toString < _.toString )
var acc = SortedSet.empty(myOrdering)

def compress0( q: List[Symbol] ): Unit = {
q match {
case Nil => Nil
case x :: xs => { acc += x ; compress0(xs) }
}
}

May 12, 2014 Xenonique ©2013 15
Functions are First Class
•  In Scala, functions are first class citizens
•  Functions can return functions
May 12, 2014 Xenonique ©2013 16
SBT
•  SBT is the de-facto build tool
•  Works with Maven
•  Incremental Compilation +1
•  DSL written in Scala +1
•  Plugins Available +1
•  Complex to Understand -1
May 12, 2014 Xenonique ©2013 17
Gradle
•  Gradle is written in Groovy
•  Gradle is a DSL too +1
•  Easier to Grok +1
•  Since v1.4 Gradle support incremental
compilation through Zinc
•  Not the de-facto standard -1
May 12, 2014 Xenonique ©2013 18
ENTERPRISE
DEVELOPMENT
Modern Practice
Java EE 7 Framework Updates
Interface Boundary
Endpoints
JAX RS 2.0
JMS 2.0
Bean Validation 1.1
Management and
Storage
EJB 3.2
CDI 1.1
JPA 2.1
Web and HTML
Service Endpoints
Servlet 3.1
WebSocket 1.0
JSF 2.2
JSON 1.0
CDI and Scala
trait Processor { 

def process( payload: DataValue ) : Unit

/* ... */ 
}

@ApplicationScoped
class DatastarProcessor extends Processor {
@Inject var dataStore: DataStore = _

override def process( payload: DataValue): Unit = { 

// Do something here
}
}
What about Java SE 8?
public interface PaymentIssuer {

public void allocate( int id );
}
What about Java SE 8?
@ApplicationScoped
public class CreditCardTicketTracker() {

@Inject PaymentIssuer issuer;



public void doWork( 

 
List<Ticket> ticketBatch ) {

}
}
What about Java SE 8?

public void doWork( List<Ticket> ticketBatch ) {

 
 DateTime dt = new DateTime().minusDays(2);

 
 ticketBatch.stream()

 
.filter(

 
 t -> t.isAvailable() &&

 
 t -> t.paymentType == PaymentType.CreditCard && 

 
 t.concertDate.before( dt ) )

 .map( t -> p.getAllocationId() )

 .forEach( allocationId -> issuer.allocate(allocationId));

}
Write Annotations as Java
// In the Java source tree (src/main/java)
import javax.inject.Qualifier;
import javax.interceptor.InterceptorBinding;
import java.lang.annotation.*;
import static java.lang.annotation.ElementType.*;

@Qualifier
@InterceptorBinding
@Target({METHOD, TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface PermanentStorage { }
public @interface CachedStorage { }
public @interface TransientStorage { }
Stock CDI Advice
•  CDI does works very well with Scala POJOs
•  CDI cannot instantiate companion objects!
•  CDI beans must have a default constructor
•  CDI does not understand case classes (but
see later …)
CDI Setter Injection
•  Take advantage of Scala’s @BeanProperty
annotation
@BeanProperty
var liveStatus:String = “Default”
@Inject
def setLiveStatus(a:String):Unit=???
CDI Scopes
// Prefer CDI scopes if you use JSF in Java EE
import javax.enterprise.context.RequestScoped
import javax.enterprise.context.SessionScoped
import javax.enterprise.context.ApplicationScoped

// Instead of
import javax.faces.bean.RequestScoped
import javax.faces.bean.SessionScoped
import javax.faces.bean.ApplicationScoped
Last Advice on CDI Proxies
•  Scala POJOs need a lifecycle scope
•  Always create default no args constructor
•  Cannot be final or have final members
– (Interaction between Java and Scala)
JSF Managed Beans
import javax.enterprise.context.RequestScoped
import javax.inject.Named

@Named @RequestScoped
class BasicFlow {
def serveResponse() = "endState.xml"
}
JSF XHTML Facelet View
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html ...>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core”>
<h:head> ... </h:head>
<h:body> ... </h:body>
</html>
JSF XHTML Facelet View
<h:body> ...
<h:form>
<h:commandButton 
action="#{basicFlow.serveResponse}”
value="Invoke Action" />
</h:form>
</h:body>
Demo CDI and Scala
Produces JMS Connections in Scala
class JMSResourceProducer { 
@Resource(name = "jms/OrderConnectionFactory")
private orderConnectionFactory: QueueConnectionFactory = _
@Produces @Order @Resource(name = "jms/OrderQueue")
private orderQueue: Queue = _

@Produces @Order
def createOrderConnection(): QueueConnection = 
orderConnectionFactory.createQueueConnection()

@Produces @Order
def createOrderSession(@Order conn:QueueConnection): QueueSession
= conn.createQueueSession(true, Session.AUTO_ACKNOWLEDGE)
}
Scala and JAX-RS
•  JAX-RS 2 annotations work with Scala
POJOS out of the box
•  Annotate on public methods
•  @GET, @POST, @PUT, @DELETE
•  @Produces, @Consumes
Use Qualifiers in Scala
// In the Scala source tree (src/main/scala)
@ApplicationScoped
@PermanentStorage
class DatastarProcessor extends Processor {
@Inject
var dataStore: DataStore = _

override def process( payload: DataValue):
Unit = { /* ... */ }
}
JAX-RS
@Path("/alldata")
class AllDataServiceEndpoint {
@Inject var fastService: FastService = _
@Inject var predictorService: PredictorService = _
@Context var request: HttpServletRequest = _

@Path("/item")
@GET @Produces(Array(APPLICATION_JSON))
def listServices = ???
}
JAX-RS
def listServices = {
val listServices = 

(fastService.configuredAllServices ++ 

 
predictorService.configuredAllServices) 

map { makeElement( _ ) }
Response.ok(listServices, 
MediaType.APPLICATION_JSON).build
}
}
Jackson, Scala & JSON Support
•  JAX-RS works well with Scala POJOs
•  JAX-RS and Java EE 7 provides JSON
providers only for Java POJOs
•  Use Jackson JSON Providers for seamless
support of case classes
Jackson Scala JAX-RS
@Singleton
@Provider
@Consumes(

Array(MediaType.APPLICATION_JSON, 

"application/*+json", "text/json"))
@Produces(

Array(MediaType.APPLICATION_JSON, 

"application/*+json", "text/json"))
class JacksonScalaContextResolver extends
JacksonJaxbJsonProvider(

JacksonScalaContextResolver.getObjectMapper, 

JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS)
Jackson Scala JAX-RS
object JacksonScalaContextResolver {
def getObjectMapper: ObjectMapper = {
val mapper = new ObjectMapper with ScalaObjectMapper
mapper.registerModule(new DefaultScalaModule)
mapper.configure(
DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, 
false)
mapper.setSerializationInclusion(Include.NON_NULL);
mapper
}
}
Open Source Integration Testing
Peter Muir, David Blewin and Aslak Knutsen and from Red Hat JBoss.
Demo Alternative
Demo Servlets, CDI & EJB
Java EE 7 Demo
EXECUTIVE SUMMARY
Digital by Default with Java
“If you're frustrated that you're not getting picked, one
plan is to up your game, to hustle harder, ... But in the
era of picking yourself, it seems to me that you're
better off finding a path that doesn't require you get
picked in order to succeed.”
Seth Godin,
Getting Picked (‘need to’ versus ‘want to’)
Run It Yourself
•  https://github.com/peterpilgrim/javacro
•  Download the source code, build and run
•  Feedback, welcomed!
Thank You!
The book:
http://www.packtpub.com/java-ee-7-
developer-handbook/book
Blog:
http://xenonique.co.uk/blog/
Twitter:
@peter_pilgrim
Creative Commons Attributions
http://www.flickr.com/photos/holstphoto/3371060720/
Photo of "Chip Pattern" by Ryan Holst, March, 2009
http://www.flickr.com/photos/scarygami/5489773527/lightbox/
Photo of "Pattern" by Scarygami
http://www.flickr.com/photos/christianhaugen/3486381680/sizes/l/in/photostream/
Photo of "Patterns in the Sand" by Christian Haugen
http://www.flickr.com/photos/krunkwerke/3840127296/
Photo of a series of punch cards which are strung together, to
control the pattern woven by the Jacquard loom. John R. Southern
Creative Commons Attributions
http://www.flickr.com/photos/josefstuefer/43867840/
Proof of Pattern messh "untitled" in tan by Josef Stuefer
http://www.flickr.com/photos/josefstuefer/43972554/
Proof of Pattern mesh "untitled" in blue by Josef Stuefer
http://www.flickr.com/photos/scott1723/6290151038/
Alter photo of "Tug of War 3" by Scott Anderson

More Related Content

What's hot

Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO DevsWO Community
 
Slaven tomac unit testing in angular js
Slaven tomac   unit testing in angular jsSlaven tomac   unit testing in angular js
Slaven tomac unit testing in angular jsSlaven Tomac
 
How to build to do app using vue composition api and vuex 4 with typescript
How to build to do app using vue composition api and vuex 4 with typescriptHow to build to do app using vue composition api and vuex 4 with typescript
How to build to do app using vue composition api and vuex 4 with typescriptKaty Slemon
 
"Migrate large gwt applications - Lessons Learned" By Harald Pehl
"Migrate large gwt applications - Lessons Learned" By Harald Pehl"Migrate large gwt applications - Lessons Learned" By Harald Pehl
"Migrate large gwt applications - Lessons Learned" By Harald PehlGWTcon
 
How AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design PatternsHow AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design PatternsRan Mizrahi
 
Fifty Features of Java EE 7 in 50 Minutes
Fifty Features of Java EE 7 in 50 MinutesFifty Features of Java EE 7 in 50 Minutes
Fifty Features of Java EE 7 in 50 Minutesglassfish
 
Spring 4 final xtr_presentation
Spring 4 final xtr_presentationSpring 4 final xtr_presentation
Spring 4 final xtr_presentationsourabh aggarwal
 
Dropwizard Internals
Dropwizard InternalsDropwizard Internals
Dropwizard Internalscarlo-rtr
 
Lecture 5 JSTL, custom tags, maven
Lecture 5   JSTL, custom tags, mavenLecture 5   JSTL, custom tags, maven
Lecture 5 JSTL, custom tags, mavenFahad Golra
 
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)Red Hat Developers
 
Deployment of WebObjects applications on FreeBSD
Deployment of WebObjects applications on FreeBSDDeployment of WebObjects applications on FreeBSD
Deployment of WebObjects applications on FreeBSDWO Community
 
Александр Пашинский "Reinventing Design Patterns with Java 8"
Александр Пашинский "Reinventing Design Patterns with Java 8"Александр Пашинский "Reinventing Design Patterns with Java 8"
Александр Пашинский "Reinventing Design Patterns with Java 8"Anna Shymchenko
 
the Spring 4 update
the Spring 4 updatethe Spring 4 update
the Spring 4 updateJoshua Long
 
CQ5 QueryBuilder - .adaptTo(Berlin) 2011
CQ5 QueryBuilder - .adaptTo(Berlin) 2011CQ5 QueryBuilder - .adaptTo(Berlin) 2011
CQ5 QueryBuilder - .adaptTo(Berlin) 2011Alexander Klimetschek
 
Lecture 4: JavaServer Pages (JSP) & Expression Language (EL)
Lecture 4:  JavaServer Pages (JSP) & Expression Language (EL)Lecture 4:  JavaServer Pages (JSP) & Expression Language (EL)
Lecture 4: JavaServer Pages (JSP) & Expression Language (EL)Fahad Golra
 
Lecture 3: Servlets - Session Management
Lecture 3:  Servlets - Session ManagementLecture 3:  Servlets - Session Management
Lecture 3: Servlets - Session ManagementFahad Golra
 
«От экспериментов с инфраструктурой до внедрения в продакшен»​
«От экспериментов с инфраструктурой до внедрения в продакшен»​«От экспериментов с инфраструктурой до внедрения в продакшен»​
«От экспериментов с инфраструктурой до внедрения в продакшен»​FDConf
 

What's hot (18)

Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO Devs
 
Slaven tomac unit testing in angular js
Slaven tomac   unit testing in angular jsSlaven tomac   unit testing in angular js
Slaven tomac unit testing in angular js
 
How to build to do app using vue composition api and vuex 4 with typescript
How to build to do app using vue composition api and vuex 4 with typescriptHow to build to do app using vue composition api and vuex 4 with typescript
How to build to do app using vue composition api and vuex 4 with typescript
 
"Migrate large gwt applications - Lessons Learned" By Harald Pehl
"Migrate large gwt applications - Lessons Learned" By Harald Pehl"Migrate large gwt applications - Lessons Learned" By Harald Pehl
"Migrate large gwt applications - Lessons Learned" By Harald Pehl
 
How AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design PatternsHow AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design Patterns
 
Fifty Features of Java EE 7 in 50 Minutes
Fifty Features of Java EE 7 in 50 MinutesFifty Features of Java EE 7 in 50 Minutes
Fifty Features of Java EE 7 in 50 Minutes
 
Spring 4 final xtr_presentation
Spring 4 final xtr_presentationSpring 4 final xtr_presentation
Spring 4 final xtr_presentation
 
Dropwizard Internals
Dropwizard InternalsDropwizard Internals
Dropwizard Internals
 
Lecture 5 JSTL, custom tags, maven
Lecture 5   JSTL, custom tags, mavenLecture 5   JSTL, custom tags, maven
Lecture 5 JSTL, custom tags, maven
 
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
Boost Development With Java EE7 On EAP7 (Demitris Andreadis)
 
Deployment of WebObjects applications on FreeBSD
Deployment of WebObjects applications on FreeBSDDeployment of WebObjects applications on FreeBSD
Deployment of WebObjects applications on FreeBSD
 
Александр Пашинский "Reinventing Design Patterns with Java 8"
Александр Пашинский "Reinventing Design Patterns with Java 8"Александр Пашинский "Reinventing Design Patterns with Java 8"
Александр Пашинский "Reinventing Design Patterns with Java 8"
 
the Spring 4 update
the Spring 4 updatethe Spring 4 update
the Spring 4 update
 
CQ5 QueryBuilder - .adaptTo(Berlin) 2011
CQ5 QueryBuilder - .adaptTo(Berlin) 2011CQ5 QueryBuilder - .adaptTo(Berlin) 2011
CQ5 QueryBuilder - .adaptTo(Berlin) 2011
 
Lecture 4: JavaServer Pages (JSP) & Expression Language (EL)
Lecture 4:  JavaServer Pages (JSP) & Expression Language (EL)Lecture 4:  JavaServer Pages (JSP) & Expression Language (EL)
Lecture 4: JavaServer Pages (JSP) & Expression Language (EL)
 
Lecture 3: Servlets - Session Management
Lecture 3:  Servlets - Session ManagementLecture 3:  Servlets - Session Management
Lecture 3: Servlets - Session Management
 
«От экспериментов с инфраструктурой до внедрения в продакшен»​
«От экспериментов с инфраструктурой до внедрения в продакшен»​«От экспериментов с инфраструктурой до внедрения в продакшен»​
«От экспериментов с инфраструктурой до внедрения в продакшен»​
 
Angular beans
Angular beansAngular beans
Angular beans
 

Viewers also liked

Viewers also liked (20)

JavaCro'14 - Automatic database migrations – Marko Elezović
JavaCro'14 - Automatic database migrations – Marko ElezovićJavaCro'14 - Automatic database migrations – Marko Elezović
JavaCro'14 - Automatic database migrations – Marko Elezović
 
JavaCro'14 - Amphinicy crown jewels our software development infrastructure –...
JavaCro'14 - Amphinicy crown jewels our software development infrastructure –...JavaCro'14 - Amphinicy crown jewels our software development infrastructure –...
JavaCro'14 - Amphinicy crown jewels our software development infrastructure –...
 
JavaCro'14 - Drools Decision tables – form of human-readable rules – Dragan J...
JavaCro'14 - Drools Decision tables – form of human-readable rules – Dragan J...JavaCro'14 - Drools Decision tables – form of human-readable rules – Dragan J...
JavaCro'14 - Drools Decision tables – form of human-readable rules – Dragan J...
 
JavaCro'14 - Vaadin scalability myth – Gordan Ivanović
JavaCro'14 - Vaadin scalability myth – Gordan IvanovićJavaCro'14 - Vaadin scalability myth – Gordan Ivanović
JavaCro'14 - Vaadin scalability myth – Gordan Ivanović
 
JavaCro'14 - Profile any environment with Java Flight Recorder – Johan Janssen
JavaCro'14 - Profile any environment with Java Flight Recorder – Johan JanssenJavaCro'14 - Profile any environment with Java Flight Recorder – Johan Janssen
JavaCro'14 - Profile any environment with Java Flight Recorder – Johan Janssen
 
JavaCro'14 - The World of Java – in Croatia – Branko Mihaljević and Aleksande...
JavaCro'14 - The World of Java – in Croatia – Branko Mihaljević and Aleksande...JavaCro'14 - The World of Java – in Croatia – Branko Mihaljević and Aleksande...
JavaCro'14 - The World of Java – in Croatia – Branko Mihaljević and Aleksande...
 
JavaCro'14 - ZeroMQ and Java(Script) – Mladen Čikara
JavaCro'14 - ZeroMQ and Java(Script) – Mladen ČikaraJavaCro'14 - ZeroMQ and Java(Script) – Mladen Čikara
JavaCro'14 - ZeroMQ and Java(Script) – Mladen Čikara
 
JavaCro'14 - JavaScript single-page applications i JEE, can they fit together...
JavaCro'14 - JavaScript single-page applications i JEE, can they fit together...JavaCro'14 - JavaScript single-page applications i JEE, can they fit together...
JavaCro'14 - JavaScript single-page applications i JEE, can they fit together...
 
JavaCro'14 - WebLogic-GlassFish-JaaS Strategy and Roadmap – Duško Vukmanović
JavaCro'14 - WebLogic-GlassFish-JaaS Strategy and Roadmap – Duško VukmanovićJavaCro'14 - WebLogic-GlassFish-JaaS Strategy and Roadmap – Duško Vukmanović
JavaCro'14 - WebLogic-GlassFish-JaaS Strategy and Roadmap – Duško Vukmanović
 
JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec
JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija KranjecJavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec
JavaCro'14 - Gatling – weapon in ranks of performance testing – Andrija Kranjec
 
JavaCro'14 - Cloud Platforms in Internet of Things – Krešimir Mišura and Bran...
JavaCro'14 - Cloud Platforms in Internet of Things – Krešimir Mišura and Bran...JavaCro'14 - Cloud Platforms in Internet of Things – Krešimir Mišura and Bran...
JavaCro'14 - Cloud Platforms in Internet of Things – Krešimir Mišura and Bran...
 
JavaCro'14 - Automatized testing with Selenium 2 – Juraj Ćutić and Aleksander...
JavaCro'14 - Automatized testing with Selenium 2 – Juraj Ćutić and Aleksander...JavaCro'14 - Automatized testing with Selenium 2 – Juraj Ćutić and Aleksander...
JavaCro'14 - Automatized testing with Selenium 2 – Juraj Ćutić and Aleksander...
 
JavaCro'14 - MEAN Stack – How & When – Nenad Pećanac
JavaCro'14 - MEAN Stack – How & When – Nenad PećanacJavaCro'14 - MEAN Stack – How & When – Nenad Pećanac
JavaCro'14 - MEAN Stack – How & When – Nenad Pećanac
 
JavaCro'14 - Developing Google Chromecast applications on Android – Branimir ...
JavaCro'14 - Developing Google Chromecast applications on Android – Branimir ...JavaCro'14 - Developing Google Chromecast applications on Android – Branimir ...
JavaCro'14 - Developing Google Chromecast applications on Android – Branimir ...
 
JavaCro'14 - Going Digital with Java EE - Peter Pilgrim
JavaCro'14 - Going Digital with Java EE - Peter PilgrimJavaCro'14 - Going Digital with Java EE - Peter Pilgrim
JavaCro'14 - Going Digital with Java EE - Peter Pilgrim
 
JavaCro'14 - Sustainability of business performance and best practices – Zlat...
JavaCro'14 - Sustainability of business performance and best practices – Zlat...JavaCro'14 - Sustainability of business performance and best practices – Zlat...
JavaCro'14 - Sustainability of business performance and best practices – Zlat...
 
JavaCro'14 - JCalc Calculations in Java with open source API – Davor Sauer
JavaCro'14 - JCalc Calculations in Java with open source API – Davor SauerJavaCro'14 - JCalc Calculations in Java with open source API – Davor Sauer
JavaCro'14 - JCalc Calculations in Java with open source API – Davor Sauer
 
JavaCro'14 - Take Agile adoption to the next level with Integration Competenc...
JavaCro'14 - Take Agile adoption to the next level with Integration Competenc...JavaCro'14 - Take Agile adoption to the next level with Integration Competenc...
JavaCro'14 - Take Agile adoption to the next level with Integration Competenc...
 
JavaCro'14 - Is there a single “correct” web architecture for business apps –...
JavaCro'14 - Is there a single “correct” web architecture for business apps –...JavaCro'14 - Is there a single “correct” web architecture for business apps –...
JavaCro'14 - Is there a single “correct” web architecture for business apps –...
 
JavaCro'14 - Packaging and installing of the JEE solution – Miroslav Rešetar
JavaCro'14 - Packaging and installing of the JEE solution – Miroslav RešetarJavaCro'14 - Packaging and installing of the JEE solution – Miroslav Rešetar
JavaCro'14 - Packaging and installing of the JEE solution – Miroslav Rešetar
 

Similar to JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim

Spring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard WolffSpring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard WolffJAX London
 
Scaladroids: Developing Android Apps with Scala
Scaladroids: Developing Android Apps with ScalaScaladroids: Developing Android Apps with Scala
Scaladroids: Developing Android Apps with ScalaOstap Andrusiv
 
Using spark 1.2 with Java 8 and Cassandra
Using spark 1.2 with Java 8 and CassandraUsing spark 1.2 with Java 8 and Cassandra
Using spark 1.2 with Java 8 and CassandraDenis Dus
 
Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014
Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014
Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014Roger Huang
 
PofEAA and SQLAlchemy
PofEAA and SQLAlchemyPofEAA and SQLAlchemy
PofEAA and SQLAlchemyInada Naoki
 
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...Lucas Jellema
 
Xebicon2013 scala vsjava_final
Xebicon2013 scala vsjava_finalXebicon2013 scala vsjava_final
Xebicon2013 scala vsjava_finalUrs Peter
 
Scala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghScala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghStuart Roebuck
 
Scala uma poderosa linguagem para a jvm
Scala   uma poderosa linguagem para a jvmScala   uma poderosa linguagem para a jvm
Scala uma poderosa linguagem para a jvmIsaias Barroso
 
Big Data processing with Spark, Scala or Java?
Big Data processing with Spark, Scala or Java?Big Data processing with Spark, Scala or Java?
Big Data processing with Spark, Scala or Java?Erik-Berndt Scheper
 
Adding geospatial features to a java web app
Adding geospatial features to a java web appAdding geospatial features to a java web app
Adding geospatial features to a java web appMatti Tahvonen
 
Intro to Spark and Spark SQL
Intro to Spark and Spark SQLIntro to Spark and Spark SQL
Intro to Spark and Spark SQLjeykottalam
 
Kotlin: forse è la volta buona (Trento)
Kotlin: forse è la volta buona (Trento)Kotlin: forse è la volta buona (Trento)
Kotlin: forse è la volta buona (Trento)Davide Cerbo
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryTatsuhiko Miyagawa
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejsNick Lee
 

Similar to JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim (20)

Spring data requery
Spring data requerySpring data requery
Spring data requery
 
Scala and Spring
Scala and SpringScala and Spring
Scala and Spring
 
Spring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard WolffSpring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard Wolff
 
Scaladroids: Developing Android Apps with Scala
Scaladroids: Developing Android Apps with ScalaScaladroids: Developing Android Apps with Scala
Scaladroids: Developing Android Apps with Scala
 
Kpi driven-java-development
Kpi driven-java-developmentKpi driven-java-development
Kpi driven-java-development
 
Using spark 1.2 with Java 8 and Cassandra
Using spark 1.2 with Java 8 and CassandraUsing spark 1.2 with Java 8 and Cassandra
Using spark 1.2 with Java 8 and Cassandra
 
Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014
Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014
Intro to Apache Spark and Scala, Austin ACM SIGKDD, 7/9/2014
 
Scala 20140715
Scala 20140715Scala 20140715
Scala 20140715
 
PofEAA and SQLAlchemy
PofEAA and SQLAlchemyPofEAA and SQLAlchemy
PofEAA and SQLAlchemy
 
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...
Singpore Oracle Sessions III - What is truly useful in Oracle Database 12c fo...
 
Xebicon2013 scala vsjava_final
Xebicon2013 scala vsjava_finalXebicon2013 scala vsjava_final
Xebicon2013 scala vsjava_final
 
Scala @ TechMeetup Edinburgh
Scala @ TechMeetup EdinburghScala @ TechMeetup Edinburgh
Scala @ TechMeetup Edinburgh
 
Json generation
Json generationJson generation
Json generation
 
Scala uma poderosa linguagem para a jvm
Scala   uma poderosa linguagem para a jvmScala   uma poderosa linguagem para a jvm
Scala uma poderosa linguagem para a jvm
 
Big Data processing with Spark, Scala or Java?
Big Data processing with Spark, Scala or Java?Big Data processing with Spark, Scala or Java?
Big Data processing with Spark, Scala or Java?
 
Adding geospatial features to a java web app
Adding geospatial features to a java web appAdding geospatial features to a java web app
Adding geospatial features to a java web app
 
Intro to Spark and Spark SQL
Intro to Spark and Spark SQLIntro to Spark and Spark SQL
Intro to Spark and Spark SQL
 
Kotlin: forse è la volta buona (Trento)
Kotlin: forse è la volta buona (Trento)Kotlin: forse è la volta buona (Trento)
Kotlin: forse è la volta buona (Trento)
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejs
 

More from HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association

More from HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association (20)

Java cro'21 the best tools for java developers in 2021 - hujak
Java cro'21   the best tools for java developers in 2021 - hujakJava cro'21   the best tools for java developers in 2021 - hujak
Java cro'21 the best tools for java developers in 2021 - hujak
 
JavaCro'21 - Java is Here To Stay - HUJAK Keynote
JavaCro'21 - Java is Here To Stay - HUJAK KeynoteJavaCro'21 - Java is Here To Stay - HUJAK Keynote
JavaCro'21 - Java is Here To Stay - HUJAK Keynote
 
Javantura v7 - Behaviour Driven Development with Cucumber - Ivan Lozić
Javantura v7 - Behaviour Driven Development with Cucumber - Ivan LozićJavantura v7 - Behaviour Driven Development with Cucumber - Ivan Lozić
Javantura v7 - Behaviour Driven Development with Cucumber - Ivan Lozić
 
Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...
Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...
Javantura v7 - The State of Java - Today and Tomowwow - HUJAK's Community Key...
 
Javantura v7 - Learning to Scale Yourself: The Journey from Coder to Leader -...
Javantura v7 - Learning to Scale Yourself: The Journey from Coder to Leader -...Javantura v7 - Learning to Scale Yourself: The Journey from Coder to Leader -...
Javantura v7 - Learning to Scale Yourself: The Journey from Coder to Leader -...
 
JavaCro'19 - The State of Java and Software Development in Croatia - Communit...
JavaCro'19 - The State of Java and Software Development in Croatia - Communit...JavaCro'19 - The State of Java and Software Development in Croatia - Communit...
JavaCro'19 - The State of Java and Software Development in Croatia - Communit...
 
Javantura v6 - Java in Croatia and HUJAK - Branko Mihaljević, Aleksander Radovan
Javantura v6 - Java in Croatia and HUJAK - Branko Mihaljević, Aleksander RadovanJavantura v6 - Java in Croatia and HUJAK - Branko Mihaljević, Aleksander Radovan
Javantura v6 - Java in Croatia and HUJAK - Branko Mihaljević, Aleksander Radovan
 
Javantura v6 - On the Aspects of Polyglot Programming and Memory Management i...
Javantura v6 - On the Aspects of Polyglot Programming and Memory Management i...Javantura v6 - On the Aspects of Polyglot Programming and Memory Management i...
Javantura v6 - On the Aspects of Polyglot Programming and Memory Management i...
 
Javantura v6 - Case Study: Marketplace App with Java and Hyperledger Fabric -...
Javantura v6 - Case Study: Marketplace App with Java and Hyperledger Fabric -...Javantura v6 - Case Study: Marketplace App with Java and Hyperledger Fabric -...
Javantura v6 - Case Study: Marketplace App with Java and Hyperledger Fabric -...
 
Javantura v6 - How to help customers report bugs accurately - Miroslav Čerkez...
Javantura v6 - How to help customers report bugs accurately - Miroslav Čerkez...Javantura v6 - How to help customers report bugs accurately - Miroslav Čerkez...
Javantura v6 - How to help customers report bugs accurately - Miroslav Čerkez...
 
Javantura v6 - When remote work really works - the secrets behind successful ...
Javantura v6 - When remote work really works - the secrets behind successful ...Javantura v6 - When remote work really works - the secrets behind successful ...
Javantura v6 - When remote work really works - the secrets behind successful ...
 
Javantura v6 - Kotlin-Java Interop - Matej Vidaković
Javantura v6 - Kotlin-Java Interop - Matej VidakovićJavantura v6 - Kotlin-Java Interop - Matej Vidaković
Javantura v6 - Kotlin-Java Interop - Matej Vidaković
 
Javantura v6 - Spring HATEOAS hypermedia-driven web services, and clients tha...
Javantura v6 - Spring HATEOAS hypermedia-driven web services, and clients tha...Javantura v6 - Spring HATEOAS hypermedia-driven web services, and clients tha...
Javantura v6 - Spring HATEOAS hypermedia-driven web services, and clients tha...
 
Javantura v6 - End to End Continuous Delivery of Microservices for Kubernetes...
Javantura v6 - End to End Continuous Delivery of Microservices for Kubernetes...Javantura v6 - End to End Continuous Delivery of Microservices for Kubernetes...
Javantura v6 - End to End Continuous Delivery of Microservices for Kubernetes...
 
Javantura v6 - Istio Service Mesh - The magic between your microservices - Ma...
Javantura v6 - Istio Service Mesh - The magic between your microservices - Ma...Javantura v6 - Istio Service Mesh - The magic between your microservices - Ma...
Javantura v6 - Istio Service Mesh - The magic between your microservices - Ma...
 
Javantura v6 - How can you improve the quality of your application - Ioannis ...
Javantura v6 - How can you improve the quality of your application - Ioannis ...Javantura v6 - How can you improve the quality of your application - Ioannis ...
Javantura v6 - How can you improve the quality of your application - Ioannis ...
 
Javantura v6 - Just say it v2 - Pavao Varela Petrac
Javantura v6 - Just say it v2 - Pavao Varela PetracJavantura v6 - Just say it v2 - Pavao Varela Petrac
Javantura v6 - Just say it v2 - Pavao Varela Petrac
 
Javantura v6 - Automation of web apps testing - Hrvoje Ruhek
Javantura v6 - Automation of web apps testing - Hrvoje RuhekJavantura v6 - Automation of web apps testing - Hrvoje Ruhek
Javantura v6 - Automation of web apps testing - Hrvoje Ruhek
 
Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...
Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...
Javantura v6 - Master the Concepts Behind the Java 10 Challenges and Eliminat...
 
Javantura v6 - Building IoT Middleware with Microservices - Mario Kusek
Javantura v6 - Building IoT Middleware with Microservices - Mario KusekJavantura v6 - Building IoT Middleware with Microservices - Mario Kusek
Javantura v6 - Building IoT Middleware with Microservices - Mario Kusek
 

Recently uploaded

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 

Recently uploaded (20)

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 

JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim

  • 1. Scala and Java EE 7 Development Experiences Peter A. Pilgrim Independent Contractor, Java Champion
  • 2. Biography ■  Completed Java Sybase course in 1998 ■  Founded JAVAWUG 2004-2010 ■  Independent Contractor ■  Blue-chip business: Digitas Lbi, Barclays Retail, Transform
  • 3. September 2013 Java EE 7 Developer Handbook
  • 4. •  Overview of Scala •  Java EE 7 architecture and design •  Using Gradle as a build tool •  How to create beans in Scala with dependency injection •  JAX-RS endpoints •  Servlet Endpoints •  JMS Messaging •  Scala adoption advice and hints for sustainable team development
  • 5. “The right architecture to the right application. Not all of us work for Facebook or Twitter. If you look at their "web site" the navigation is quite simple… For them, statelessness and NoSQL is mandatory. But when you work on a "web application” then you deal with complex flow management. Their problem is elsewhere : fewer users but complex long time running transactional flows. Stateful architecture are mandatory. Antonio Gonclaves Why Java EE Lost and Spring Won http://java.dzone.com/articles/why-java-ee-lost-and-spring
  • 6.
  • 7. Scalable Language 12/05/2014 XeNoNiQUe.co.uk (c) 2011 7 Still has a very bright future Purely Object-Oriented Statically-typed Functional JVM Language
  • 8. Typing Derived from “Pascal” Tree of Computer Language <variableName> [: [ <Type> ] personName: String taxRate: Float density: Double found: False persion: Person May 12, 2014 Xenonique ©2013 8
  • 9. Variables and Values Assignment less programming Prefer val over var var x = 10.0; x = 10 + x val y = 10.0 val z: Float = x var t: Int = 42; t = t * 2 9
  • 10. Scala Class class Person ( val firstName: String val lastName: String, val height: Float, val age: Int ) { // Write your definition here } May 12, 2014 Xenonique ©2013 10
  • 11. Instances of Scala Classes val p1 = new Person( "Billy", "Mitchell", 5.10F, 42 ) val p2 = new Person( "Kat", "Moon", 5.8F, 39 ) May 12, 2014 Xenonique ©2013 11
  • 12. Companion Objects object Person { private records = List[Person]() def apply(fn: String, ln: String, h: Float, a: Int): Person = { val p = new Person(fn, ln, h, a ); records = p :: records.reverse // O(1) return p } def recordCount() = records.size } May 12, 2014 Xenonique ©2013 12
  • 13. Case Classes class Transmission( driveTrain: String ) May 12, 2014 Xenonique ©2013 13
  • 14. Scala Functions val isEven: (Int => Boolean) = (k: Int) => k % 2 == 0 •  Functions are values, values are object •  Ergo, functions are objects in Scala May 12, 2014 Xenonique ©2013 14
  • 15. Scala Code def uniqueSorted[Symbol]( p: List[Symbol] ): List[Symbol] = { val myOrdering = Ordering.fromLessThan[Symbol]( _.toString < _.toString ) var acc = SortedSet.empty(myOrdering) def compress0( q: List[Symbol] ): Unit = { q match { case Nil => Nil case x :: xs => { acc += x ; compress0(xs) } } } May 12, 2014 Xenonique ©2013 15
  • 16. Functions are First Class •  In Scala, functions are first class citizens •  Functions can return functions May 12, 2014 Xenonique ©2013 16
  • 17. SBT •  SBT is the de-facto build tool •  Works with Maven •  Incremental Compilation +1 •  DSL written in Scala +1 •  Plugins Available +1 •  Complex to Understand -1 May 12, 2014 Xenonique ©2013 17
  • 18. Gradle •  Gradle is written in Groovy •  Gradle is a DSL too +1 •  Easier to Grok +1 •  Since v1.4 Gradle support incremental compilation through Zinc •  Not the de-facto standard -1 May 12, 2014 Xenonique ©2013 18
  • 20.
  • 21.
  • 22. Java EE 7 Framework Updates Interface Boundary Endpoints JAX RS 2.0 JMS 2.0 Bean Validation 1.1 Management and Storage EJB 3.2 CDI 1.1 JPA 2.1 Web and HTML Service Endpoints Servlet 3.1 WebSocket 1.0 JSF 2.2 JSON 1.0
  • 23. CDI and Scala trait Processor { def process( payload: DataValue ) : Unit /* ... */ } @ApplicationScoped class DatastarProcessor extends Processor { @Inject var dataStore: DataStore = _ override def process( payload: DataValue): Unit = { // Do something here } }
  • 24. What about Java SE 8? public interface PaymentIssuer { public void allocate( int id ); }
  • 25. What about Java SE 8? @ApplicationScoped public class CreditCardTicketTracker() { @Inject PaymentIssuer issuer; public void doWork( List<Ticket> ticketBatch ) { } }
  • 26. What about Java SE 8? public void doWork( List<Ticket> ticketBatch ) { DateTime dt = new DateTime().minusDays(2); ticketBatch.stream() .filter( t -> t.isAvailable() && t -> t.paymentType == PaymentType.CreditCard && t.concertDate.before( dt ) ) .map( t -> p.getAllocationId() ) .forEach( allocationId -> issuer.allocate(allocationId)); }
  • 27. Write Annotations as Java // In the Java source tree (src/main/java) import javax.inject.Qualifier; import javax.interceptor.InterceptorBinding; import java.lang.annotation.*; import static java.lang.annotation.ElementType.*; @Qualifier @InterceptorBinding @Target({METHOD, TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface PermanentStorage { } public @interface CachedStorage { } public @interface TransientStorage { }
  • 28. Stock CDI Advice •  CDI does works very well with Scala POJOs •  CDI cannot instantiate companion objects! •  CDI beans must have a default constructor •  CDI does not understand case classes (but see later …)
  • 29. CDI Setter Injection •  Take advantage of Scala’s @BeanProperty annotation @BeanProperty var liveStatus:String = “Default” @Inject def setLiveStatus(a:String):Unit=???
  • 30. CDI Scopes // Prefer CDI scopes if you use JSF in Java EE import javax.enterprise.context.RequestScoped import javax.enterprise.context.SessionScoped import javax.enterprise.context.ApplicationScoped // Instead of import javax.faces.bean.RequestScoped import javax.faces.bean.SessionScoped import javax.faces.bean.ApplicationScoped
  • 31. Last Advice on CDI Proxies •  Scala POJOs need a lifecycle scope •  Always create default no args constructor •  Cannot be final or have final members – (Interaction between Java and Scala)
  • 32. JSF Managed Beans import javax.enterprise.context.RequestScoped import javax.inject.Named @Named @RequestScoped class BasicFlow { def serveResponse() = "endState.xml" }
  • 33. JSF XHTML Facelet View <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html ...> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:f="http://xmlns.jcp.org/jsf/core”> <h:head> ... </h:head> <h:body> ... </h:body> </html>
  • 34. JSF XHTML Facelet View <h:body> ... <h:form> <h:commandButton action="#{basicFlow.serveResponse}” value="Invoke Action" /> </h:form> </h:body>
  • 35. Demo CDI and Scala
  • 36. Produces JMS Connections in Scala class JMSResourceProducer { @Resource(name = "jms/OrderConnectionFactory") private orderConnectionFactory: QueueConnectionFactory = _ @Produces @Order @Resource(name = "jms/OrderQueue") private orderQueue: Queue = _ @Produces @Order def createOrderConnection(): QueueConnection = orderConnectionFactory.createQueueConnection() @Produces @Order def createOrderSession(@Order conn:QueueConnection): QueueSession = conn.createQueueSession(true, Session.AUTO_ACKNOWLEDGE) }
  • 37. Scala and JAX-RS •  JAX-RS 2 annotations work with Scala POJOS out of the box •  Annotate on public methods •  @GET, @POST, @PUT, @DELETE •  @Produces, @Consumes
  • 38. Use Qualifiers in Scala // In the Scala source tree (src/main/scala) @ApplicationScoped @PermanentStorage class DatastarProcessor extends Processor { @Inject var dataStore: DataStore = _ override def process( payload: DataValue): Unit = { /* ... */ } }
  • 39. JAX-RS @Path("/alldata") class AllDataServiceEndpoint { @Inject var fastService: FastService = _ @Inject var predictorService: PredictorService = _ @Context var request: HttpServletRequest = _ @Path("/item") @GET @Produces(Array(APPLICATION_JSON)) def listServices = ??? }
  • 40. JAX-RS def listServices = { val listServices = (fastService.configuredAllServices ++ predictorService.configuredAllServices) map { makeElement( _ ) } Response.ok(listServices, MediaType.APPLICATION_JSON).build } }
  • 41. Jackson, Scala & JSON Support •  JAX-RS works well with Scala POJOs •  JAX-RS and Java EE 7 provides JSON providers only for Java POJOs •  Use Jackson JSON Providers for seamless support of case classes
  • 42. Jackson Scala JAX-RS @Singleton @Provider @Consumes( Array(MediaType.APPLICATION_JSON, "application/*+json", "text/json")) @Produces( Array(MediaType.APPLICATION_JSON, "application/*+json", "text/json")) class JacksonScalaContextResolver extends JacksonJaxbJsonProvider( JacksonScalaContextResolver.getObjectMapper, JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS)
  • 43. Jackson Scala JAX-RS object JacksonScalaContextResolver { def getObjectMapper: ObjectMapper = { val mapper = new ObjectMapper with ScalaObjectMapper mapper.registerModule(new DefaultScalaModule) mapper.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) mapper.setSerializationInclusion(Include.NON_NULL); mapper } }
  • 44. Open Source Integration Testing Peter Muir, David Blewin and Aslak Knutsen and from Red Hat JBoss.
  • 47. Java EE 7 Demo
  • 48. EXECUTIVE SUMMARY Digital by Default with Java
  • 49. “If you're frustrated that you're not getting picked, one plan is to up your game, to hustle harder, ... But in the era of picking yourself, it seems to me that you're better off finding a path that doesn't require you get picked in order to succeed.” Seth Godin, Getting Picked (‘need to’ versus ‘want to’)
  • 50. Run It Yourself •  https://github.com/peterpilgrim/javacro •  Download the source code, build and run •  Feedback, welcomed!
  • 52. Creative Commons Attributions http://www.flickr.com/photos/holstphoto/3371060720/ Photo of "Chip Pattern" by Ryan Holst, March, 2009 http://www.flickr.com/photos/scarygami/5489773527/lightbox/ Photo of "Pattern" by Scarygami http://www.flickr.com/photos/christianhaugen/3486381680/sizes/l/in/photostream/ Photo of "Patterns in the Sand" by Christian Haugen http://www.flickr.com/photos/krunkwerke/3840127296/ Photo of a series of punch cards which are strung together, to control the pattern woven by the Jacquard loom. John R. Southern
  • 53. Creative Commons Attributions http://www.flickr.com/photos/josefstuefer/43867840/ Proof of Pattern messh "untitled" in tan by Josef Stuefer http://www.flickr.com/photos/josefstuefer/43972554/ Proof of Pattern mesh "untitled" in blue by Josef Stuefer http://www.flickr.com/photos/scott1723/6290151038/ Alter photo of "Tug of War 3" by Scott Anderson