четверг, 22 декабря 2011 г.

суббота, 17 декабря 2011 г.

среда, 7 декабря 2011 г.

Java наносит ответный удар (по Scala)

Real life Scala feedback from Yammer

"Right now at Yammer we're moving our basic infrastructure stack over to Java"

"Scala, as a language, has some profoundly interesting ideas in it. That's one of the things which attracted me to it in the first place. But it's also a very complex language. The number of concepts I had to explain to new members of our team for even the simplest usage of a collection was surprising: implicit parameters, builder typeclasses, "operator overloahttp://www.blogger.com/img/blank.gifding", return type inference, etc. etc. Then the particulars: what's a Traversable vs. a TraversableOnce? GenTraversable? Iterable? IterableLike? Should they be choosing the most general type for parameters, and if so what was that? What was a =:= and where could they get one from?"

"In addition to the concepts and specific implementations that Scala introduces, there is also a cultural layer of what it means to write idiomatic Scala."

"In hindsight, I definitely underestimated both the difficulty and importance of learning (and teaching) Scala."

"Contrast this with the default for the JVM ecosystem: if new hires write Java, they're productive as soon as we can get them a keyboard."

"Despite the fact that we're moving away from Scala, I still think it's one of the most interesting, innovative, and exciting languages I've used ..."

вторник, 6 декабря 2011 г.

[Book]: Actors in Scala

Actors in Scala

Table of contents:
Contents viii
List of Figures x
List of Listings xi
Preface xiii
1. Concurrency Everywhere 15 (download free sample chapter PDF)
2. Messages All the Way Up 25
3. Scala's Language Support for Actors 41
4. Actor Chat 42
5. Event-Based Programming 52
6. Exception Handling, Actor Termination and Shutdown 65
7. Customizing Actor Execution 80
8. Remote Actors 95
9. Using Scala Actors with Java APIs 96
10. Distributed and Parallel Computing with Scala Actors 97
Bibliography 98
About the Authors 100
Index 101

State: You're Doing It Wrong - Alternative Concurrency Paradigms For The JVM

"State: You're Doing It Wrong - Alternative Concurrency Paradigms For The JVM"

"What is an Identity?
A stable logical Identity associated with a series of different Values over time."

"What is State?
The Value an entity with a specific Identity has at a particular point in time."

"Haw do we know if something has State?
If a function is invoked with the same arguments at two different points in time and returns different values ... than it has State."

P.S. More on State (Clojure)

понедельник, 5 декабря 2011 г.

Akka: Transactor

Transactors

"Generally, the STM is not needed very often when working with Akka. Some use-cases (that we can think of) are:
1. When you really need composable message flows across many actors updating their internal local state but need them to do that atomically in one big transaction. Might not often, but when you do need this then you are screwed without it.
2. When you want to share a datastructure across actors.
3. When you need to use the persistence modules.
"

"Actors are excellent for solving problems where you have many independent processes that can work in isolation and only interact with other Actors through message passing."

"But the actor model is unfortunately a terrible model for implementing truly shared state. E.g. when you need to have consensus and a stable view of state across many components."

"STM on the other hand is excellent for problems where you need consensus and a stable view of the state by providing compositional transactional shared state. Some of the really nice traits of STM are that transactions compose, and it raises the abstraction level from lock-based concurrency."

"Akka provides an explicit mechanism for coordinating transactions across Actors. Under the hood it uses a CountDownCommitBarrier, similar to a CountDownLatch."

Akka - an open source, event-driven middleware project

"Akka - an open source, event-driven middleware project"

"... It is designed to allow developers to write simpler, correct concurrent applications using Actors, STM (software transactional memory) and transactors."

Doug Lea Discusses the Fork/Join Framework

"Doug Lea Discusses the Fork/Join Framework"

"...Part of this is that we have the luxury of building this framework on systems that have, for example, high performance, scalable, concurrent garbage collection, because garbage collection in these frameworks turns out to be an interesting issue. If you are implementing them, say in C, you generally have to slow down a lot of things in order to get the memory allocation right. In our case, we will spew lots of garbage, but it's very well behaved garbage and it's picked up by the garbage collector because it is unused 99% of the time."