Scala for Java Developers

By Thomas Alexandre

Build reactive, scalable purposes and combine Java code with the ability of Scala

About This Book

  • Learn the syntax interactively to easily transition to Scala by means of reusing your Java code
  • Leverage the total strength of contemporary internet programming through construction scalable and reactive applications
  • Easy to persist with directions and actual international examples that can assist you combine java code and take on great info challenges

Who This publication Is For

If you're a Java developer or a Java architect operating with Java EE-based ideas and wish to begin utilizing Scala on your day-by-day programming, then this publication is perfect for you. This booklet gets you up and working fast through adopting a realistic technique with real-world code samples. No past wisdom of Scala is required.

What you are going to Learn

  • Apply and keep watch over the Scala Ecosystem
  • Migrate Java code to Scala
  • Discover Play Framework internet development
  • Test facts utilizing Scala's checking out frameworks
  • Manipulate XML and JSON in Scala
  • Learn the Scala syntax interactively
  • Integrate Java initiatives in Scala
  • Build reactive net apps utilizing the Typesafe stack
  • Use new platforms together with the Akka framework, the Play internet framework, and the rising Slick framework
  • Tackle vast information challenges

In Detail

Scala for Java builders is a step by step consultant packed with easy-to-follow code taken from real-world examples explaining the migration and integration of Scala in a Java project.

With this publication, you are going to first get ok with the Scala syntax and its Java-like environment, after which dive into new methods of establishing reactive net apps utilizing the Typesafe stack together with the actor-based Akka framework, the Play net framework, and the rising Slick framework for patience. The e-book will then train you ways to study valuable instruments for unit, integration, and useful trying out; exhibit how integrating with exterior platforms applies to the Scala global and what its merits are.

From studying the Scala syntax interactively to writing glossy, scalable, reactive purposes, this e-book may help you to take your abilities to the following point through fixing advanced difficulties in a concise and maintainable way.

Show description

Quick preview of Scala for Java Developers PDF

Similar Java books

Mastering Lambdas: Java Programming in a Multicore World (Oracle Press)

The Definitive advisor to Lambda Expressions gaining knowledge of Lambdas: Java Programming in a Multicore international describes how the lambda-related good points of Java SE eight will allow Java to satisfy the demanding situations of next-generation parallel architectures. The ebook explains the best way to write lambdas, and the way to exploit them in streams and in assortment processing, offering code examples all through.

Mastering JavaFX 8 Controls (Oracle Press)

Layout and installation High-Performance JavaFX Controls bring state of the art purposes with visually lovely UIs. getting to know JavaFX eight Controls presents transparent directions, distinctive examples, and ready-to-use code samples. the right way to paintings with the most recent JavaFX APIs, configure UI parts, instantly generate FXML, construct state of the art controls, and successfully practice CSS styling.

Data Abstraction and Problem Solving with Java: Walls and Mirrors (3rd Edition)

The 3rd variation of facts Abstraction and challenge fixing with Java: partitions and Mirrors employs the analogies of partitions (data abstraction) and Mirrors (recursion) to coach Java programming layout strategies, in a manner that starting scholars locate available. The e-book has a student-friendly pedagogical technique that rigorously bills for the strengths and weaknesses of the Java language.

Java Software Solutions: Foundations of Program Design (7th Edition)

Java software program recommendations teaches a origin of programming strategies to foster well-designed object-oriented software program. Heralded for its integration of small and big life like examples, this world wide best-selling textual content emphasizes development reliable problem-solving and layout abilities to jot down top of the range courses.

Additional resources for Scala for Java Developers

Show sample text content

Scala dossier situated at samplecrud\app\controllers, and its corresponding view present in index. scala. html less than samplecrud\app\views. in basic terms routes are outlined within the routes dossier less than samplecrud\conf: [ a hundred forty five ] Database entry and the way forward for ORM # domestic web page GET / controllers. software. index # CRUD motion GET /crud controllers. program. generateAll the 1st path will demonstrate a kind within the browser the place we will be able to input information regarding the database from which we wish to create a Play app. the shape within reason undemanding to appreciate via its template: @(dbForm: Form[(String,String,String,String)]) @import helper. _ @main(title = "The 'CRUD generator' application") {

Enter information approximately your current database:

@form(action = routes. program. generateAll, args = 'id -> "dbform") { @select( box = dbForm("driver"), concepts = techniques( "com. mysql. jdbc. motive force" -> "MySQL", "org. postgresql. driving force" -> "PostgreSQL", "org. h2. driving force" -> "H2", "org. apache. derby. jdbc. ClientDriver" -> "Derby" ), args = '_label -> "Choose a DB" ) @inputText( box = dbForm("dburl"), args = '_label -> "Database url", 'placeholder -> "jdbc:mysql://localhost:3306/slick" ) @inputText( box = dbForm("username"), args = '_label -> "DB username", 'size -> 10, 'placeholder -> "root" ) @inputText( box = dbForm("password"), args = '_label -> "DB password", 'size -> 10, 'placeholder -> "root" ) [ 146 ] Chapter 6

} } the second one is the generateAll motion played after we put up the shape that would create all documents had to execute the newly created Play app. with a view to generate all documents within the correct position, we simply have to edit one configuration estate referred to as baseDirectory, presently present in the Config. scala dossier within the utilities/ folder. This estate specifies the foundation listing of the Play program we wish to generate. ahead of we edit it, we will generate a clean Play venture that the baseDirectory variable will consult with: > cd ~/projects/internal (or any situation of your selection) > play new samplecrud … what's the program identify? [samplecrud] > [ENTER] Which template do you need to exploit for this new software? 1 - Create an easy Scala program 2 - Create an easy Java software > [Press 1] simply to determine we now have our clean Play program properly created we will be able to release it with: > cd samplecrud > play run Now, open the http://localhost:9000 URL in an internet browser. Now that we have got our baseDirectory (~/projects/internal/samplecrud), we will be able to upload it to the Config. scala dossier. the opposite houses in regards to the database are only default values; we don't have to edit them right here when you consider that we are going to in its place specify them after we fill out the HTML shape whereas operating the playcrud app. In a brand new terminal window, let's execute the playcrud app by way of coming into the subsequent instructions: > cd > play "run 9020" (or the other port than 9000) [ 147 ] Database entry and the way forward for ORM the following, we have to select a special port than 9000 because it is already taken by way of the clean software.

Download PDF sample

Rated 4.03 of 5 – based on 7 votes