Showing posts with label Scala. Show all posts
Showing posts with label Scala. Show all posts

2021-05-28

2021-05-28 Friday - Dean Wampler's Scala, 3rd Edition published

 


https://deanwampler.github.io/books/programmingscala.html

https://medium.com/scala-3

https://www.amazon.com/Programming-Scala-Scalability-Functional-Objects/dp/1492077895/  

"Get up to speed on Scala--the JVM, JavaScript, and natively compiled language that offers all the benefits of functional programming, a modern object model, and an advanced type system. Packed with code examples, this comprehensive book shows you how to be productive with the language and ecosystem right away. You'll learn why Scala is ideal for building today's highly scalable, data-centric applications, while maximizing developer productivity."

"While Java remains popular and Kotlin has become popular, Scala hasn't been sitting still. This third edition covers the new features in Scala 3.0 with updates throughout the book. Programming Scala is ideal for beginning to advanced developers who want a complete understanding of Scala's design philosophy and features with a thoroughly practical focus."

https://en.wikipedia.org/wiki/Scala_(programming_language)

https://www.scala-lang.org/

2018-09-23

2018-09-23 Sunday - Book Recommendation: Functional Programming for Mortals

A book, by Sam Halliday, that I've added to my stack for October:

Functional Programming for Mortals
https://leanpub.com/fpmortals

read online (free)
https://leanpub.com/fpmortals/read



2009-10-25

2009-10-25 Sunday - Common Lisp

In my study of the Scala language, I've taken a slight detour to spend some time learning the CLISP implementation of Common Lisp, which I think will help me to better understand Scala itself (as well as fundamental concepts of any Functional Language).

Here are some of the resource links that I've found useful:

A Concise Introduction to LISP, by David L. Matuszek
http://www.cis.upenn.edu/~matuszek/LispText/lisp.html

http://www.cis.upenn.edu/~matuszek/LispText/lisp-examples.html


Common Lisp the Language, 2nd Edition
by Guy L. Steele Jr.
http://www.supelec.fr/docs/cltl/clm/node1.html


Peter Siebel's, Practical Common Lisp
http://gigamonkeys.com/book/

http://www.antigreen.org/vadim/ProgLanguageComparison/lisp-cmp-with-cpp-java-etc/C++-vs-Lisp.html


6 Problems (with solutions in Lisp)
CS107 Handout 53, Autumn 2000 November 30, 2000, Lisp Section Examples
http://cse.stanford.edu/class/cs107/handouts/53lispexamples.pdf


Nick Parlante's http://www-cs-staff.stanford.edu/~nick/compdocs/LISP_Examples.pdf



This is Abhishek Reddy's really well written, concise, summary of the the features in Common Lisp: http://abhishek.geek.nz/docs/features-of-common-lisp

...as well as his: http://abhishek.geek.nz/docs/lisp-answers/


Although not specific to Scala or Lisp, I enjoyed reading this 376 page text...

Programming Languages: Application and Interpretation
By: Shriram Krishnamurthi
Brown University
http://www.cs.brown.edu/~sk/Publications/Books/ProgLangs/2007-04-26/plai-2007-04-26.pdf

2009-07-12

2009-07-12 Sunday - Links

No time to dig into these today, but want to save them for future reference:

JavaScript Based Animation Frameworks and Libraries

live-android A LiveCD for Android

Scala Cheatsheet

2009-07-03

2009-07-03 Friday - Beginning Scala Book Review

The following is the review I posted tonight on Amazon.com for David Pollak's Beginning Scala book




If you are like me, you are often hard pressed for getting many things done quickly.

If you want a quick introduction to Scala, this book is just right for the level of information provided to get you up and running quickly.

I enjoyed reading David Pollak's "Beginning Scala" - and found it to be very helpful in several ways:

#1 - It is written from the perspective of an experienced Java programmer - and the parallels between the languages that are cited in the text was a very helpful technique for compressing the time needed to digest the material. Ruby parallels are also frequently covered.

#2 - This book is a great book to have on your bookshelf if you want to become immediately productive. David's writing is direct, practical, pragmatic.

#3 - This book is useful for the application developer, library designer, and architect.

At ~290 pages - Beginning Scala does a good solid job of covering the language, with many interesting examples of Scala code.

Chapters include:
1 - About Scala and How to Install It
2 - Scala Syntax, Scripts, and Your First Scala Programs
3 - Collections and the Joy of Immutability
4 - Fun with Functions, and Never Having to Close that JDBC Connection
5 - Pattern Matching
6 - Actors and Concurrency
7 - Traits and Types and Gnarly Stuff for Architects
8 - Parsers - Because BNF Is Not Just for Academics Anymore
9 - Scaling Your Team

I had the pleasure of meeting David at JavaOne 2009 in San Francisco this year. He is a genuinely nice guy - and a passionate Scala enthusiast.

2009-06-30

2009-06-30 Tuesday - Programming Scala, Chpt. 12

Chapter 12 of the Programming Scala book, by Dean Wampler and Alex Payne is now posted and available online for review.

2009-06-04

2009-06-04 Thursday - Bay Area Scala Enthusiasts at Twitter HQ

I'm deep in the heart of Twitter country tonight: Bay Area Scala Enthusiasts meeting.

Martin Odersky, the creator of the Scala programming language, is giving a talk tonight.

Alex Miller, from St. Louis, announced he is organizing a conference to be held in St. Louis later this Fall
http://www.strangeloop.com

Martin's Talk: What's New in Scala 2.8

Next version will be 2.8

Some extended & modified libraries: swing, collections

New Language Features: named args, specializations, generics, package objects

Optional plugins, continuations

Redesigned compiler/IDE interface

New Language Features:

Named and default arguments:
- Defaults can be arbitrary expressions, not just constants
- Default evaluation is dynamic

Copy Method
Defining a copy
Using a copy

Nested annotations
- annotations can now be nested
- named arguments syntax is re-used

Package Objects
implemented to deal with collection libraries
refactored the class space

Package objects make packages more like objects

Old Scala Collections (pre 2.8): grew over time, gradually, lacked a uniform structure

New Scala Collections: Uniform structure, every operation is implemented only once, selection of building blocks now in package scala.collection.generic


Generics cause a performance hit if you are dealing with primitive types - because they require a uniform representation - everything needs to be boxed...@specialized can be used to avoid the boxing/unboxing problem.

Better Tools
- REPL with command completion
- Newly designed IDE/Compiler interfaces

New control abstractions
- Continuations plugin

More Features:
- extended swing library
- performance improvements
-- structural type dispatch
-- actors
-- vectors, sets and maps
- standardized comopiler plugin architecture

How to get it
- available now via /trunk (bleeding edge)
- final version planned for September/October


Beyond 2.8
- common focus: parallelism and concurrency
- developing a rich library of concurrency abstractions
-- actors
-- transactions
-- data parallelism
-- stream processing
- work with Doug Lea on concurrency datastructures
- advanced tyhpe systems to gurantee isolation and effect tracking
- Goal: in 5 years, Scala should be language of choice for the creation of concurrent and parallel systems.


Breaking News: The meeting organizer mentioned that he just had a phone conversation with Joshua Bloch tonight - and that he said he may finally have to take a look at Scala.

2009-06-04 Thursday - JavaOne 2009 - Actor-Based Concurrency in Scala

Session: TS-5395, "Actor-Based Concurrency in Scala"

Speakers:
Phillipp Haller, EPFL
Frank Sommers, Artima

Actor Principles:
- Shared-nothing
-- Actor's state is private
-- No synchronization on private state

- Actors communicate through messages
-- Messages are (mostly) immutable objects

- Actors can be local or remote
-- Same programming model
-- Scales "from multicore to cloud"

An established concurrency paradigm
Long history of research
-- started at MIT in the 70's (Hewitt, Agha)
--- insipred by Smalltalk and Simula

- Motivation for the development for Scheme


Actors in Erlang
"a pure message-passing language"
- Supportive language features
- Special, process-oriented virtual machine
-- Manage VM processes
-- Cheap proceses: creates them fast, have lots of them
- OTP: library of Erlang modules for building reliable distributed systems

Actors in Scala
- Closest implementation of the Erlang model on the JVM
- Leverages Scala language features
-- pattern matching, closures
-- traits and mutliple inheritance
-- Full Java interoperability
- Event-based Actors
-- Not tied to Java threads
-- allows you to scale to millions of Actors / Threads
- Local and remote
-- same programming model
- Implementable as an embedded DSL
- Part of Scala's standard library
-- scala.actors, scala.actors.remote
- used by Twitter's kestrel message system (?)


Creating an Actor
- extend class by Actor class
- implement act() method
- define message types (case classes)
- Receiving messages, use the "receive" command



WOW - I get Actors now


Pattern matching: switch on steroids

- List of alternatives:
-- case pattern => expression
- Patterns are tried in order, the first match is evaluated
- Patterns look like factory method calls


Handling subscriptions


Sending a subscription message:
chatroom ! Subscribe(User("bob"))

"!" method to send a message
Nono-blocking, returns immediately
Implicity passes a reference to the sender


Syncrhonous send
val res = chatRoom !? Subscribe(User("bob"))

"!?" sychronous send method
Blocks sender until reply is received

Futures (callback?)
val future = chatRoom !! Subscribe(User("bob"))

Message send does not block
Future: handle that represents the reply
Sender waits for the....?



Timeouts: receiveWithin(ms)
self.receiveWithin (1800 * 1000)

Scala Actors work across Virtual Machines - using remote Actors
import scala.actor.remote._
import RemoteActor._


Sending message to remote Actors
select(Node(
, 8000), 'chatRoom)

select returns a proxy to the Actor
Reference to caller transfers to remote node:
- sender is valid reference in remote Actor


Event-based (aka thread-less) Actors
Event-based actors do not consume a thread while waiting for a message
Replace:
- receive {} with react{}
- receiveWithin {} with reactWithin() {}
- while(cond) {} with loopWhile(cond) {}
Massive gains in scalability



Event-based (aka thread-less) Actors



Receive vs. react
- Use react whenever possible
- Use receive when necessary (e.g. to receive a value returned by an Actor)


Act II: Under the hood
- Event-based actors
-- decoupling threads and actors
- Lightweight execution environment
-- work-stealing thread pool
- Implementing the DSL
-- Creating actors using actor {}
-- Receiving messages using react {}


Event-based Actors
- Naive thread-per-actor implementation
-- thread creation and context-swtiching overhead
-- high memory consumption
- Implementation in Scala Actors is event-driven
-- Decouple actors from JVM threads
-- Execute actors on thread pool


Lightweight execution environment
- Thread pool
- Work stealing
-- Load balancing
- Local work queues


Thread pools and work stealing
-- map Actors (man) to Thread Pool
-- worker threads (few)

JSR 166 thread pool implementation (?)

Implementing the DSL
Creating Actors

Starting an Actor cretes a task that is submitted to a scheduler managing a thread pool.

Customizing Actor execution

Executing Actors on the AWT event dispatch thread



Scala 2.8 and beyond
- pluggable schedulers
- integrating exceptions and Erlang-style error handling
- Continuations support
-- using optional compiler-plugin
-- More flexible control structures, Actor migration
- Static checking: @immutable, Actor isolation

2009-05-16

2009-05-16 Saturday - Scala Resources

I installed the latest Eclipse plugin for a Scala IDE today. Nice!




Scala Code Examples - Simple

Scala Code Examples - Advanced

Scala: A Modern Language, Clinton R. Nixon, Viget Labs

An Overview of the Scala Programming Language
Second Edition
Martin Odersky, Philippe Altherr, Vincent Cremet, Iulian Dragos
Gilles Dubochet, Burak Emir, Sean McDirmid, Stéphane Micheloud,
Nikolay Mihaylov, Michel Schinz, Erik Stenman, Lex Spoon, Matthias Zenger
École Polytechnique Fédérale de Lausanne (EPFL)
Lausanne, Switzerland

The Scala Language Specification, Version 2.7

Scala by Example, Martin Odersky, PROGRAMMING METHODS LABORATORY, EPFL, SWITZERLAND

A Scala Tutorial for Java Progammers, Michel Schinz, Philipp Haller




more link goodness...

http://code.google.com/p/scalacheck/
ScalaCheck is a powerful tool for automatic unit testing of Scala and Java programs. It features automatic test case generation and minimization of failing test cases. ScalaCheck started out as a Scala port of the Haskell library QuickCheck, and has since evolved and been extended with features not found in Haskell QuickCheck.


Scala Wiki
http://scala.sygneca.com/



First Steps to Scala
by Bill Venners, Martin Odersky, and Lex Spoon
http://www.artima.com/scalazine/articles/steps.html



Scala example for accessing Ehcache Server
http://gregluck.com/blog/archives/2009/01/scala_example_f.html



Jonas Bonér - Real-World Scala: Introduction
http://jonasboner.com/2008/10/01/real-world-scala-introduction.html



Scala for Java Refugees Part 1: main(String[])
http://www.codecommit.com/blog/scala/scala-for-java-refugees-part-1


Scala for Java Refugees Part 2: Basic OOP
http://www.codecommit.com/blog/scala/scala-for-java-refugees-part-2


http://www.huygens-fokker.org/scala/


5 Things a Ruby developer needs to know about Scala
http://blog.lostlake.org/index.php?/archives/27-5-Things-a-Ruby-developer-needs-to-know-about-Scala.html


Chicago Area Scala Enthusiasts (CASE).
http://groups.google.com/group/chicagoscala


Want your own domain specific languages in Java? Use Scala!
http://www.softwaresecretweapons.com/jspwiki/want-your-own-domain-specific-languages-in-java-use-scala


Is Scala Really the Next C++?
http://www.codecommit.com/blog/scala/is-scala-really-the-next-c


IronPython, Jython, Scala and Python: A Fairly Meaningless Server Performance Comparison http://jimmyg.org/blog/2009/ironpython-jython-scala.html

Learning Scala for its Actors
https://gfw.appspot.com/sujitpal/2008/12/learning-scala-for-its-actors.html


Programming in Scala – Mixin inheritance (Summer 2008)
http://www.cs.helsinki.fi/u/pohjalai/ke08/scala/slides/mixin-inheritance.pdf


Scala Servlet HowTo
http://burak.emir.googlepages.com/scalaservlet.html


Scala XML book draft
http://burak.emir.googlepages.com/scalaxbook.docbk.html

Object-Oriented Pattern Matching
Burak Emir's Thesis
ÉCOLE POLYTECHNIQUE FÉDÉRALE DE LAUSANNE http://biblion.epfl.ch/EPFL/theses/2007/3899/EPFL_TH3899.pdf


Scala: Bringing Future Languages to the JVM
http://www.insight24.com/webcasts/content-118110_1
In this presentation, Lex Spoon discusses the Scala programming language. Topics covered include the origin of Scala, the philosophy behind Scala, the Scala feature set, Object-Oriented and Functional programming in Scala, examples of Scala code, writing DSLs, how Scala is converted into Java, Scala performance, Abstract Data Types, unapply, actors and partial functions.

Guide to the Scala Community
http://scala-blogs.org/2008/01/guide-to-scala-community.html


http://scala-blogs.org/


I also took some time today to upgrade my Subversion environment to the latest 1.6.x release - and updated the Subclipse plugin for Eclipse.

WordCount

Copyright

© 2001-2026 International Technology Ventures, Inc., All Rights Reserved.