background preloader


Facebook Twitter


Ted Neward on why Java developers need Scala. Scala often gets lumped in with dynamic languages like Groovy and Jython, but in fact it is a very different creature -- a statically typed functional-object hybrid language written for the JVM. In this talk with Andrew Glover, Ted Neward explains the difference between functional and object-oriented languages and what you can naturally do with them. He then discusses some important domains where Java and other purely OO languages simply are not a good fit, including concurrency and database programming -- both areas where Scala really shines. You'll also learn about lift and some of the highlights of Scala syntax, in this discussion with the author of "The busy Java developer's guide to Scala.

" Back to JavaWorld's Java Technology Insider. Scala Syntax Primer. Scala runs on the JVM and can directly call and be called from Java, but source compatibility was not a goal.

Scala Syntax Primer

Scala has a lot of capabilities not in Java, and to help those new features work more nicely, there are a number of differences between Java and Scala syntax that can make reading Scala code a bit of a challenge for Java programmers when first encountering Scala. This primer attempts to explain those differences. It is aimed at Java programmers, so some details about syntax which are the same as Java are omitted.

This primer is not intended to be a complete tutorial on Scala, rather it is more of a syntax reference. For a much better introduction to the language, you should buy the book Programming in Scala by Martin Odersky, Lex Spoon and Bill Venners. Most of these syntax differences can be explained by two of Scala's major goals: Scala as the long term replacement for java/javac? Don't get me wrong - I've written tons of Java over the last decade or so & think its been a great evolutionary step from C++ and Smalltalk (lots of other languages have helped too like JavaScript, Ruby, Groovy, Python etc).

Scala as the long term replacement for java/javac?

However I've long wanted a long term replacement to javac. I even created a language to scratch this itch. Java is a surprisingly complex language (the spec is 600 pages and does anyone really grok generics in Java?) , with its autoboxing (and lovely NPE's hiding in there), primitive types, icky arrays which are not collections & general lack of polymorphism across strings/text/buffers/collections/arrays along with extremely verbose syntax for working with any kind of data structure & bean properties and still no closures (even in JDK7) which leads to tons of icky try/catch/finally crapola unless you use frameworks with new custom APIs & yet more complexity. Java even has type inference, it just refuses to use it to let us save any typing/reading. Scala By Example. Scala. Code Commit: Roundup: Scala for Java Refugees. 13 Feb 2008 To be honest, I’m somewhat kicking myself for writing this post.

Code Commit: Roundup: Scala for Java Refugees

As I’ve said many times: roundup posts are for people who are too lazy to write real content. I can’t tell you how many blogs I’ve come across which have a roundup-to-post ratio of easily 3:1. You know it’s a bad sign when sites start having roundups of their roundups… Meta-roundups aside, I decided (after much deliberation) that a single post linking to all six parts of the series would be useful to one or two people.

Of course it’s always possible that you subscribe to my way of looking at things. Part 1: main(String[]) Introductory article giving motivation for learning Scala and some first steps to “get your feet wet” in the language. Part 2: Basic OOP Looking at Scala’s syntax in a little more detail. Part 3: Methods and Statics Scala’s method syntax is far too powerful to cover in a single post. Part 4: Pattern Matching and Exceptions Part 5: Traits and Types Part 6: Getting Over Java.