Scala for Java Developers
Scala for Java Developers

Retired

This book is no longer available for sale.

Scala for Java Developers

This book is 100% complete

Completed on 2017-11-24

About the Book

Scala is a concise, statically typed scripting language that runs on the Java Virtual Machine. It is both a functional programming language and object-oriented language but its emphasis on functional programming sets it apart from Java.

Learn Scala: A Practical Primer for Java Developers is for Java developers looking to transition to programming Scala. The book will help you translate the Java you already know into Scala and kick-start your productivity.

What's Inside

  • Tour Scala and learn the basic syntax, constructs and how to use the REPL
  • Translate Java syntax that you already know into Scala
  • Learn what Scala offers over and above Java, functional programming concepts and idioms
  • Tips and advice useful when transitioning existing Java projects to Scala

Paperback now available on Amazon.

About the Author

Toby Weston
Toby Weston

Toby is an independent consultant based in London. He specialises in agile enablement, training and modern software development.

http://baddotrobot.com

Table of Contents

  •  
    • Prologue
    • Preface
  • I. Scala Tour
    • The Scala Language
      • As a Functional Programming Language
      • The Past
      • The Future
    • Installing Scala
      • The Scala Interpreter
      • Scala Scripts
      • scalac
    • Some Basic Syntax
      • Defining Values and Variables
      • Defining Functions
      • Operator Overloading and Infix Notation
      • Collections
      • Tuples
      • Java Interoperability
      • Primitive Types
    • Scala’s Class Hierarchy
      • AnyVal
      • Unit
      • AnyRef
      • Bottom Types
    • ScalaDoc
    • Language Features
      • Working with Source Code
      • Working with Methods
      • Functional Programming
    • Summary
  • II. Key Syntactical Differences
    • Classes and Fields
      • Creating Classes
      • Derived Setters and Getters
      • Redefining Setters and Getters
      • Summary
    • Classes and Objects
      • Classes Without Constructor Arguments
      • Additional Constructors
      • Singleton Objects
      • Companion Objects
    • Classes and Functions
      • Anonymous Functions
      • Anonymous Classes
      • First-class Functions
      • Function Types
      • Functions vs. Methods
      • Lambdas vs. Closures
    • Inheritance
      • Subtype Inheritance
      • Anonymous Classes
      • Interfaces / Traits
      • Abstract Classes
      • Polymorphism
      • Deciding Between the Options
    • Control Structures
      • Conditionals
      • Looping Structures: do, while and for
      • Breaking Control Flow (break and continue)
      • Exceptions
    • Generics
      • Parametric Polymorphism
      • Bounded Classes
      • Variance
  • III. Beyond Java to Scala
    • Faking Function Calls
      • The apply Method
      • The update Method
      • Summary
    • Faking Language Constructs
      • Curly Braces (and Function Literals)
      • Currying
      • Summary
    • Pattern Matching
      • Switching
      • Patterns
      • Literal Matches
      • Constructor Matches
      • Type Query
      • Deconstruction Matches and unapply
      • Guard Conditions
    • Map and FlatMap
      • Mapping Functions
      • FlatMap
      • Not Just for Collections
    • Monads
      • Basic Definition
      • Option
      • More Formal Definition
      • Summary
    • For Comprehensions
      • Where We Left Off
      • Using Null Checks
      • Using flatMap with Option
      • How For Comprehensions Work
      • Finally, Using a For Comprehension for Shipping Labels
      • Summary
  • IV. Adopting Scala in Java Teams
    • Adopting Scala
      • Avoid Not Enough
      • Don’t Do Too Much
      • Purely Functional FTW?
    • What to Expect
      • The Learning Curve
      • The Learning Continuum
    • Tips
      • Be Clear
      • Get Guidance
      • Have a Plan
    • Convert Your Codebase
    • Manage Your Codebase
      • Conventions
      • What to Avoid
      • Other Challenges
  • Appendices
    • Code Listings
      • Inheritance
      • Generics
      • Pattern Matching
      • Map
    • Syntax Cheat Sheet
    • Index
  • Notes

Authors have earned$9,206,032writing, publishing and selling on Leanpub,
earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub