InfoQ

News

New Scala Tutorials for Java Developers

Posted by Rob Thornton on Jan 30, 2008

Community
Java
Topics
Language
Tags
Scala

Scala continues to make news with two more tutorial series, one by Ted Neward at IBM’s developerWorks and one by Daniel Spiewak on his blog.

Neward’s series, The busy Java developer’s guide to Scala, has just begun, with the first installment, Functional programming for the object oriented, published last week. Spiewak started his series, Scala for Java Refugees, in early January and his fourth part, Pattern Matching and Exception Handling was published today.

Scala has been getting a fair amount of press recently (see InfoQ’s roundup of the discussion) and Neward starts his article with a section on how Java is showing its age, specifically in regards to Moore’s Law.

Actually, it’s Moore’s Law that has many in the industry particularly concerned. Since 2002/2003, the growing trend in microprocessors has been to create CPUs with multiple “cores”: In essence, multiple CPUs within a single chip. This obviates Moore’s Law, which says that CPU speeds will double every 18 months. Having multithreaded environments executing on two CPUs simultaneously, rather than doing the standard round-robin cycle on the single CPU, means that code must be rock-solidly thread-safe if it’s to survive. …The concurrency crunch is a real concern, and some of the new languages offer powerful answers, but too many corporations and enterprises remember migrating from C++ to the Java platform just 10 years ago. To move to a new platform is a risk that many companies just aren’t going to seriously consider. Many, in fact, are still nursing the scars from the last move to the Java platform.

Neward’s tutorial goes through an overview of functional concepts, then discusses how Scala provides for them and wraps up with closures. Spiewak’s series is more lengthy and goes into a lot more detail. He targets his at experienced Java developers who have heard the noise about dynamic languages but are worried about dynamic typing for building enterprise applications.

The good news is that there’s light at the end of the tunnel. There’s a new language on the scene that’s taking the developer world by storm. Scala seems to offer everything you’ve been looking for in a language: static typing, compiled to bytecode (so you can run it on all those ancient Java-capable servers), a succinct and expressive syntax. …You can write your Java applications in Scala. You just need the right introduction.

Spiewak begins with a simple Hello World example and goes on to cover iteration and built-in types in his first article. His second article covers object oriented concepts, including classes, abstract methods, and constructors. His third dives deeper into access restrictions, method overloading and Scala’s approach to statics and his most recent covers pattern matching, case statements, and exception handling.

Another blog series for beginners by Alex Blewitt Posted Jan 30, 2008 4:13 PM
Market support by Diego Visentin Posted Jan 30, 2008 5:06 PM
Re: Market support by Roger Voss Posted Jan 31, 2008 6:41 AM
Re: Market support by Joost de Vries Posted Jan 31, 2008 9:28 AM
Re: Market support by Diego Visentin Posted Jan 31, 2008 6:34 PM
  1. Back to top

    Another blog series for beginners

    Jan 30, 2008 4:13 PM by Alex Blewitt

    I wrote a series of getting started with Scala posts, for those that are interested:

    alblue.blogspot.com/feeds/posts/default/-/scala

  2. Back to top

    Market support

    Jan 30, 2008 5:06 PM by Diego Visentin

    Scala it's not the only language with actors and actors are not the only good solution for concurrency. E.g. you can use Groovy with actors extensions (groovyactors.org/), or build your solution on SCA intra-jvm middleware (incubator.apache.org/tuscany/).
    But the real issue for Scala (like every other language) is the support of one of the big-three of IT (aka IBM,MS,Oracle). Without a strong "sponsor" there are no money for develop a real market and so Scala could be the future Smalltalk: amazing for purist programmers but no market share.

  3. Back to top

    Re: Market support

    Jan 31, 2008 6:41 AM by Roger Voss

    Yeah, but there is no other viable alternative as a language on the JVM that has static typing.

    Groovy has static typing as optional - and all the tutorials for Groovy (and its proponents) illustrate using it in a mostly typeless manner - much like JavaScript.

    The next flagship language for the JVM that can take Java's place, will need to be like Java where static typing is the intrinsic nature of the language all the time.

    So far Scala is the only viable language on the JVM where that is the case.

    Also, I think a lot of Java developers are agreeing with Bruce Eckel that should no longer try to evolve Java into a functional language, as is getting too complex to change the language without unpleasant consequences/side-effects.

    So far on reason Scala is emerging is simply because there is no other suitable contender.

  4. Back to top

    Re: Market support

    Jan 31, 2008 9:28 AM by Joost de Vries

    It's very exciting to see that IBM is publishing articles on Scala. I know that doesn't spell endorsement. But maybe it's a step in the direction of one of the big parties that were mentioned above picking up Scala and donating resources and generating momentum in the market place.

    I like Scala's typing of methods for instance. Not only because it reminds me of Russells typing solution for self-referential statements from Logic courses in university.

    I'm looking forward to reading these articles.

  5. Back to top

    Re: Market support

    Jan 31, 2008 6:34 PM by Diego Visentin

    Just for information, on IBM developerWorks you can read an entire column about alternative language for JVM(search "alt.lang.jre").
    At the moment, IBM is using Jython (WebSphere scripting lang), Javascript (Lotus products) and Groovy (ProjectZero). If you are interested about concurrency/parallelism take a look at X10 language (www.research.ibm.com/x10/).
    About static typing: it's easy to say that is more fast than dynamic approach but the code that a "normal" programmer use to write is less than the entire running application (e.g. think about J2EE environment) so for middleware like ProjectZero a dynamic lang is good enough and write logic is more "agile".

Educational Content

Brian Marick on 4 Challenges and 5 Guiding Values of Agile Software Development

Brian Marick takes us through a quick tour of the most important values and challenges to adopting Agile successfully (they aren't the typical challenges and values we hear in the community).

Are You a Software Architect?

The line between development and architecture is tricky. Does it exist at all? Is an ivory tower actually needed? There's a balance in the middle, but how do you move from developer to architect?

Agile – A Way of Life and Pragmatic Use of Authority

The word 'authority' sometimes produces an allergic response in hard-line agilists. Freedom and authority – both are bad if misused and both are good if used in right spirit for a noble cause.

Getting Started with Grails, Second Edition

"Getting Started with Grails" brings you up to speed on this modern web framework. Companies as varied as LinkedIn, Wired, and Taco Bell are all using Grails. Are you ready to get started as well?

Using ITIL V3 as a Foundation for SOA Governance

Those familiar with only ITIL V2 often scoff at the thought that ITIL could serve as a governance framework for SOA. With ITIL V3, the focus of the framework shifted towards service-orientation.

Adrian Colyer on AspectJ, tc Server and dm Server

SpringSource CTO Adrian Colyer discusses AspectJ, SpringSource's dm Server and tc Server products, OSGi and Scrum.

Adam Wiggins on Heroku

Heroku's Adam Wiggins talks about Rails, Background Jobs, Add-Ons, Ruby, and how Heroku manages to work around Ruby's inefficiencies using Erlang and other languages.

SOA as an Architectural Pattern: Best Practices in Software Architecture

For Grady Booch the foundation of a good architecture is patterns, SOA being just one of many patterns. In this Second Life presentation, Booch attempts to bring more clarity on what architecture is.