Pollak | Beginning Scala | E-Book | www.sack.de
E-Book

E-Book, Englisch, 350 Seiten

Pollak Beginning Scala


1. ed
ISBN: 978-1-4302-1990-3
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark

E-Book, Englisch, 350 Seiten

ISBN: 978-1-4302-1990-3
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark



The open source Scala language is a Java-based dynamic scripting, functional programming language. Moreover, this highly scalable scripting language lends itself well to building cloud-based/deliverable Software as a Service (SaaS) online applications. Written by Lift Scala web framework founder and lead Dave Pollak, Beginning Scala takes a down-to-earth approach to teaching Scala that leads you through simple examples that can be combined to build complex, scalable systems and applications. This book introduces you to the Scala programming language and then guides you through Scala constructs and libraries that allow small and large teams to assemble small components into high-performance, scalable systems. You will learn why Scala is becoming the language of choice for Web 2.0 companies such as Twitter as well as enterprises such as Seimens and SAP.

David Pollak has been writing commercial software since 1977. He wrote the award-winning Mesa spreadsheet, which in 1992 was the first real-time spreadsheet. Wall Street companies traded billions of dollars a day through Mesa. In 1996, David sold his company to CMP Media and became CTO of CMP Media's NetGuide Live and was one of the first large-scale users of Java and WebLogic to power an Internet site. In 1998, David released Integer, the world's first browser-accessible, multiuser spreadsheet. Since 2000, David has been consulting for companies including Hewlett-Packard, Pretzel Logic/WebGain, BankServ, Twitter, and SAP. David has been using Scala since 2006 and is the lead developer of the Lift Web framework.

Pollak Beginning Scala jetzt bestellen!

Autoren/Hrsg.


Weitere Infos & Material


1;Contents at a Glance;5
2;Table of Contents;6
3;Foreword;12
4;About the Author;13
5;About the Technical Reviewer;14
6;Acknowledgments;15
7;Introduction;16
7.1;Who This Book Is For;16
7.2;How This Book Is Structured;17
7.3;Prerequisites;17
7.4;Downloading the Code;17
7.5;Contacting the Author;17
8;CHAPTER 1 About Scala and How to Install It;18
8.1;Scala: A Great Language for the Java Virtual Machine;18
8.1.1;Beyond Java;19
8.1.2;Finding Scala;20
8.2;Scala’s History;22
8.3;Installing Scala;23
8.3.1;Installing on Windows;23
8.3.2;Installing on Mac OS X and Linux;25
8.4;The Scala Community;25
8.5;Summary;27
9;CHAPTER 2 Scala Syntax, Scripts, and Your First Scala Programs;28
9.1;Scala at the Command Line and Scala Scripts;28
9.1.1;Interactive Scala;28
9.1.2;Scala Scripts;30
9.1.3;Compiling Scala Programs;30
9.2;Your First Scala Programs;31
9.2.1;Hello World;31
9.2.2;Printing Some Numbers;32
9.2.3;Adding Things Up;32
9.2.3.1;Importing Stuff;33
9.2.3.2;Parsing a String to an Int;33
9.2.3.3;Summing Things Up;35
9.2.3.4;Program Body;36
9.3;Basic Scala Syntax;37
9.3.1;Number, String, and XML Constants;37
9.3.2;package;38
9.3.3;import;38
9.3.4;Class, Trait, and Object Definition;39
9.3.5;Scala’s Class Hierarchy;44
9.3.6;Method Declaration;45
9.3.7;Variable Declaration;47
9.3.8;Code Blocks;48
9.3.9;Call-by-Name;48
9.3.10;Method Invocation;50
9.3.11;Functions, apply, update, and Compiler Magic;51
9.3.12;Case Classes;53
9.3.13;Basic Pattern Matching;55
9.3.14;if/else and while;57
9.3.15;The for comprehension;58
9.3.16;throw, try/catch/finally, and synchronized;60
9.3.17;Comments;62
9.4;Scala vs. Java vs. Ruby;62
9.4.1;Classes and Instances;62
9.4.2;Traits, Interfaces, and Mixins;63
9.4.3;Object, Static, and Singletons;64
9.4.4;Functions, Anonymous Inner Classes, and Lambdas/Procs;64
9.5;Summary;65
10;CHAPTER 3 Collections and the Joy of Immutability;66
10.1;Thinking Immutably;66
10.2;Scala List, Tuple, Option, and Map Classes;68
10.2.1;List[T];70
10.2.1.1;Getting Functional;72
10.2.1.2;Contrast with Java;73
10.2.1.3;Transformation;75
10.2.1.4;Transformation vs. Mutation;77
10.2.1.5;Reduxio;78
10.2.1.6;Look Ma, No Loops;81
10.2.2;Tuples;83
10.2.3;Map[K, V];84
10.2.4;Option[T];89
10.2.5;Wrapping Up List, Tuple, Map, and Option;91
10.3;XML Creation and Manipulation;92
10.3.1;XML in Your Scala Code;92
10.3.2;Parsing XML;98
10.3.3;Modifying XML;101
10.4;Concurrency Without Synchronization;104
10.5;Summary;109
11;CHAPTER 4 Fun with Functions, and Never Having to Close That JDBC Connection;110
11.1;A Function Is an Instance;110
11.1.1;Passing Functions As Parameters;111
11.1.2;Partial Application and Functions;114
11.1.3;Functions and Type Parameters;116
11.1.4;Functions Bound to Variables in Scope;117
11.1.5;Putting Functions in Containers;120
11.1.6;Functions and Interactive Applications;121
11.1.7;Building New Functions;122
11.2;Call-by-Name, Call-by-Value, and General Laziness;124
11.3;Build Your Own Control Structures;126
11.3.1;JDBC Looping;128
11.4;Summary;130
12;CHAPTER 5 Pattern Matching;131
12.1;Basic Pattern Matching;131
12.1.1;Matching Any Type;133
12.1.2;More Pattern Matching;135
12.1.3;Testing Data Types;135
12.1.4;Case Classes;136
12.1.5;Pattern Matching in Lists;139
12.1.6;Pattern Matching and Lists;140
12.1.7;Nested Pattern Matching in Case Classes;142
12.1.8;Examining the Internals of Pattern Matching;144
12.2;Pattern Matching As Functions;145
12.3;Object-Oriented and Functional Tensions;147
12.3.1;Shape Abstractions;148
12.4;Summary;152
13;CHAPTER 6 Actors and Concurrency;153
13.1;A Different Approach to Concurrency: Look Ma, No Locks;153
13.2;Defining an Actor;154
13.2.1;Defining an Actor;155
13.2.2;Would You Like State With That?;156
13.2.3;Instantiating an Actor;157
13.3;Implementing a Listener;158
13.3.1;As an Actor;160
13.4;Actors: More Than Write-Only;164
13.5;Beyond the Basics;165
13.5.1;Protocol Handler;165
13.5.2;Actors, Atomic Updates, and Transactions;169
13.5.2.1;Performing an Atomic Update;169
13.5.2.2;Performing Transactions;171
13.5.2.3;Testing the Transactional Actor;177
13.5.3;Composing Actors;180
13.6;Summary;185
14;CHAPTER 7 Traits and Types and Gnarly Stuff for Architects;187
14.1;Show Me Some Bad Java Code;188
14.2;Library Pimping, Implicit Conversions, and Vampires;189
14.2.1;Library Pimping³;191
14.2.2;Inviting Vampires Into Your Code;196
14.3;Traits: Interfaces on Steroids;197
14.3.1;Traits and Class Hierarchies;200
14.4;Types—It’s Beyond Generic;206
14.4.1;Table Code;207
14.4.2;The Column;213
14.4.3;The Table;213
14.4.4;Concrete Columns;214
14.4.5;Building a Query;216
14.4.6;Making Queries Type-Safe;217
14.4.7;Boilerplate;219
14.4.8;Vending JDBC Connections;221
14.4.9;Making a Concrete Class That Implements Table;221
14.4.10;Type-Safe Fun;222
14.5;Variance;223
14.5.1;Invariant Parameter Types;224
14.5.2;Covariant Parameter Types;226
14.5.3;Contravariant Parameter Types;227
14.5.4;Rules of Variance;229
14.6;Poignantly Killing Bunnies: Dwemthy’s Stairs;230
14.6.1;The Immutable World;230
14.6.2;The Code;231
14.6.3;Walking Through the Code;236
14.7;Summary;247
15;CHAPTER 8 Parsers—Because BNF Is Not Just for Academics Anymore;249
15.1;Higher-Order Functions and Combinators;249
15.1.1;Higher-Order Functions;250
15.1.2;Combinators;251
15.2;The Calculator Parser;253
15.3;JSON Parsing;258
15.4;Twitter JSON Parsing;268
15.4.1;Utilities;269
15.4.2;Parsing the JSON;271
15.5;Summary;277
16;CHAPTER 9 Scaling Your Team;278
16.1;Testing: Behavior-Driven Development;278
16.1.1;Specs;279
16.1.2;Scala Test;280
16.2;Build Tools;281
16.2.1;Maven;281
16.2.2;Ant;284
16.2.3;Buildr;286
16.2.4;Other Build Tools;286
16.3;Team Structure;287
16.3.1;Bringing New Team Members on Board;287
16.3.2;Organizing Teams Around Scala;288
16.4;Best Practices;289
16.4.1;Options Instead of Null Testing;289
16.4.2;Focus on Immutability;290
16.4.3;Keep Methods Short;291
16.4.4;Refactor Mercilessly;292
16.4.5;Compose Functions and Compose Classes;293
16.5;Selling Scala in Your Organization;294
16.5.1;The Super-Soft Sell;294
16.5.2;The Back-Office Project;295
16.5.3;The Big Sell;295
16.5.3.1;Addressing the Potential Risks of Scala;296
16.5.4;My Direct Experience (YMMV);297
16.5.5;Selecting Team Members;297
16.5.6;Yeah, But How Compatible?;298
16.5.7;A Tad Bit of History;299
16.5.8;Present-Day Compatibility;300
16.5.9;Popping the Stack to the CEO or Board;300
16.5.10;Why Is Scala Different?;301
16.5.11;Anything You Can Do, I Can Do Better (in Scala);302
16.5.12;Giving Scala a Lift;303
16.5.13;How Lift’s Comet Support Works;304
16.5.14;Summary;305
17;INDEX;306



Ihre Fragen, Wünsche oder Anmerkungen
Vorname*
Nachname*
Ihre E-Mail-Adresse*
Kundennr.
Ihre Nachricht*
Lediglich mit * gekennzeichnete Felder sind Pflichtfelder.
Wenn Sie die im Kontaktformular eingegebenen Daten durch Klick auf den nachfolgenden Button übersenden, erklären Sie sich damit einverstanden, dass wir Ihr Angaben für die Beantwortung Ihrer Anfrage verwenden. Selbstverständlich werden Ihre Daten vertraulich behandelt und nicht an Dritte weitergegeben. Sie können der Verwendung Ihrer Daten jederzeit widersprechen. Das Datenhandling bei Sack Fachmedien erklären wir Ihnen in unserer Datenschutzerklärung.