Synopses & Reviews
Learn how to be more productive with Scala, a new multi-paradigm language for the Java Virtual Machine (JVM) that integrates features of both object-oriented and functional programming. With this book, you'll discover why Scala is ideal for highly scalable, component-based applications that support concurrency and distribution.
Programming Scala clearly explains the advantages of Scala as a JVM language. You'll learn how to leverage the wealth of Java class libraries to meet the practical needs of enterprise and Internet projects more easily. Packed with code examples, this book provides useful information on Scala's command-line tools, third-party tools, libraries, and available language-aware plugins for editors and IDEs.
- Learn how Scala's succinct and flexible code helps you program faster
- Discover the notable improvements Scala offers over Java's object model
- Get a concise overview of functional programming, and learn how Scala's support for it offers a better approach to concurrency
- Know how to use mixin composition with traits, pattern matching, concurrency with Actors, and other essential features
- Take advantage of Scala's built-in support for XML
- Learn how to develop domain-specific languages
- Understand the basics for designing test-driven Scala applications
Fastest way for programmers to be productive with this exciting new "multi-paradigm" language, with combines object-oriented and functional programming. Programming Scala introduces a new language for the Java Virtual Machine that offers all the benefits of a modern object model, functional programming, and an advanced type system. Packed with code examples, this comprehensive book teaches programmers how to be productive with Scala quickly, and explains what makes this language ideal for today's highly scalable, component-based applications that support concurrency and distribution.
About the Author
'Dean Wampler is a Consultant, Trainer, and Mentor with Object Mentor, Inc. He specializes in Scala, Java, and Ruby. He works with clients on application design strategies that combine object-oriented programming, functional programming, and aspect-oriented programming. He also consults on Agile methods, like Lean and XP. Dean is a frequent speaker at industry and academic conferences on these topics. He has a Ph.D. in Physics from the University of Washington.Alex Payne currently works for Twitter, Inc., a communications service that allows users to send short one-to-many messages via a variety of media. His title at Twitter is API Lead; his daily work is growing and supporting a collection of services on which other developers can build. Alex has been working at Twitter since the beginning of 2007, several months before the service began to grow in popularity. Before working at Twitter, Alex worked in information security, helped build web applications for political campaigns and non-profits, and more. In his free time, Alex studies the history, present use, and evolution of programming languages, as well as minimalist art and design. Alex lives and works in San Francisco, where he engages in an endless search for the perfect cocktail and cup of coffee.'
Table of Contents
Dedication; Foreword; Preface; Welcome to Programming Scala; Conventions Used in This Book; Using Code Examples; Safari® Books Online; How to Contact Us; Acknowledgments; Chapter 1: Zero to Sixty: Introducing Scala; 1.1 Why Scala?; 1.2 Installing Scala; 1.3 For More Information; 1.4 A Taste of Scala; 1.5 A Taste of Concurrency; 1.6 Recap and What's Next; Chapter 2: Type Less, Do More; 2.1 In This Chapter; 2.2 Semicolons; 2.3 Variable Declarations; 2.4 Method Declarations; 2.5 Inferring Type Information; 2.6 Literals; 2.7 Tuples; 2.8 Option, Some, and None: Avoiding nulls; 2.9 Organizing Code in Files and Namespaces; 2.10 Importing Types and Their Members; 2.11 Abstract Types And Parameterized Types; 2.12 Reserved Words; 2.13 Recap and What's Next; Chapter 3: Rounding Out the Essentials; 3.1 Operator? Operator?; 3.2 Methods Without Parentheses and Dots; 3.3 Domain-Specific Languages; 3.4 Scala if Statements; 3.5 Scala for Comprehensions; 3.6 Other Looping Constructs; 3.7 Conditional Operators; 3.8 Pattern Matching; 3.9 Enumerations; 3.10 Recap and What's Next; Chapter 4: Traits; 4.1 Introducing Traits; 4.2 Stackable Traits; 4.3 Constructing Traits; 4.4 Recap and What's Next; Chapter 5: Basic Object-Oriented Programming in Scala; 5.1 Class and Object Basics; 5.2 Parent Classes; 5.3 Constructors in Scala; 5.4 Nested Classes; 5.5 Visibility Rules; 5.6 Recap and What's Next; Chapter 6: Advanced Object-Oriented Programming In Scala; 6.1 Overriding Members of Classes and Traits; 6.2 Companion Objects; 6.3 Case Classes; 6.4 Equality of Objects; 6.5 Recap and What's Next; Chapter 7: The Scala Object System; 7.1 The Predef Object; 7.2 Classes and Objects: Where Are the Statics?; 7.3 Sealed Class Hierarchies; 7.4 The Scala Type Hierarchy; 7.5 Linearization of an Object's Hierarchy; 7.6 Recap and What's Next; Chapter 8: Functional Programming in Scala; 8.1 What Is Functional Programming?; 8.2 Functional Programming in Scala; 8.3 Recursion; 8.4 Tail Calls and Tail-Call Optimization; 8.5 Functional Data Structures; 8.6 Traversing, Mapping, Filtering, Folding, and Reducing; 8.7 Pattern Matching; 8.8 Partial Functions; 8.9 Currying; 8.10 Implicits; 8.11 Implicit Function Parameters; 8.12 Call by Name, Call by Value; 8.13 Lazy Vals; 8.14 Recap: Functional Component Abstractions; Chapter 9: Robust, Scalable Concurrency with Actors; 9.1 The Problems of Shared, Synchronized State; 9.2 Actors; 9.3 Actors in Scala; 9.4 Traditional Concurrency in Scala: Threading and Events; 9.5 Recap and What's Next; Chapter 10: Herding XML in Scala; 10.1 Reading XML; 10.2 Writing XML; 10.3 Recap and What's Next; Chapter 11: Domain-Specific Languages in Scala; 11.1 Internal DSLs; 11.2 External DSLs with Parser Combinators; 11.3 Recap and What's Next; Chapter 12: The Scala Type System; 12.1 Reflecting on Types; 12.2 Understanding Parameterized Types; 12.3 Variance Under Inheritance; 12.4 Type Bounds; 12.5 Nothing and Null; 12.6 Understanding Abstract Types; 12.7 Path-Dependent Types; 12.8 Value Types; 12.9 Self-Type Annotations; 12.10 Structural Types; 12.11 Existential Types; 12.12 Infinite Data Structures and Laziness; 12.13 Recap and What's Next; Chapter 13: Application Design; 13.1 Annotations; 13.2 Enumerations Versus Pattern Matching; 13.3 Thoughts On Annotations and Enumerations; 13.4 Using Nulls Versus Options; 13.5 Exceptions and the Alternatives; 13.6 Scalable Abstractions; 13.7 Effective Design of Traits; 13.8 Design Patterns; 13.9 Better Design with Design By Contract; 13.10 Recap and What's Next; Chapter 14: Scala Tools, Libraries, and IDE Support; 14.1 Command-Line Tools; 14.2 Build Tools; 14.3 Integration with IDEs; 14.4 Test-Driven Development in Scala; 14.5 Other Notable Scala Libraries and Tools; 14.6 Java Interoperability; 14.7 Java Library Interoperability; 14.8 Recap and What's Next; References; Glossary; Colophon;