SIGCSE Scala
1.0
Index
Site
1. About Scala
1.1. Why Scala?
2. Downloading
2.1. Code Examples
2.2. Viewing Offline
2.3. Comments?
3. Scala in CS1
3.1. Motivating Scala in CS1
3.2. Hello, World
3.3. Types - “Lack” of Primitives
3.4. Statements
3.5. Expressions
3.6. Semicolon Inferencing
3.7. Simple Input (and Output)
3.8. val vs. var
3.9. Scripts and Worksheets
3.10. Conditional and Functions
3.11. Function literals
3.12. GCD
3.13. Factorial
3.14. Monte Carlo
\(\pi\)
Calculation
3.15. While Loop
3.16. for loop
3.17. for comprehension
3.18. options amd failure sans exceptions
3.19. yield
3.20. Ranges
3.21. Multiple generators
3.22. If guards
3.23. Variables
3.24. Patterns
3.25. Classes
3.26. A Look at Singleton Objects
3.27. paste
3.28. load
3.29. history
4. CS2
4.1. Collections
4.2. Case Classes
4.3. GUIs
4.4. CS2
5. Build Tools for Scala
5.1. Why Use a Build Tool?
5.2. Brief History of Build Tools
5.3. Sbt
5.4. Plugin Ecosystem
5.5. Starting from Scratch
6. Web Application and Services
6.1. Professional Context
6.2. Curricular Context
6.3. Why Scala?
6.4. Web Applications
6.5. Web Services
7. Mobile Application Development with Android
7.1. Examples
7.2. Lab Assignment
8. Basic Parallelism using Par
8.1. Example: Trapezoidal Numeric Integration
8.2. Download the Code
8.3. Going Scala!
8.4. Going Parallel
8.5. Testing
8.6. Running
8.7. Initial Experiments with Performance
8.8. Previous Work
9. Parallelism using Actors
9.1. Guiding Example: Longest Common Subsequence
9.2. Java Threads Implementation
9.3. Scala Actors Implementation
10. Programming Language Topics
10.1. Abstraction
10.2. Representation
Page
4. CS2
4.1. Collections
4.2. Case Classes
4.3. GUIs
4.4. CS2
Source
4. CS2
¶
Warning
This section is not ready yet. Working on it!
4.1. Collections
¶
Just for Scala
Doesn’t make sense before loops in most languages.
One mutable, one immutable
Many standard methods
Many higher-order methods
Syntax
Use () for indexing
List also have ML style operations
Creation, pass-by-name
4.2. Case Classes
¶
Immutable struct in simplest usage
Simple syntax for grouping data
Works as a pattern
Copy method
4.3. GUIs
¶
scala.swing wraps javax.swing
Cleaner beginner syntax
No explicit inheritance
Reactions use partial functions
Drawbacks: Currently no JTree, Tables complex, Button syntax uses companion object
Full Java2D
Really using Java
Override paint method
Events for animations
Keyboard, Mouse, Timer
4.4. CS2
¶
Pure OO
Fewer quirks than Java
Powerful type system
Traits
Rich collections
Libraries again
Can make things interesting/relevant
Multithreading and networking
Eclipse (maybe) and IntelliJ (our favorite)
Scalable language
Libraries as language
Special methods