Sunday, March 17, 2013

[Draft] Cake pattern, modular mixin component abstractions, DI, expression problem ..

Hmm, what other phrases come to mind? f-bounded polymorphism, recursive types.

Anyway, you'll want to read Chaps. 4-7 of Suereth's Scala in Depth, carefully.



Also: Feature-Oriented Programming with Object Algebras, by Oliveira, van der Storm, Loh, Cook.

Implicit parameters are introduced in section 5,

dynamic proxy is an object that
implements a list of interfaces specified at runtime.

Language features not used: case classes,



Spiewak's NEscala slides .... and ... video



Hibberd talk on monads, transformers, stacked types

Hit down arrow til you can't go further, then hit Right-arrow. [Escape] and [Ctrl-F] in Chrome to text search.

Scalaz; no implicits in client code.

Sunday, March 3, 2013

[Draft] Review: "Scala in Depth", Joshua Suereth

This is an important book, the only one that goes into the nitty gritty of "modular abstractions", app design and configuration, Dependency Injection/IoC, whatever you call it in scala. The two main language tools are:

- implicit conversions and parameters, (Different authors' vocabulary is confusing. Implicit views are conversions, Implicit "values" are ___).

- Scala's type system: traits, classes, companion and package objects, "type" and "object" keywords, identifiers, scope/namespaces. Linearization and delegating to .super().

Other topics

- Path dependent types and type projections, Chapter


Things not mentioned (not in index, or not in book content to the extent one might expect)

- case classes (not in index, and not in evidence in Chapters 4-7 [[*** FACT CHECK****]] )

- Type inference: this is an omission, in that there's discussion of gotchas and workarounds, e.g. p.156, 207, 247, but no background discussion of how scala differs from, say, haskell or ocaml (subtyping changes everything: Hindley-Milner global unification is not possible, so scala does "flow-based" or "localized" inference.

- Reflection and 2.10 macro API: these are not covered, since they were not anywhere near final specification when book was written, but are important topics in "modular abstractions"


Chapters 8-10 (Collections, Actors and Java Interop) are standalone reading, all full of good info, but not as integrated as chapters 4-7. The Actors chapter covers the 2.8 and 2.9 Scala actors lib, as does the Artima book, rather than the Akka lib that is now the official actor/async/future/promises lib in scala. So the particulars of how to create/link/message actors is different, but the content is good.

akka vs. Erlang OTP

akka has:
- typed channels,
- Apache camel and JMX libs connect to AMQP, rabbitMQ.
- "become" and typed actors that flip between states vs. erlang's selective message receives

BTW, read the blog (http://letitcrash.com/), what do you see? Very simple type signatures!


Chapter 11: "Patterns in FP" covers: Category Theory (Functors, applicatives, monads). Monads are a difficult subject to cover in a short text. RWH and Learn You a Haskell: develop the topic over a 100 pages or more, convey what the properties and laws of each structure are, beginning with functors (and including monoids), and do it well.

Many "tutorials" try to invert the intuition. Rather than talking about properties and laws, they make it about a concrete "container, context, programmable semicolon, or guard/test". Which leads to widely lampooned burrito, spacesuit and tutorials where the author doesn't know what functors and applicatives are.

S in Depth avoids this by making statements like "Monads are FlatMap", "


Book's two main Downsides: Index and Copyediting

I have to say it, the index is miserable, which makes it difficult to find anything, which reduces the value of the book, unless you write your own index. Horstmann's index is 22 pages, Staircase 2nd edition has 34 pages; those are well-indexed books. S in Depth is 8 pages, which if spread out to 2 columns/page, equates to 12 pages.

I would've done it like this: http://www.flickr.com/photos/41758452@N00/sets/72157632325530580/

This book was not professionally proofed/copy edited. There's a fair number of embarassing typo's, like the one in big font on back cover, and mis-spelling Prof. Odersky 's name. In the unicode section around page 50, the typesetter forgot to insert most of the unicode symbols. But those don't matter much, there's other parts where the meaning is obscured.

The "numbered" trait linearization graph on p. 75 has no numbers.

Thursday, February 25, 2010

Language roundups: Scala, Clojure, Erlang

Pure cut and paste from here:
isthisclojure.blogspot.com/2010/02/language-roundups.html


I promised to do 15-25 bullets on Erlang, Clojure and Scala::

- tool chain: IDE/editors, debuggers, tracer, profiler, loggers, static code analysis;
- concurrency model: STM; persistency/ACID backends; message passing;

- developments on the VM and compiler choices;
- core language

Here's the initial promises:

Scala (kind of fluffy)
http://news.ycombinator.com/item?id=1150837

Clojure (pure fluff)
http://news.ycombinator.com/item?id=1086645

Erlang (folks seemed to like this one)
http://news.ycombinator.com/item?id=855290