Scala vs. F#, Round 2: Application Programming Features

When comparing the Scala and F# programming languages, the characteristics that most interest mainstream developers are likely those that are typical to development environments, such as:

Use and availability of frameworks for Web, GUI and database development

Support for object orientation

Properties of the runtime environment

In this second installment of my Scala and F# language comparison, I describe how each language stacks against the other in these areas -- with the caveat that it is difficult to compare two languages thoroughly and justly when one (officially) runs on only one platform. F# is implemented by Microsoft and made available only for Microsoft's Windows platform, while the open source Scala is available to all platforms. However, Scala is compiled to Java as an artifact and therefore interpreted through Java's virtual machine system.

Editor's Note: This is the second article in the Scala vs. F# series. The first installment compared Scala's and F#'s functional programming features.

Scala vs. F#: Application Development Frameworks

F# is a Common Language Runtime (CLR)-compliant language that is part of the .NET development toolset, which makes it suitable for all typical application development tasks. In fact, .NET developers can develop, debug, test and deploy F# programs as CLR executables through Visual Studio (2008 and later) in the same manner as they would C#, C++ or Visual Basic programs.

What differentiates F# from other .NET languages is the immutable, stateless nature of its functional execution. This attribute makes F# better suited for scientific, massively parallel and high-performance computing applications. Beyond functional programming-specific tasks and syntax, F# programs also have access to .NET DLLs, which are accessed and used in the same manner as they are used in other .NET programs.

Scala, being an open source, Java-compliant and Java-compiled language, is available for all operating systems that support Java. Scala development plugins and syntax-definition files are also available for most of the popular text editors and IDEs, including NetBeans, Eclipse and IntelliJ's IDEA.

Database Operations

F# database-access routines are part of the core language, and they are accessed through the System.Data and System.Data.SqlClient libraries. F# database-access implementation depends on the underlying ADO.NET mechanisms and configuration at the .NET runtime.

As Scala runs on top of a Java Virtual Machine (JVM), it leverages Java's JDBC. Database routines are invoked either directly through JDBC or through other Java or third-party database extensions. There are several Scala-specific, third-party open source libraries available for this purpose, but I cannot attest to their maturity and stability.

GUI Development

GUI development in F# is fully supported through .NET's WinForm library. The GUI development API resides in the System.Drawing and System.Windows.Forms libraries, which are standard shared .NET DLLs.

GUI development in Scala is accomplished through Java Swing. As with JDBC, access to Swing features and APIs is done in Scala syntax, so the Swing development feels natural to Scala programmers.

Web Development

Web development in F#, like database access and GUI development, is accomplished through the shared .NET System.Web library. ASP developers can specify F# as one of their server-side languages and then implement the HTTP-handling logic entirely in F#.

Scala does not feature any specialized Web development components. However, mature Scala-based, third-party frameworks are available for Web development. At the time of writing, the Lift Web framework was the best known and best-established framework for developing Web-based applications in Scala.

Page 1 of 2