(robertf?)?beeger\.(net|info|org)

The Ravings of Robert F. Beeger

Ender’s Game

It’s now over 20 years since I first read “Ender’s Game” by Orson Scott Card. I remember that I was searching the science fiction shelf in my local library for something new to read when the german translation of “Ender’s Game” caught my eye.

It was one of those books you start reading and only stop to go to sleep or eat something. It had it all: a gripping story, characters you could identify with and a cool setting. Although I nearly never reread books since there are so many interesting ones I haven’t read yet, I just thought to myself “Wouldn’t it be cool to read it again” and bought it in the kindle store. And as before I read through it until I finished it.

Nowadays books like “Ender’s Game” are categorized as “Young Adult” books. It’s not a hard science science fiction book. The plot isn’t overly complicated, but it has it’s fill of philosophy. It’s also a book that is easy to read. But despite being like that or perhaps because of it, it’s a recommendable book even for the no longer quite so young adult.

In the nearly 30 years since it’s publication Orson Scott Card has written some sequels  and prequels and stories taking place at the same time as the original book.

There are some reoccurring elements in those books, but nonetheless they are all at least entertaining and definitely good reads. In my opinion the best of the Ender books is “Children of the Mind”. It comes with several new ideas not seen in the other books and the story is as gripping as the original one.

There are rumors about a movie based on “Ender’s Game” and I wonder what it will be like. Most movies based on science fiction novels are just action movies in a science fictional setting. There’s much action in that book that can make an action movie, but I hope they won’t cut out the profound parts.

dahlia – a unit testing framework for Dart

When I started experimenting with Dart some time ago, I looked around for some pointers on unit testing with Dart and found a post on a blog titled “Test Driven Dart Development” and a Google Docs page. Both describe a unit testing framework that is not part of Dart’s standard library but can be downloaded from the Subversion repository of Dart.

I downloaded it and started writing my first tests. I didn’t like that it used a style that I perceived as being inspired by JUnit 3, though. It also has a nice grouping feature, but groups looked a bit to unspecific to me.

At it-agile, the company I work for, everyone gets 30 slack days per year we can use however we want — as long as it has some connection to agile software development. So I decided to invest some slack days and try to implement my own testing framework. I wanted it to use matchers like the ones provided by Hamcrest. I liked that grouping feature of the existing testing framework but wanted to give it more meaning. As I pondered this I remembered that my colleague Sebastian Sanitz once introduced me to a JavaScript testing framework named Jasmine and upon revisiting it, I decided to build something similar for Dart.

As it is inspired by Jasmine and is implemented in and for the Dart programming language, I named it “dahlia”. Like “jasmine”, “dahlia” is the name of a kind of plant and its name start with the same two characters as “dart”.

A dahlia test looks like this

describe('two equal strings', () {
 it('should be equal', () => expect('test').to(equal('test')));
});

Like in other BDD testing frameworks (the most widely known being RSpec), the describe-part describes something that will be tested and the it-part specifies and tests the behavior of the tested object. So you read this text “two equal strings should be equal”.

The parameter to expect() is the actual value, the one you want to test. Typically you call a method on the tested object here and test whether it mets your expectation. The testing part is the parameter of the to method. It is a matcher. Here an equal matcher is used that simply tests whether the actual value equals the expected value which is passed as a parameter to the matcher. Currently there are only a few basic matchers but the number of available matchers will be expanded in the near future. It’s fairly easy to implement your own matchers should the need arise. You just need to implement the Matcher inferface and provide a convenient function like the equal-function in this example to provide a new matcher.

The expect-part is – similar to the describe- and it-parts — meant to be easily readable. In the example this leads to “expect ‘test’ to equal ‘test’”. The it-function takes a function as its second parameter. In many cases those will be simple one line functions like the one in the example, but if some setup code is necessary, a full multi-statement function can be passed here. The it-call is also called a specification as it defines a behavior and a test for it. Every it-call is therefore counted as a “spec”. The total number of specs, of failures — failed expectations – and crashes — any other exceptions that may occur — is displayed at the end of a testrun.

Currently there is only one reporter that prints the test run results to the console — be it the Dart VM console in DartEditor or Dartium or the script console in any browser –, but other reporters that  create HTML and other formats will be added later. As dahlia is currently ment to be used for unit testing, the output to the console is the kind of output one needs the most.

dahlia is available at GitHub. If you are interested in Dart or are already developing with Dart, please take a look at it.

 

Dart

Some time ago as I was looking into JavaScript frameworks for the development of mobile web applications I stumbled upon Google Closure. Compared to jQuery and jQuery mobile Google Closure is a somewhat underhyped toolset for the development of client-side web applications.

Several features of Closure made me take some time to dive into it:

  • The closure library contains many small useful frameworks that fit together. So there is no need to mix and match different frameworks for functional programming, ui composition etc.
  • There is a working module concept. You can separate your application into different parts and specify which of the many frameworks in the closure library you really need.
  • You can use static typing and there is a compiler that checks it. So many errors can be found by the compiler. You don’t have to find them while running the app in the browser.
  • Since the compiler knows what is used from the huge closure library and your own code, it can delete unused code from the compiled application and run some other advanced optimizations that make the resulting code much smaller and faster.

Especially the static typing and having a compiler that checks the code before it is executed, appealed to me. Debugging in a browser is quite comfortable nowadays but if there is a chance to get rid of bugs without having to debug, I’ll take it. As someone having developed in Java for over a decade now, using an IDE and a compiler feels natural to me.

But there is a downside. The static type information for Closure has to be typed in into comments since JavaScript itself as a dynamically typed language doesn’t provide any constructs for this. Having to put type annotations into comments is quite cumbersome and after some time my initial enthusiasm for Google Closure somehow waned. Was it really worth the additional effort?

Dart seems to be the answer for all those loving Closures’ features while disliking the notation needed to get them. Dart is a new class-based language by Google created for the development of client-side web applications.

Dart has optional static typing. You can provide static typing information and if you do, the compiler that generates JavaScript from your Dart code, will check it. If you choose not to provide that information, it will obviously not be checked.

Static typing in Dart only affects compilation. It isn’t used while running a Dart based application.

Dart also comes with real classes and inheritance among them. The notation for classes and inheritance is much simpler than the prototype-based notation in Closure. It all just looks cleaner and more readable in Dart than it does in a Closure class.

The Dart team provides an Eclipse-based IDE for Dart called Dart-Editor. It’s still in the alpha phase and lacks many features that simply belong to a good IDE like refactoring support, but even in this very early stage it’s useful for the development of Dart applications and the exploration of the Dart libraries.

Currently much is happening in the Dart universe. The language is far from fixed. Frequently new proposals or changes that will break code from a month before are announced. Some weeks ago for example a change of the meaning of the == operator was proposed. Currently Dart is not for the faint of heart but it’s fun.

The End of The Mongoliad

My subscription for The Mongoliad ended a few days ago and I did not renew it.

My initial enthusiasm for it melted away after half a year. I haven’t read a single chapter since June or maybe even May. Serial novels don’t seem to work for me. I prefer to read a book at my own pace. I just cannot stand to have to wait for the next chapter for a week or maybe even two or three weeks.

It’s the same with tv series. I watch the first episode and maybe the next two. Then I get impatient and if the series isn’t really gripping or otherwise fascinating, I don’t watch it anymore.

I had expected that The Mongoliad would keep me reading longer because Neal Stephenson is part of it, but somehow it isn’t like any other book from him.

I suspect that either he doesn’t participate in the writing of the book or that the serial character of the book isn’t doing it any good.

Though I don’t know anything about writing fiction books, I can imagine, that it’s quite hard to write a book if you cannot return to an earlier chapter and fix a part or add something to make the whole book work better. The Mongoliad looks — at least to the point where I left it — like a cronologically sorted collection of stories about some people. The stories themselves are OK, but somehow there is something missing, something that makes me want to read on.

Pinboard

When rumors came up that Yahoo would shut down Delicious some time ago, I started searching for an alternative online bookmark management solution. Finally I came across Pinboard and signed up for an account. Importing all my Delicous bookmarks was a piece of cake and the interface looked nice and clean.

Then Delicious wasn’t shut down. It only got sold to another company. So somehow I returned to Delicious. I don’t have many bookmarks. I collected 350 of them and sometimes there are weeks when I really don’t add a new one. So it’s not as if the bookmark manager were a vital tool for me.

Anyways Delicious started to irritate me a bit recently. It looks bloated and they seem to add features I don’t really need. So I returned to Pinboard recently and will probably stay there. It still has the clean and nice interface and a useful mobile variant of it. The feature set  hasn’t changed for ages, but as it’s good as it is it doesn’t need to.

There’s one difference to Delicious that will matter to some people. For a Pinboard-account you have to pay a one time sign up fee of currently 9,51 $. The fee is getting increased by one cent for each new account.

In case of being interested you can browse my public bookmarks at Pinboard.