background preloader

Effective Scala

Effective Scala
Table of Contents Other languages 日本語Русский简体中文 Introduction Scala is one of the main application programming languages used at Twitter. 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. 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. Whitespace Indent by two spaces. Naming to Use

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:

java2scala code generator (maven plugin) scala koans Scala Documentation - Scala Documentation spray | HTTP and more for your Akka/Scala Actors 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. 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: Modifying the request in some way before routing is donePlugging in a completely different router (eg, jaxrs)Delegating to different routes files based on some aspect of the request Implementing a custom router

Page not found · GitHub index Addison-Wesley 2012 “Currently the best compact introduction to Scala” —Martin Odersky “The book is a joy to read. Probably the most concise reference for Scala available on the market, this deserves to be on every programmers bookshelf”—James Sugrue What you get: A rapid introduction to Scala for programmers who are competent in Java, C#, or C++ Blog-length chunks of information that you can digest quickly An organization that you'll find useful as a quick reference What you don't get: An introduction into programming or object-oriented design Religion about the superiority of one paradigm or another Cute or academic examples Mind-numbing details about syntax minutiae Available at Safari Books Online, as DRM-free e-book and/or printed book, and on Kindle You can get the A1 level chapters for free at TypeSafe. Here is the source code for the examples. Gibberish in the book? Table of Contents The [AL][1-3] refer to Martin Odersky's Scala levels.