Scala is a powerful language that has quickly become a favorite of many developers. However, the language is just a starting point – not every function will be covered by the language core. Scala also creates some awesome frameworks. Let’s take a look at Scala’s four powerful frameworks and their pros and cons. Keep in mind that the best choice for a framework should always fit the requirements of your particular project — so consider our recommendations as appropriate and decide which project is best for you based on your own project requirements.
The Play Framework
High-speed Web framework for Java and Scala
The Play Framework is an open source Scala Framework first released in 2007. It is currently being developed by Lightbend, Zengenergetic and its user developer community. The core functionality of the framework is based on building RESTful applications using the JVM and its associated libraries. It is currently used by some pretty big names, including LinkedIn, Samsung’s IoT Artik platform and education site Coursera. At the time of this writing, Play 2.6 is the current version of Play and has replaced Play 1 in development.
advantages
1. Closely associated with the JVM, Java developers will find it familiar and easy to use.
2. Extensive support for various toolsets and IDE systems.
3. It is based entirely on functional programming concepts and promotes API first RESTful design practices.
4.Play 2 is passive and allows parallel remote calls. This means that it works with WebSockets and other related server-centric approaches.
5. It provides a wide range of framework support structures for asset assembly, format processing, database integration, etc
6.Play is open source and gives adopters access to higher security and a continuously reviewed code base.
disadvantages
1. There are many great plug-ins in the community, of course, but their stability and usability are not always guaranteed.
2.Play 2 uses SBT to build the system. While it is powerful, some have raised concerns about using Implicits, wildcard imports, and other “quirks” that make infrastructure development and integration extremely difficult.
Finch
Scala combinator library for building Finagle HTTP services
Finch is a modular system of HTTP primitives that work together to form HTTP apis. The entire framework is centered around the concept of composability, and as such, it is a highly modular, customizable system. “Finch is a pure functional building block on top of Finagle for building composable HTTP apis. Its mission is to provide developers with a simple and powerful HTTP primitive that is as close to the bare-metal Finagle API as possible.”
advantages
1.Finch uses feature blocks to build its framework, so it is very modular.
2. That being said, it provides some pretty powerful HTTP primitives, which makes it ideal for rapid development and testing. As such, Finch is ideal for small projects and startups.
3. Due to its modular nature, it is very fast and powerful for all kinds of systems.
disadvantages
1. The main disadvantage is that its structure is more of a minimum-unit implementation and, while allowing for further implementation and development iterations, is not considered a full-stack solution.
Akka HTTP
The Akka HTTP module implements a complete server and client HTTP stack on top of akka-Actor and Akka-stream
Akka HTTP is a highly modular and extremely powerful Akka implementation of Scala. It is developed and created in the “framework”, with pre-formed menus and feature guides. Akka HTTP was created in “frameless” form to provide many development tools without forcing developers to make any choices. As the documentation describes, “It is not a Web framework, but a more general toolkit for providing and consuming HTTP-based services. While interaction with the browser is certainly within the scope, it is not the primary focus of Akka HTTP.”
advantages
1. The biggest benefit of Akka HTTP is its integration with Akka functionality. Like Akka, it supports many systems that can perform parallel commands and advanced computational processing.
2.Akka HTTP has strong developer and contributor support, all under Lightbend. In addition, it has excellent documentation and an easy-to-understand support center.
disadvantages
1.Akka HTTP is slower than the previous two implementations, so while it can scale effectively, it’s starting to lag behind, so to speak.
2.Lightbend is a great community, but being stuck with a single vendor can be quite alarming relative to other communities. Vendor lock-in can be expensive and difficult to crack, so consider this before adopting this solution.
Chaos
A lightweight framework for writing REST services in Scala
Chaos is the framework for Mesosphere. It is designed for RESTful development and is based on developers’ previous experience with Dropwizard and Twitter Commons in the Java Framework space. They designed Chaos as a simplified version of Play. Chaos refers to the formless or nothingness of the universe before it was created in The Greek creation myth. Similarly, Chaos (framework) precedes the creation of a service “universe.”
advantages
Chaos is easy to use, especially for those familiar with Scala.
2. All the libraries it uses are well tested and well supported, providing extensive documentation and knowledge base for testing, iteration and development.
disadvantages
1. Unfortunately Chaos is by nature a lightweight framework, and while it does some interesting things, it is fundamentally limited by this approach.
2. As the creators say, it really does a good job -REST. If you are not building RESTful services, or if you are building a service that must integrate some “quirk” design, the default library in Chaos may not be the best integration you require.