lessons learned: scala and its ecosystem
DESCRIPTION
This presentation is motivated by the continuous growth of Scala language popularity thanks to many new concepts it offers. Therefore, it makes a perfect sense to take a further insight on this language. Beside the language itself, its ecosystem is also very important. That is why I will focus on the Scala ecosystem in this presentation.TRANSCRIPT
![Page 1: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/1.jpg)
Scala and its Ecosystem
Petr HošekD3S Seminar, September 2010
![Page 2: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/2.jpg)
Language is useless without its ecosystem.
Tools, libraries, frameworks, etc.
Growing usage demands the need of ecosystem.
Java ecosystem is not enough for Scala.
![Page 3: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/3.jpg)
01 Scala compiler
02 Scala tools & libraries
03 Scala frameworks
04 Collaborative Scaladoc
05 Lessons learned
06 Questions & Answers
![Page 4: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/4.jpg)
01 Scala compiler
![Page 5: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/5.jpg)
Second generation of Scala compiler.Oficially named NSC (New Scala Compiler).
Entirely developed in Scala itself (self-hosted).Compiles Scala directly into Java bytecode.
![Page 6: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/6.jpg)
Allows to be used in several ways.Standalone, interactive, embedded.
Designed to be completely re-entrant.Can be instantiated as any other class.
Compilation consists of several phases.Each phases transforms the syntax tree.
![Page 7: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/7.jpg)
Developed in entirely modular way.Compiler is composed of several component.
Represented by traits.
Compiler can be easily extended via plugins.
They can be inserted in all phases of compilation.
![Page 8: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/8.jpg)
02 Scala tools & libraries
![Page 9: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/9.jpg)
They form the basis of Scala ecosystem.Many new tools appeared in the last few months.
Most of them replaces Java equivalents.
New tools are coming up every day.
![Page 10: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/10.jpg)
simple-build-tool
Simple but powerful build tool for Scala.Configuration is written directly in Scala.
Provides interactive and batch mode.Dependency management support.Integrated support for many Scala tools.
Lot of plugins and extensions do exists.
![Page 11: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/11.jpg)
import sbt._
class ExampleProject(info: ProjectInfo) extends ParentProject(info) { override def fork = forkRun(Some(new File("demo")), "-Xmx2G" :: Nil)
lazy val subA = project("subA", "Sub Project A", new ExampleSubProject(_)) lazy val subB = project("subB", "Sub Project B", new ExampleSubProject(_))
class ExampleSubProject(info: ProjectInfo) extends DefaultProject(info) { def compileOptions: Seq[CompileOption] = Verbose :: Nil
val specs = "org.scala-tools.testing" % "specs_2.8.0" % "1.6.5" % "test->default" }}
![Page 12: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/12.jpg)
specs
Behaviour-driven design framework for Scala.Simple and typed language for specifications.
Benefits from Scala expressive syntax.
Integration with testing tools and frameworks.
JUnit, ScalaCheck, Mockito, etc.
Support for literate programming.
![Page 13: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/13.jpg)
class GreetingSpecification extends HtmlSpecification with Textile { "The greeting application" is <t>
h3. Presentation
This new application should say "hello" in different languages.
For example,<ex>by default, saying hello by default should use English</ex> { greet must_== "hello" } Then, other languages, like <ex>French and German should be supported too</ex> { eg { greet("French") must_== "bonjour" greet("German") must_== "hallo" } }
<ex>Japanese should be supported also</ex> { notImplemented }
</t>}
![Page 14: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/14.jpg)
Configgy
Library for handling configuration and logging.Simple configuration format.
But still very powerful.
Support for JMX and notification of changes.Extremelly simple API.
![Page 15: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/15.jpg)
include "/opt/config/local.conf"log (inherit="log-base") { filename = "/var/log/example.log" level = "debug" utc = true verbose { node = "com.example.*" level = "trace" }}hostname = "example.com"port = 3000
Configgy.configure("~/example.conf")
val config = Configgy.configval hostname = config.getString("hostname", "localhost")val port = config.getInt("port", 3000)
val log = Logger.getlog.error("Unable to listen on %s:%d!", hostname, port)
![Page 16: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/16.jpg)
03 Scala frameworks
![Page 17: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/17.jpg)
Akka framework
Framework for concurrent, fault-tolerant, scalable applications development.
Based on event-driven approach.
Provides actors, STM, transactors, etc.Together with Scala as well as Java API.
Many add-on modules available.REST, Comet, Spring, Guice, OSGi integration, etc.
![Page 18: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/18.jpg)
Lift web framework
Expressive and elegant web framework.Benefiting from Scala language features.
Embraces View-First approach to MVC.Importance of scalability and security.
Without loss of performance or maintainability.
Native support for Ajax a Comet.
![Page 19: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/19.jpg)
04 Collaborative Scaladoc
![Page 20: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/20.jpg)
Newest addition to Scala ecosystem.Consisting currently from two applications.
Contribution of Scala project documentation. New approach of documentation authoring.
Using the concepts of social collaboration.
![Page 21: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/21.jpg)
Scaladoc
Analogy of Javadoc for Scala.Part of Scala compiler currently as second generation.
Contains new sleek and modern interface.Provides improved comment syntax.
Supports wiki-like syntax in the source comments.
![Page 22: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/22.jpg)
Colladoc
Allows to edit Scala symbols documentation.Lift web application running the Scala compiler.Developed as a Google SoC 2010 project.
Now being developed as open-source project.
Based heavily upon Scaladoc 2 functionality.„Do not reinvent the wheel.“
![Page 23: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/23.jpg)
Mergedoc
Allows to merge changes into the source-code.Simple command-line utility.
Built on top of Scala compiler.
Not yet officially released.Reimplementation of scaladoc-merge tool.
![Page 24: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/24.jpg)
Collaboration is the main goal.Using collaborative development tools.
Joining the effort is easy.Fork and contribute at GitHub.Track the development at Lighthouse.
Learn more at http://petrhosek.name/
![Page 25: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/25.jpg)
05 Lessons learned
![Page 26: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/26.jpg)
Many dimensions of simplicity and complexity.Scala itself is a relatively simple language.
Grammar is somewhat smaller than Java or C#.
Scala concepts are very general and orthogonal.
They can be combined in a large number of ways.
![Page 27: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/27.jpg)
Scala is different from mainstream languages.
C/C++, Java, C#, etc.
Scala libraries & tools takes different approach.
simple-build-tool, specs, Lift framework, etc.
Learning Scala is not difficult.
![Page 28: Lessons Learned: Scala and its Ecosystem](https://reader036.vdocuments.net/reader036/viewer/2022062703/554f3c3fb4c905cd048b513a/html5/thumbnails/28.jpg)
06 Questions & Answers