Muutke küpsiste eelistusi

Beginner's Guide to Scala, Object Orientation and Functional Programming Second Edition 2018 [Pehme köide]

  • Formaat: Paperback / softback, 531 pages, kõrgus x laius: 235x155 mm, kaal: 8248 g, XIX, 531 p., 1 Paperback / softback
  • Ilmumisaeg: 12-Mar-2018
  • Kirjastus: Springer International Publishing AG
  • ISBN-10: 3319757709
  • ISBN-13: 9783319757704
  • Pehme köide
  • Hind: 51,29 €*
  • * hind on lõplik, st. muud allahindlused enam ei rakendu
  • Tavahind: 68,39 €
  • Säästad 25%
  • Raamatu kohalejõudmiseks kirjastusest kulub orienteeruvalt 3-4 nädalat
  • Kogus:
  • Lisa ostukorvi
  • Tasuta tarne
  • Tellimisaeg 2-4 nädalat
  • Lisa soovinimekirja
  • Formaat: Paperback / softback, 531 pages, kõrgus x laius: 235x155 mm, kaal: 8248 g, XIX, 531 p., 1 Paperback / softback
  • Ilmumisaeg: 12-Mar-2018
  • Kirjastus: Springer International Publishing AG
  • ISBN-10: 3319757709
  • ISBN-13: 9783319757704
Scala is now an established programming language developed by Martin Oderskey and his team at the EPFL. The name Scala is derived from Sca(lable) La(nguage). Scala is a multi-paradigm language, incorporating object oriented approaches with functional programming. 





Although some familiarity with standard computing concepts is assumed (such as the idea of compiling a program and executing this compiled from etc.) and with basic procedural language concepts (such as variables and allocation of values to these variables) the early chapters of the book do not assume any familiarity with object orientation nor with functional programming These chapters also step through other concepts with which the reader may not be familiar (such as list processing). 





From this background, the book provides a practical introduction to both object and functional approaches using Scala. These concepts are introduced through practical experience taking the reader beyondthe level of the language syntax to the philosophy and practice of object oriented development and functional programming. 





Students and those actively involved in the software industry will find this comprehensive introduction to Scala invaluable.
1 Introduction
1(6)
1.1 Introduction
1(1)
1.2 What Is Scala?
1(1)
1.3 Why Scala?
2(1)
1.4 Java to Scala Quick Comparison
3(2)
1.5 Scala Versions
5(1)
1.6 Is This Book for You?
5(1)
1.7 Approach Taken by This Book
5(2)
2 Elements of Object Orientation
7(8)
2.1 Introduction
7(1)
2.2 Terminology
7(2)
2.3 Types of Hierarchy
9(3)
2.4 The Move to Object Technology
12(1)
2.5 Summary
12(1)
2.6 Exercises
13(1)
2.7 Further Reading
13(2)
3 Why Object Orientation?
15(6)
3.1 Introduction
15(1)
3.2 The Procedural Approach
15(2)
3.2.1 A Naked Data Structure
16(1)
3.2.2 Procedures for the Data Structure
16(1)
3.2.3 Packages
17(1)
3.3 Does Object Orientation Do Better?
17(3)
3.3.1 Packages Versus Classes
17(2)
3.3.2 Inheritance
19(1)
3.4 Summary
20(1)
4 Constructing an Object-Oriented System
21(14)
4.1 Introduction
21(1)
4.2 The Application: Windscreen Wipe Simulation
21(1)
4.3 Where Do We Start?
22(1)
4.4 Identifying the Objects
23(1)
4.5 Identifying the Services or Methods
24(2)
4.6 Refining the Objects
26(1)
4.7 Bringing It All Together
26(3)
4.8 Where Is the Structure?
29(2)
4.9 Summary
31(1)
4.10 Exercises
31(1)
4.11 Further Reading
32(3)
References
33(2)
5 Functional Programming
35(6)
5.1 Introduction
35(1)
5.2 What Is Functional Programming?
35(2)
5.3 Advantages to Functional Programming
37(2)
5.4 Disadvantages of Functional Programming
39(1)
5.5 Scala and Functional Programming
40(1)
6 Scala Background
41(6)
6.1 Introduction
41(1)
6.2 The Class Person
41(2)
6.3 Functional Programming
43(1)
6.4 A Hybrid Language
44(3)
7 A Little Scala
47(18)
7.1 Introduction
47(1)
7.2 The Scala Environment
47(1)
7.3 The Scala Shell
48(1)
7.4 The Scala IDE
49(7)
7.4.1 Creating an IntelliJ Project
52(1)
7.4.2 Inside IntelliJ
53(1)
7.4.3 Creating a Module
53(3)
7.5 Implementing the Object
56(1)
7.6 Running the Application
56(2)
7.6.1 Scala Interpreter Console
57(1)
7.7 Scala Classpath
58(1)
7.8 Compiling and Executing Scala
58(2)
7.9 Memory Management
60(5)
7.9.1 Why Have Automatic Memory Management?
60(1)
7.9.2 Memory Management in Scala
61(1)
7.9.3 When Is Garbage Collection Performed?
61(1)
7.9.4 Checking the Available Memory
61(4)
8 Scala Building Blocks
65(4)
8.1 Introduction
65(1)
8.2 Apps and Applications
65(2)
8.3 The Basics of the Language
67(2)
8.3.1 Some Terminology
67(1)
8.3.2 The Message Passing Mechanism
68(1)
8.3.3 The Statement Terminator
68(1)
9 Scala Classes
69(18)
9.1 Introduction
69(1)
9.2 Classes
69(13)
9.2.1 Class Definitions
69(1)
9.2.2 Developing a Class Definition
70(2)
9.2.3 Classes and Messages
72(1)
9.2.4 Instances and Instance Variables
72(1)
9.2.5 Classes and Inheritance
73(3)
9.2.6 Instance Creation
76(1)
9.2.7 Constructors
77(2)
9.2.8 Auxiliary Constructors
79(1)
9.2.9 Class Initialisation Behaviour
80(1)
9.2.10 Review of Classes and Constructors
81(1)
9.3 Case Classes
82(5)
9.3.1 A Sample Class
83(4)
10 Scala Methods
87(16)
10.1 Introduction
87(1)
10.2 Method Definitions
87(13)
10.2.1 Method Parameters
89(2)
10.2.2 Comments
91(2)
10.2.3 The Local Variables Section
93(1)
10.2.4 The Statements Section
94(1)
10.2.5 The Return Operator
94(1)
10.2.6 An Example Method
95(1)
10.2.7 Overriding toString
96(2)
10.2.8 Defining Property Methods
98(2)
10.3 Named Parameters
100(3)
11 Packages and Encapsulation
103(18)
11.1 Introduction
103(1)
11.2 Packages
103(9)
11.2.1 Declaring a Package
104(1)
11.2.2 Additional Package Definitions Options
104(5)
11.2.3 An Example Package
109(1)
11.2.4 Accessing Package Elements
110(1)
11.2.5 An Example of Using a Package
111(1)
11.3 Import Options
112(1)
11.4 Additional Import Features
113(1)
11.5 Package Objects
114(1)
11.6 Key Scala Packages
115(1)
11.7 Default Imports
115(1)
11.8 Encapsulation
116(5)
11.8.1 Scala Visibility Modifiers
116(1)
11.8.2 Private Modified
117(1)
11.8.3 Protected Modifier
118(3)
12 Building a Class
121(10)
12.1 Introduction
121(1)
12.2 Create a New Module
121(2)
12.3 Create a New Package
123(1)
12.4 Create a New Class
124(1)
12.5 Defining the Class
125(1)
12.6 Adding Behaviour
126(1)
12.7 Test Application
126(2)
12.8 Override Tostring
128(2)
12.9 Extras
130(1)
13 Classes, Inheritance and Abstraction
131(16)
13.1 Introduction
131(1)
13.1.1 What Are Classes for?
131(1)
13.2 Inheritance Between Types
132(1)
13.3 Inheritance Between Classes
133(5)
13.3.1 The Role of a Subclass
134(1)
13.3.2 Capabilities of Classes
135(1)
13.3.3 Overriding Behaviour
136(1)
13.3.4 Protected Members
137(1)
13.4 Restricting a Subclass
138(1)
13.5 Abstract Classes
139(3)
13.6 The Super Keyword
142(1)
13.7 Scala Type Hierarchy
143(1)
13.8 Polymorphism
144(3)
14 Objects and Instances
147(8)
14.1 Introduction
147(1)
14.2 Singleton Objects
147(2)
14.3 Companion Objects
149(6)
14.3.1 Companion Object Behaviour
151(1)
14.3.2 A Object or an Instance
152(3)
15 Value Classes
155(4)
15.1 Introduction
155(1)
15.2 Value Classes
155(1)
15.3 Simple Value Type Example
156(1)
15.4 Additional Value Class Concepts
157(1)
15.5 Negating Value Classes
158(1)
16 Scala Constructs
159(12)
16.1 Introduction
159(1)
16.2 Numbers and Numeric Operators
159(2)
16.2.1 Numeric Values
159(1)
16.2.2 Arithmetic Operators
160(1)
16.3 Characters and Strings
161(1)
16.3.1 Characters
161(1)
16.3.2 Strings
161(1)
16.4 Assignments
162(2)
16.5 Variables
164(4)
16.5.1 Temporary Variables
164(1)
16.5.2 Pseudo-Variables
165(1)
16.5.3 Variable Scope
165(1)
16.5.4 Option, Some and None
165(2)
16.5.5 Boolean Values
167(1)
16.5.6 Literals
167(1)
16.6 Messages and Message Selectors
168(1)
16.6.1 Invoking Methods
168(1)
16.6.2 Precedence
168(1)
16.7 Summary
169(2)
17 Control and Iteration
171(16)
17.1 Introduction
171(1)
17.2 Control Structures
171(3)
17.2.1 The if Statement
171(2)
17.2.2 If Returns a Value
173(1)
17.3 Iteration
174(6)
17.3.1 For Loops
174(1)
17.3.2 For Until
175(1)
17.3.3 For Loop with a Filter
175(1)
17.3.4 Longhand for Loop
176(1)
17.3.5 For-Yield Loop
176(1)
17.3.6 While Loops
177(1)
17.3.7 Do Loops
178(1)
17.3.8 An Example of Loops
179(1)
17.4 Equality
180(1)
17.5 Recursion
180(7)
17.5.1 The Match Expression
183(4)
18 Traits
187(12)
18.1 Introduction
187(1)
18.2 What Are Traits?
187(2)
18.3 Defining a Trait
189(1)
18.4 Using a Trait
190(3)
18.5 Abstract Trait Members
193(1)
18.6 Dynamic Binding of Traits
193(2)
18.7 Sealed Traits
195(1)
18.8 Marker Traits
195(1)
18.9 Trait Dependencies
196(2)
18.10 To Trait or not to Trait
198(1)
19 Further Traits
199(12)
19.1 Introduction
199(1)
19.2 Stackable Modifications
199(5)
19.3 Fat Versus Thin Traits
204(1)
19.4 Universal Traits
205(2)
19.5 Traits for a Data Type
207(1)
19.6 Single Abstract Method (SAM) Traits
208(3)
20 Arrays
211(12)
20.1 Introduction
211(1)
20.2 Arrays
211(6)
20.2.1 Arrays of Objects
213(2)
20.2.2 Ragged Arrays
215(2)
20.3 Creating Square Arrays
217(1)
20.4 Looping Through Arrays
218(1)
20.5 The Main Method Revisited
219(4)
21 Tuples
223(6)
21.1 Introduction
223(1)
21.2 Tuples
223(1)
21.3 Tuple Characteristics
224(1)
21.4 Tuple Classes
224(1)
21.5 Creating a Tuple
224(1)
21.6 Working with Tuples
225(1)
21.7 Iterating Over a Tuple
226(1)
21.8 Element Extraction
227(2)
22 Functional Programming in Scala
229(12)
22.1 Introduction
229(1)
22.2 Scala as a Functional Language
229(1)
22.3 Defining Scala Functions
230(3)
22.4 Class, Objects, Methods and Functions
233(2)
22.5 Lifting a Method
235(1)
22.6 Single Abstract Method Traits
235(2)
22.7 Closure
237(2)
22.8 Referential Transparency
239(2)
23 Higher-Order Functions
241(6)
23.1 Introduction
241(1)
23.2 Higher-Order Function Concepts
241(1)
23.3 Scala Higher-Order Functions
242(2)
23.4 Using Higher-Order Functions
244(1)
23.5 Higher-Order Functions in Scala Collections
245(2)
24 Partially Applied Functions and Currying
247(8)
24.1 Introduction
247(1)
24.2 Partially Applied Functions
248(2)
24.3 Currying
250(5)
24.3.1 Introduction to Currying
250(1)
24.3.2 Defining Multiple Parameter List Functions
250(1)
24.3.3 Using Curried Functions
251(1)
24.3.4 Building Domain-Specific Languages
252(3)
25 Scala Collections Framework
255(6)
25.1 Introduction
255(1)
25.2 What Are Collections?
255(1)
25.3 Scala Collections
256(5)
25.3.1 Package Scala Collection
258(1)
25.3.2 Common Seq Behaviour
259(1)
25.3.3 Common Set Behaviour
260(1)
25.3.4 Common Map Behaviour
260(1)
26 Immutable Lists and Maps
261(14)
26.1 Introduction
261(1)
26.2 The Immutable List Collection
261(11)
26.2.1 List Creation
261(1)
26.2.2 List Concatenation
262(2)
26.2.3 List Operations
264(1)
26.2.4 List Processing
265(1)
26.2.5 Further List Processing
265(4)
26.2.6 Pattern Matching
269(1)
26.2.7 Converting to a List
270(1)
26.2.8 Lists of User Defined Types
270(2)
26.3 The Immutable Map Type
272(3)
27 Immutable and Mutable Collection Packages
275(12)
27.1 Introduction
275(1)
27.2 Package Scala Collection Immutable
275(4)
27.2.1 Sequences
275(3)
27.2.2 Sets
278(1)
27.2.3 Maps
279(1)
27.3 Package Scala Collection Mutable
279(5)
27.3.1 ArrayBuffer
280(1)
27.3.2 ListBuffer
281(1)
27.3.3 LinkedList
282(1)
27.3.4 Stack
282(1)
27.3.5 HashMap
283(1)
27.4 Generic Collections
284(1)
27.5 Summary
285(2)
28 Type Parameterisation
287(8)
28.1 Introduction
287(1)
28.2 The Set Class
287(1)
28.3 Adding Type Parameterisation
288(4)
28.3.1 The MyQueue Mutable Class
288(2)
28.3.2 The Immutable Queue Class
290(2)
28.4 Variance
292(1)
28.5 Lower and Upper Bounds
293(1)
28.6 Combining Variance and Bounds
293(2)
29 Further Language Constructs
295(18)
29.1 Introduction
295(1)
29.2 Implicit Conversions
295(2)
29.3 Implicit Parameters
297(2)
29.4 Implicit Objects
299(2)
29.5 Implicit Classes
301(2)
29.6 Scala Annotations
303(2)
29.7 Type Declarations
305(1)
29.8 Enumerations
306(5)
29.9 Lazy Evaluation
311(2)
30 Exception Handling
313(14)
30.1 Introduction
313(1)
30.2 What Is an Exception?
313(2)
30.3 What Is Exception Handling?
315(1)
30.4 Throwing an Exception
316(1)
30.5 Catching an Exception
317(3)
30.6 Try Block Returns a Value
320(1)
30.7 Defining an Exception
321(1)
30.8 A More Functional Approach
322(3)
30.9 The Try Type
325(2)
31 Akka Actors
327(18)
31.1 Introduction
327(1)
31.2 The Actor Model
327(1)
31.3 Some Terminology
328(1)
31.4 Scala Threads
329(1)
31.5 Akka Scala Actor Library
330(2)
31.6 Concurrent Hello World
332(3)
31.7 Concurrent Actors
335(1)
31.8 The Akka Actor API
336(1)
31.9 Actor Lifecycle
337(2)
31.10 Akka Configuration
339(4)
31.11 Actor DSL
343(2)
32 Further Akka Actors
345(16)
32.1 Introduction
345(1)
32.2 Generating a Result from an Actor
345(3)
32.3 Futures
348(3)
32.4 Dispatchers
351(3)
32.5 Actor Hierarchies
354(1)
32.6 Actor Supervision
355(5)
32.7 Good Practices
360(1)
33 Scala and JDBC Database Access
361(28)
33.1 Introduction
361(1)
33.2 Why JDBC?
361(1)
33.3 What Is JDBC?
362(2)
33.4 Working with JDBC
364(1)
33.5 The Database Driver
365(1)
33.6 Registering Drivers
366(1)
33.7 Setting Up MySQL
367(1)
33.8 Setting Up the Database
368(1)
33.8.1 Starting/Stopping/Connecting to MySQL
368(1)
33.9 Creating a Database
369(3)
33.9.1 Adding a User
369(1)
33.9.2 Selecting to Work with a Database
370(1)
33.9.3 Creating a Table
370(1)
33.9.4 Adding Data to a Table
371(1)
33.10 Opening a Connection
372(2)
33.11 Inserting into a Table
374(2)
33.12 Obtaining Data from a Database
376(2)
33.13 Update an Existing Row
378(1)
33.14 Deleting from a Table
379(1)
33.15 Creating a Table
379(2)
33.16 Stored Procedures
381(1)
33.17 JDBC Data Sources
381(3)
33.18 Connection Pooling
384(2)
33.19 JDBC Metadata
386(3)
33.19.1 DatabaseMetaData
387(1)
33.19.2 ResultSetMetaData
388(1)
34 Scala Style Database Access
389(6)
34.1 Introduction
389(1)
34.2 Slick
389(1)
34.3 Querulus
390(1)
34.4 Squeryl
391(1)
34.5 O/R Broker
392(3)
35 Slick: Functional Relational Mapping for Scala
395(14)
35.1 Introduction
395(1)
35.2 Obtaining Slick
395(2)
35.3 Connecting to a Database
397(1)
35.4 Mapping Tables to Scala Types
398(2)
35.5 Table Query Interface
400(1)
35.6 Creating Tables
401(1)
35.7 Inserting Data
401(1)
35.8 Composing Database I/O Actions
402(1)
35.9 Example Setting Up a Database
402(2)
35.10 Querying for Data
404(3)
35.11 Updating, Upserting and Deleting Data
407(2)
36 Testing
409(6)
36.1 Introduction
409(1)
36.2 Types of Testing
409(1)
36.3 What Should Be Tested?
410(1)
36.4 Types of Testing
411(3)
36.4.1 Unit Testing
412(1)
36.4.2 Integration Testing
413(1)
36.4.3 System Testing
413(1)
36.4.4 Installation Testing
413(1)
36.4.5 Smoke Tests
414(1)
36.5 Automating Testing
414(1)
37 Scala Testing
415(16)
37.1 Introduction
415(1)
37.2 Scala Runtime Test Facilities
415(2)
37.2.1 Validation Checks
415(1)
37.2.2 Using Require and Assert
416(1)
37.3 Test Libraries in Scala
417(1)
37.3.1 ScalaTest
417(1)
37.3.2 Spec
417(1)
37.3.3 ScalaCheck
418(1)
37.4 Scalatest Testing Framework
418(7)
37.4.1 Setting up Your Scala Project
418(1)
37.4.2 ScalaTest and JUnit
419(5)
37.4.3 Scala Test and Functional Test Suites
424(1)
37.5 Scalatest and Feature Tests
425(2)
37.6 Test-Driven Development
427(4)
37.6.1 The TDD Cycle
427(1)
37.6.2 Test Complexity
428(1)
37.6.3 Refactoring
429(2)
38 Play Framework
431(16)
38.1 Introduction
431(1)
38.2 Introduction to Play
431(3)
38.2.1 Working with a Web Application
432(1)
38.2.2 How Play Changes the Stack
432(2)
38.3 Starting with Play
434(4)
38.3.1 Download and Install Play
434(1)
38.3.2 Using a Play Starter Project
434(2)
38.3.3 Starting the Application
436(2)
38.4 Examining the Structure of the Application
438(1)
38.5 Editing the Application
439(3)
38.5.1 Working with Your IDE
439(1)
38.5.2 Importing into IntelliJ
439(2)
38.5.3 Working with the Application
441(1)
38.6 Model-View-Controller
442(2)
38.7 Exploring the Play Application
444(3)
39 RESTful Services
447(16)
39.1 Introduction
447(1)
39.2 RESTful Services
447(1)
39.3 A RESTful API
448(1)
39.4 Creating the RESTful Web Application
449(5)
39.5 JavaScript and jQuery
454(1)
39.6 The jQuery Client
455(8)
39.6.1 Obtaining jQuery
455(1)
39.6.2 Adding jQuery to the Application
456(7)
40 Scalaz
463(12)
40.1 Introduction
463(1)
40.2 Obtaining Scalaz
463(1)
40.3 Scalaz Overview
464(1)
40.4 Some Useful Typeclasses
465(1)
40.4.1 Equals Typeclass
465(1)
40.4.2 Order Typeclass
465(1)
40.5 Standard Class Extensions
466(5)
40.5.1 Extensions to Option
466(2)
40.5.2 Boolean Extensions
468(1)
40.5.3 Extensions to List
469(1)
40.5.4 Extensions for Map
470(1)
40.5.5 Extensions to String
471(1)
40.6 The Other Either
471(1)
40.7 Tagging
472(3)
41 GUIs in Scala Swing
475(14)
41.1 Introduction
475(1)
41.2 Windows as Objects
475(1)
41.3 Windows in Scala
476(1)
41.4 Scala Swing
477(1)
41.5 Scala Swing Packages
478(2)
41.6 Swing Scala Worked Examples
480(9)
41.6.1 Simple Hello World UI
480(1)
41.6.2 Panels and UI Layout
481(1)
41.6.3 Working with a BorderPanel
482(2)
41.6.4 Working with a BoxPanel
484(1)
41.6.5 Displaying a Table
485(4)
42 User Input in Scala Swing
489(12)
42.1 Introduction
489(1)
42.2 Handling User Input
489(7)
42.2.1 Scala Swing Actions
492(2)
42.2.2 Working with Menus
494(2)
42.3 A Simple GUI Example
496(5)
43 Scala Build Tools
501(14)
43.1 Introduction
501(1)
43.2 Why We Need a Build Tool
501(1)
43.3 Maven
502(6)
43.3.1 Maven Repositories
504(1)
43.3.2 The Maven POM
504(2)
43.3.3 Scala and Maven
506(2)
43.3.4 Maven Lifecycle Commands
508(1)
43.4 SBT
508(7)
43.4.1 Creating an SBT Project
510(2)
43.4.2 SBT Lifecycle Commands
512(3)
44 Scala & Java Interoperability
515
44.1 Introduction
515(1)
44.2 A Simple Example
515(2)
44.3 Inheritance
517(1)
44.4 Issues
517(7)
44.4.1 Scala Objects
518(1)
44.4.2 Companion Modules
519(2)
44.4.3 Traits
521(3)
44.5 Functions
524(4)
44.6 Collection Classes
528(2)
44.7 Implementing a Java Interface
530
John Hunt is a technology trainer, consultant, mentor and author who has 35 years experience within the computing industry. He has worked extensively in Object Oriented technologies over the last 25 years, although his career began writing LISP on a Symbolics Lisp Machine. He first encountered Scala in 2010 through an organization with which he was working. Since then he has been involved in numerous Scala projects and has worked with a number of teams on developing their Scala skills.