vote up
0
vote down

Dependency Injection as Function Currying

Dependency Injection is one of the techniques that I use regularly when I am programming in Java. It's a nice way of making an application decoupled from concrete implementations and localize object creation logic within specific bootstrapping modules.
tags: scala
Mar 01 2010 11:47 AM
vote up
0
vote down

Producing candidates for a spelling corrector

The next step to implement the Bloom Filter-based spelling corrector is to create and check hash values for candidates against the filter without actually creating candidate instances. If the filter step succeeds the candidate String instances are
 
Thomas Jung
tags: scala
Feb 17 2010 01:05 AM
vote up
0
vote down

Why I don't like ActiveRecord for Domain Model Persistence

When it comes to a rich domain modeling, I am not a big fan of the ActiveRecord model. The biggest problem that it entails is invasiveness - the persistence model invades into my domain model. And this was also my first reaction to the Lift-CouchDB
tags: scala
Feb 15 2010 11:13 AM
vote up
0
vote down

Java point-counterpoint isn't actually about Java

There was a fun and wholly civil little mini-blog debate between Twitter's Nick Kalen and the OSGi Enterprise Expert Group's Roman Roelofsen this week. Kalen started it with a post called Why I Love Everything You Hate About Java, and Roelofsen responded
 
Josh Fruhlinger
tags: scala
Feb 12 2010 04:28 PM
vote up
0
vote down

Avoid using nulls in Scala

Scala's handling of null's mixed with implicit casting is quite tricky. I learned the hard way today and it took hours to figure out what was going on. First I thought it was a bug, but then someone pointed out...
 
Ilya Sterin
tags: scala
Feb 11 2010 10:02 AM
vote up
0
vote down

Building OSGi Bundles with Scala and Gradle

There already some good blog posts about how to build OSGi bundles in Scala, among others "An OSGi Bundle… built in Scala" of Neil Bartlett and "OSGi, Maven and Scala" of Gavin Bong using pax-construct. Here is another alternative using Gradle. Gradle is
 
Michael Kober
Feb 10 2010 01:26 AM
vote up
0
vote down

Groovy++ vs. Groovy vs. Java vs. Scala - Performance Update

I've been writing about a performance comparison between Java, Scala and Groovy in this and this post, where I compared the runtimes of these languages for a straight-forward (and far from idiomatic) implementation of the quicksort algorithm. As you
 
Nick Wiedenbrueck
tags: scala
Feb 09 2010 04:44 PM
vote up
0
vote down

Implementing hash functions in functional style

The first ability needed to enable filtering with the Bloom Filter-based spell checker is to produce hash values for candidates. The basic functionality is to hash a character given a base hash value from a preceding invocation. The hashFor function
 
Thomas Jung
tags: scala
Feb 08 2010 11:50 PM
vote up
0
vote down

Scala Self-Type Annotations for Constrained Orthogonality

I talked about orthogonality in design in one of my earlier posts. We had a class Address in Scala and we saw how we can combine it with other orthogonal concerns without polluting the core abstraction. We could do this because Scala offers a host of
tags: scala
Feb 08 2010 02:22 PM
vote up
0
vote down

Groovy++ Performance - Now we're talkin'

This is a follow-up of my last post, where I compared the runtimes of the quicksort algorithm implemented in Java, Scala, Groovy and Groovy++. Groovy++ came up with a significant improvement over Groovy. But there was a comment by ait (Thanks ait) on how
 
Nick Wiedenbrueck
tags: scala
Feb 08 2010 02:35 AM
vote up
0
vote down

Scala Goodness: Structural Typing

Structural typing in Scala is the way to describe types by their structure, not by their name as with other typing. Structural typing reduces coupling and the need for inheritance. In Java you would mainly use interfaces instead of structural typing. I
 
stephan
tags: scala
Feb 03 2010 06:45 PM
vote up
0
vote down

Scala Goodness: Extractors

One Scala goodness is the unapply method to extract values. Suppose we want to match a string if it does contain DogFood. In Scala we can use an object or class with an unapply method, which takes the input we try to extract values from and returns the
 
stephan
tags: scala
Jan 27 2010 05:45 PM
vote up
0
vote down

Getting around static typing in Scala

I really like static typing, but sometimes it can get in your way. For instance if you have a collection of objects and you want to perform an operation on the objects of a certain subclass you can run into problems.
 
Jan Kronquist
Jan 24 2010 01:13 AM
vote up
0
vote down

Scala Goodness: RichString

Scala is a marvelous beast. Fire up the Scala shell and enter: scala> "capitalize" res0: java.lang.String = capitalize scala> "capitalize".capitalize res1: String = Capitalize How can that be? "capitalize" is of type java.lang.String, and the Java class
 
stephan
tags: scala
Jan 20 2010 05:05 PM
vote up
0
vote down

Why overrideable tail recursive methods must not be optimized in Scala

Suppose you define a tail recursive method x in a object A. You can use the @tailrec annotation to mark methods you expect optimization of the tail recursive code to happen. import annotation._ object A{     @tailrec def x(i : Int, s :
 
Thomas Jung
tags: scala
Jan 19 2010 03:41 AM
vote up
0
vote down

Using SBT on your Scala Maven project for continous testing

Continuous testing is the practice of rerunning test cases whenever you change source code. Its a great way to write code in a mostly test-first way and it gives you very rapid feedback as you change code.It can take a while to rebuild & rerun tests
tags: sbt scala
Jan 13 2010 08:20 PM
vote up
0
vote down

Scala Goodness: Tuples

Scala has a wonderful feature: Tuples. As others have already written, tuples are very simple but powerful. Especially if you come from Java, they solve some problems easily, that were ugly in Java. What are tuples? Tuples are containers for values. In
 
stephan
tags: scala
Jan 12 2010 02:02 AM
vote up
0
vote down

A decent Bloom Filter in Scala

The Bloom Filter is an interesting probabilistic data structure. Its main advantage is that the Bloom Filter drastically reduces the memory consumption. It produces false positives. Which means that it falsely states that a value is contained. On the
 
Thomas Jung
tags: scala
Jan 10 2010 07:15 PM
vote up
0
vote down

Peter Norvig's Spelling Corrector in Scala

This is a Scala version of Peter Norvig's spelling corrector. Reading his essay I realized that Python is quite a nice language and similar to Scala due to the support of for-expressions in both languages. Before that I've seen Python as a strange
 
Thomas Jung
tags: scala
Jan 10 2010 07:14 PM
vote up
0
vote down

The best Scala IDE: IntelliJ IDEA

After years and years of using Eclipse (after Netbeans, JBuilder, Visual Cafe, Emacs and other spooky Java "editors") IntelliJ IDEA is powerful, convenient and simple to use IDE for Scala development. Oh, yes it's free: IntelliJ IDEA Community edition. I
 
Thomas Jung
tags: scala
Jan 10 2010 07:14 PM
vote up
0
vote down

How to setup a Maven Scala project with IntelliJ IDEA support

Setting up a Maven and Scala project with IDEA is simple. Install IntelliJ IDEA Community Edition and the Scala plugin (File -> Settings -> Plugins -> Available). Generate your maven project using the simple Scala archetype: mvn
 
Thomas Jung
tags: scala
Jan 10 2010 07:13 PM
vote up
0
vote down

Lift from a Wicket Developer's Perspective

I've been messing around with Scala again lately. After learning the basics of the Scala language, I decided to have a look at the lift web framework - "the simply functional web framework". In this highly subjective post I will outline, why I'll stick
 
Nick Wiedenbrueck
tags: scala
Jan 07 2010 08:47 AM
vote up
0
vote down

C# vs. Clojure vs. Ruby & Scala

Short preface: at a job interview, Zach Cox was told to aggregate words and word counts from a bunch of files into two files, sorted alphabetically and by word count respectively, which he did in Ruby and Scala. This led Lau Bjørn Jensen to do the same
 
mookid
Jan 07 2010 01:57 AM
vote up
0
vote down

Anatomy of a Flawed Clojure vs. Scala LOC Comparison

Update: The author of the post did the same biased LOC counting with Python vs. Clojure – Dhananjay Nene has a nice post about the Clojure/Python comparison Update 2: He did it with Java and PHP too. What a diservice to Clojure. I’ve came
 
stephan
tags: scala
Jan 06 2010 02:33 AM
vote up
0
vote down

Heap Sort in Scala

Heap sort is one of the more efficient sorting algorithms, being that it sorts in constant space (not including the memory space of course to store the n elements). Elements are sorted in place, though the constant space O(1). Total...
 
Ilya Sterin
tags: scala
Jan 05 2010 04:13 AM
vote up
0
vote down

Pragmatics of Impurity

James Hague, a long time Erlanger, drives home a point or two regarding purity of paradigms in a couple of his latest blog posts. Here's his take on being effective with pure functional languages .."My real position is this: 100% pure functional
tags: scala
Jan 04 2010 12:38 PM
vote up
0
vote down

A little toy in Scala

Proving that with a little help from tools like JarJar and Pack200, an applet written in Scala will come in somewhere between and IronPython and an F# Silverlight equivalent, considering the weight of infrastructure code that gets dragged along to
tags: scala
Dec 31 2009 01:42 AM
vote up
0
vote down

Scala Goodness: Compound Types

Scala is ideally suited for programming in roles because it does features traits. Think of Traits like interfaces in Java with implementation code. Say you have a dog: class Dog { def call() { println("Comes to you") } def feed() { println("Feeds") } }
 
stephan
tags: scala
Dec 30 2009 09:50 PM
vote up
0
vote down

Insertion Sort in Scala

Here is an implementation of insertion sort using Scala. Learning the ins/outs of Scala idioms and collections. import scala.util._ import scala.collection.mutable._ object InsertSort { def main(args: Array[String]) : Unit = { val list:ListBuffer[Int] =
 
Ilya Sterin
tags: scala
Dec 29 2009 09:39 PM
vote up
0
vote down

A quick Scala gotcha

Wouldn't it be nice, I thought, to be able to put UI decoration as a mixin to any sort of component, like trait HasImage { def image : java.awt.Image } trait Tiled { self : scala.swing.Component with HasImage => peer.setOpaque(false) override def
tags: scala
Dec 28 2009 09:30 PM
vote up
0
vote down

Daily Scala

Jesse Eichar writes a daily blog about Scala. "A short daily dose of Scala examples and occasionally explanations". Everyday a nice read about Scala. I've added it to my newsreader and if you like Scala, you should do too!
 
Daan
Dec 20 2009 05:23 AM
vote up
0
vote down

The Next Big Language is..

Ok, I hooked ya there didn’t I? Jeff Brown mentioned some surprise today at hearing that Scala had been anointed as Java’s “heir apparent”. I say that there will be no “next Java”. Get over it people. There is no
Dec 16 2009 11:23 AM
vote up
0
vote down

Scala, Groovy - A Comparision

Function Groovy Scala Typed Language It is dynamically typed and also supports dynamic meta-programming. It is statically typed and has no dynamic meta-programming.  Also it is typed inferred. Influence Syntactically influenced by Java but
tags: scala
Dec 15 2009 07:12 AM
vote up
0
vote down

Scala, Groovy - A Comparision

Function Groovy Scala Typed Language It is dynamically typed and also supports dynamic meta-programming. It is statically typed and has no dynamic meta-programming.  Also it is typed inferred. Influence Syntactically influenced by Java but
tags: scala
Dec 15 2009 06:13 AM
vote up
0
vote down

Packaging Scala applets into one jar in NetBeans with JarJar

Pretty much a note to self; using NetBeans that started off as 6.7.1, but has the bleeding-edge depot, and using a Scala 2.8 nightly, FWIW. Get the jarjar tool; put it and a copy of scala-library.jar and scala-swing.jar in a lib directory under the
tags: scala
Dec 13 2009 05:37 PM
vote up
0
vote down

Scala - Pros and Cons.

        Scala, which stands for Scalable Language, is a programming language that aims to provide both object-oriented and functional programming styles. It runs on Java Virtual Machine (JVM) and was designed in 2001 by
tags: scala
Dec 12 2009 10:17 AM
vote up
0
vote down

Scala - Pros and Cons.

        Scala, which stands for Scalable Language, is a programming language that aims to provide both object-oriented and functional programming styles. It runs on Java Virtual Machine (JVM) and was designed in 2001 by
tags: scala
Dec 12 2009 10:17 AM
vote up
0
vote down

Merge sort implementation and performance in Scala and Ruby

I'm not trying to turn this into language A vs. B debate, its just that something interesting happened last night. I'm trying to learn both Scala and Ruby. I'm a bit more enthused by Scala at this point, mostly because...
 
Ilya Sterin
tags: scala
Nov 26 2009 09:58 PM
vote up
0
vote down

a groovy scala example

So my last post caused a bit of a stir (though some excellent comments!). Sorry about that! :) I think a few folks got the wrong end of the stick thinking my post was some kinda put down of dynamically typed languages. I still like Groovy/Ruby/JavaScript
Nov 21 2009 01:10 PM
vote up
0
vote down

A Scala Console with JavaFX (Experimental)

It's been a while ago, when I started implementing a Scala console with JavaFX. And orginally I've never thought about publishing it, because it was (and still is) an experimental, personal project. But today I started playing around with it again, and I
 
Nick Wiedenbrueck
tags: scala
Nov 17 2009 10:37 PM