The point is missed

Museum of public mistakes and unfinished projects

Archive for September 2008

Phasing over from java to scala pt. 4 – Writing specs with specs

with 7 comments

In the last part I figured out how to make Buildr run specs that are also runnable from Eclipse via JUnit. I started writing my first spec and we are now in the position to make it fail. What we are trying to acomplish is to make directories behave as nodes in a graph, at the moment, only the files show up as nodes.

The spec I wrote currently looks like this:

class PublishSiteGraphSpecTest extends JUnit4(PublishSiteGraphSpec)
object PublishSiteGraphSpec extends Specification {
  "directories are nodes" in {
  }
}

Let us fill in the details about what we actually mean when we say that directories should be nodes:

Read the rest of this entry »

Advertisements

Written by johlrogge

September 14, 2008 at 10:05 pm

Posted in Uncategorized

Tagged with , , ,

Buildr – Keeping up with the latest and greatest

with one comment

In a previous post I ran into some problems with Buildr’s support for Specs in combination with JUnit. I googled a bit and came up with nothing so I did what all newbies do. Ask the pros on the mailinglist :) (I stayed away from “plz help” and “could you plz send me a patch”). I was (of course) suggested to try the latest from head and I felt an unpleasant resistance towards downloading archives, figuring out how to point gems to the latest version etc. All of those things are probably simple but I just want to develop some Scala code and did not look forward to it.

Well, boy was I worrying in vain!

Read the rest of this entry »

Written by johlrogge

September 13, 2008 at 1:49 pm

Posted in Uncategorized

Tagged with , , ,

Scala Nugget – implicits to make java blend into Scala

with 2 comments

Most of my posts related to Scala so far have been quite long and unpolished I have intentionally kept them that way since I wanted to give a feel for what i is really like to make the shift, including the dead ends.

During the work of converting Java to Scala I have stumbled over some things that I found to be extra cool, nuggets. I’ll try to post them here from time to time.

The first nugget is about implicits. Implicits are so cool that I think I will shoot myself in the foot with them many times so let’s start now. One piece of java-code that I converted looked for module descriptions on the class-path. The code looked something like this:

Read the rest of this entry »

Written by johlrogge

September 11, 2008 at 9:06 pm

Posted in java, scala

Tagged with , ,

Phasing over from java to scala pt. 3 – What about the tests?

with 2 comments

I’ve now spent some time every now and then converting Java-classes into Scala classes. I’m one of those Agile loudmouths so some of you may wonder what I’m doing about the tests. I mentioned that all tests pass in pt. 2 but I have not written about how I test. Well, it probably comes as no surprise that the current code is tested in JUnit and I have simply kept my old test-suite intact when phasing over. This strategy works well since what I’m really doing is refactoring. I move class by class in baby steps, running my tests after each change to make sure that everything is still working as it should. But I’m starting to be done with the move now and a strategy for writing new scala-code seems more and more relevant.

Read the rest of this entry »

Written by johlrogge

September 10, 2008 at 9:44 pm

Posted in Uncategorized

Tagged with , , , ,

Bad farming and recession

with 2 comments

Ok bad times are coming they say, recession is on it’s way. Well that’s the laws of economics, not much we can do about them. Or is it? Before I continue I want to be clear about that most of the fields I touch on here are generally not fields I posses any special expertise in (not that it shouldn’t be totally clear to those of you who do but…). I used to think of economic recession as mass-psychosis: media starts writing about bad times ahead, stupid people like me write blogs and talk over lunch about whether it will or will not happen. As a consequence of that people become wary and start buying less and less “you never know”, “the experts say…”. There you go, self-fulfilling prophecy.

I still believe that there is truth in that but I would not mind being corrected by anyone who actually knows. From what I understand the cause for recession is a bit of a mystery even for the pros :) Anyway, as a software guy in the consultant business I found myself in the center of the last recession and now that the word is out I started pondering what we as a business may be doing to cause them.

Read the rest of this entry »

Written by johlrogge

September 5, 2008 at 7:50 pm

Phasing over from java to scala pt. 2 – Buildr

with 2 comments

Yesterday I started converting parts of my pet-project to Scala. Without any other ambition than to make the java-class compile in Scala, roughly 30 lines of java-code became 18 lines of Scala code! Most of the save could be attributed to constructor properties that removed the need for declared fields and assigning them in a constructor. I also managed to run my old test-suite with my new scala replacement together with the rest of the java-code in eclipse. Talk about seamless transition! Read the rest of this entry »

Written by johlrogge

September 2, 2008 at 5:13 pm

Posted in java, Ruby, scala

Tagged with , , ,

Phasing over from java to scala pt 1

with 6 comments

What do you do when you have all of these cool ideas for new projects and no time? How do you find the time to also keep yourself updated on the latest and greatest languages out there? Well, you would have to ask someone else because I don’t know. But I thought to give the nike way a try and just do it. I have a pet project called Agical publisher. I won’t bore you with the details of that project, maybe in some other post but what is relevant for this post is that I spend some time on it and it is written i Java.

Read the rest of this entry »

Written by johlrogge

September 1, 2008 at 8:25 pm

Posted in java, learning, scala

Tagged with , ,