background preloader

Scala

Facebook Twitter

Developing Android Apps with Scala and Scaloid: Part 1. The Neophyte's Guide to Scala - Daniel Westheide. Observable · Netflix/RxJava Wiki. In RxJava an object of the Subscriber class (or some other object that implements the Observer interface) subscribes to an object of the Observable class.

Observable · Netflix/RxJava Wiki

Then that subscriber reacts to whatever item or items the Observable object emits. This pattern facilitates concurrent operations because it does not need to block while waiting for the Observable to emit objects, but instead it creates a sentry in the form of a subscriber that stands ready to react appropriately at whatever future time the Observable does so. This page explains what the reactive pattern is and what Observables and Subscribers are (and how Subscribers subscribe to Observables). Subsequent child pages (as shown in sidebar) show how you use the variety of Observable operators to link Observables together and change their behaviors. This documentation accompanies its explanations with "marble diagrams. " see also Background. Effective Scala.

Table of Contents Other languages 日本語Русский简体中文 Introduction Scala is one of the main application programming languages used at Twitter.

Effective Scala

Much of our infrastructure is written in Scala and we have several large libraries supporting our use. Scala provides many tools that enable succinct expression. Above all, program in Scala. Advanced routing in Play Framework - all that jazz. We frequently get questions about how to meet all sorts of different routing needs in Play Framework.

Advanced routing in Play Framework - all that jazz

While the built in router is enough for most users, sometimes you may encounter use cases where it's not enough. Or, maybe you want a more convenient way to implement some routing pattern. Whatever it is, Play will allow you to do pretty much anything. This blog post is going to describe some common use cases. Hooking into Plays routing mechanism If for some reason you don't like Plays router, or if you want to use a modified router, then Play allows you to do this easily. As you can see, I've practically implemented my own little routing DSL here. Unveiling Play 2.1 Json API - Part 1 : JsPath & Reads combinators - Mandubian Blog. Addendum: recent API refactoring (modified in the articled) Reads[A] provided Reads[B] has been renamed to Reads[A] keepAnd Reads[B]Reads[A] andThen Reads[B] has been renamed to Reads[A] andKeep Reads[B] In incoming Play2.1 version, a huge re-thinking has been done about JSON API provided by Play2.0.x which provides some great features but is clearly just the tip of the iceberg… Here is a first presentation of those evolutions aimed at unleashing your JSON usage in Play2 and revealing new forms of manipulation of web dataflows from/to external data systems.

Unveiling Play 2.1 Json API - Part 1 : JsPath & Reads combinators - Mandubian Blog

A usecase of this is manipulating DB structures directly using Json without any class models for document oriented structures such as MongoDB BTW Don’t forget the recent release of new MongoDB async/non-blocking driver ReactiveMongo ;-) Summary of main new features added in Play2.1 Now let’s go in the details ;) Concerning the new Json syntax, I won’t spend time on this, it’s quite explicit and you can try it very easily by yourself. Learning Scalaz — learning Scalaz. How many programming languages have been called Lisp in sheep’s clothing?

learning Scalaz — learning Scalaz

Java brought in GC to familiar C++ like grammar. Although there have been other languages with GC, in 1996 it felt like a big deal because it promised to become a viable alternative to C++. Eventually, people got used to not having to manage memory by hand. JavaScript and Ruby both have been called Lisp in sheep’s clothing for their first-class functions and block syntax. The homoiconic nature of S-expression still makes Lisp-like languages interesting as it fits well to macros. Recently languages are borrowing concepts from newer breed of functional languages. Hacking Scala - Scalaz - Resources For Beginners. Scalaz is very interesting Scala library.

Hacking Scala - Scalaz - Resources For Beginners

It can be pretty scary when you first look at it and at examples of it’s usage. I also find, that at the beginning, advantages of this library are not very obvious. So at some point I asked myself: why are people so enthusiastic about it? So I started to learn it, but found that it’s hard to find any resources that are targeting beginners - people who are new to Haskell, Category Theory, or advanced Scala features like Type Classes or Higher Kinds. In this post I want to summarize all resources I found about scalaz or related to scalaz that are actually approachable by beginners. I personally believe that even if you don’t completely understand every aspect of scalaz yet (I’m definitely not), it still can help you to write a better code.

Type Classes Type Classes playing important role in Scala and they are really useful concept. Nscala-time/nscala-time. Scala Pros and Cons. Some pros and cons of the Scala programming language as compared to Java from a business management perspective.

Scala Pros and Cons

Contents Introduction. Futures and Promises. By: Philipp Haller, Aleksandar Prokopec, Heather Miller, Viktor Klang, Roland Kuhn, and Vojin Jovanovic Introduction Futures provide a way to reason about performing many operations in parallel– in an efficient and non-blocking way.

Futures and Promises

A Future is a placeholder object for a value that may not yet exist. Generally, the value of the Future is supplied concurrently and can subsequently be used. Composing concurrent tasks in this way tends to result in faster, asynchronous, non-blocking parallel code. By default, futures and promises are non-blocking, making use of callbacks instead of typical blocking operations. A typical future looks like this: val inverseFuture: Future[Matrix] = Future { fatMatrix.inverse() // non-blocking long lasting computation}(executionContext) Or with the more idiomatic: implicit val ec: ExecutionContext = ...val inverseFuture : Future[Matrix] = Future { fatMatrix.inverse()} // ec is implicitly passed Execution Context The Global Execution Context Adapting a Java Executor. Scala Documentation. Jorgeortiz85/scala-time.