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. 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 Here is how the equivalent jeans-buying process might take place in the reactive model: see also:
Effective Scala. Table of Contents Other languages 日本語Русский简体中文 Introduction Scala is one of the main application programming languages used at Twitter. Scala provides many tools that enable succinct expression. Above all, program in Scala. This is not an introduction to Scala; we assume the reader is familiar with the language. This is a living document that will change to reflect our current “best practices,” but its core ideas are unlikely to change: Always favor readability; write generic code but not at the expensive of clarity; take advantage of simple language features that afford great power but avoid the esoteric ones (especially in the type system).
And have fun. Formatting The specifics of code formatting — so long as they are practical — are of little consequence. This is of particular importance to Scala, as its grammar has a high degree of overlap. We adhere to the Scala style guide plus the following rules. Whitespace Indent by two spaces. Naming Use short names for small scopes Use vals Prefer: 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. 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. An interesting thing that could also be done is to delegate to different routers based on something in the request. So here are some use cases that overriding onRouteRequest may be useful for: Implementing a custom router We saw in the previous example how to use Plays Router.Routes interface, another option is to implement it.
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.
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? 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. Type inference and pattern matching I am guessing goes back to ML. I’m not saying Scalaz is going to be the next big thing. Hacking Scala - Scalaz - Resources For Beginners. Scalaz is very interesting Scala library. 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 started with question at StackOverflow where I received many good answers. I also noticed, that this question was pretty popular, so I decided to write this post where I can summarize the answers and maybe add something more. Type Classes Type Classes playing important role in Scala and they are really useful concept. Higher Kinds Scalaz Itself Lenses Category Theory. 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.
Contents Introduction I have been promoting Scala for quite some time now, and I have encouraged all of the developers in my office to try it out, hoping that at some point we can start using it for new projects. It was suggested to me that I put together a list of the pros and cons of Scala to help other people in the company evaluate whether they should consider using it for their projects. After pondering this I realized that this would likely be of interest to a wider audience than just at my company, and that it would make a good topic for my blog. Because this comparison is specifically Scala versus Java, I do not include the fact that Scala runs on the JVM, has performance on par with Java, interoperates easily with Java and after compiling is essentially indistinguihsable from Java.
Pros Higher Productivity Higher Quality Better Developers Rapidly Improving Ecosystem Cons. 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. 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.