RubyConf India


I am part of a team at ThoughtWorks helping out organizing the very first RubyConf in India. I’m very excited about this. So if you have the possibility to come to Bangalore, the event will be March 20 and 21.

We already have some solid speakers lined up. Chad Fowler will keynote, and so will I, and we have a number of other people coming in. A few of my colleagues from ThoughtWorks, such as Sarah Taraporewalla, Sidu Ponnappa and Aman King. Other speakers include Hemant Kumar, Pradeep Elankumaran, Arun Gupta and others. Finally, Nick Sieger will also come to Bangalore for this event!

So as you can see, this is gearing up to be a great event! Hope to see you there.



Ioke P released


I am very happy to announce that Ioke P has finally been released!

Ioke is a language that is designed to be as expressive as possible. It is a dynamic language targeted at the Java Virtual Machine. There also exists a version for the CLR. It’s been designed from scratch to be a highly flexible general purpose language. It is a prototype-based programming language that is inspired by Io, Smalltalk, Lisp and Ruby.

Homepage: http://ioke.org
Download: http://ioke.org/download.html
Programming guide: http://ioke.org/wiki/index.php/Guide
Wiki: http://ioke.org/wiki

The two specific releases that encompass Ioke P are ikj 0.4.0 and ikc 0.4.0.

Ioke P is the fourth release of Ioke. It includes many new features compared to Ioke E:

  • Number Infinity
  • eval
  • Reflector
  • Hooks
  • First class Runtime
  • New parser
  • Tuples
  • Structs
  • Destructuring assignment
  • Message rewriting
  • Functional composition
  • Sequences
  • Dictionary and Set versions of Enumerable methods
  • Enumerable group, Enumerable groupBy
  • Set operations for union, intersection, membership, subset and superset testing
  • ISpec stubbing and mocking
  • IIk history
  • DokGen on separate projects

Ioke P also includes a large amount of bug fixes.

Features:

  • Expressiveness first
  • Strong, dynamic typing
  • Prototype based object orientation
  • Homoiconic language
  • Simple syntax
  • Powerful macro facilities
  • Condition system
  • Aspects
  • Java integration
  • Developed using TDD
  • Documentation system that combines documentation with specs
  • Runs on both the JVM and the CLR

The many things added in Ioke P could not have been done without the support of all the Ioke contributors. Thank you!

Regards
Ola Bini    – ola.bini@gmail.com



Path problem with Emacs on Mac OS X


One of the problems you might encounter using a native Emacs on top of Mac OS X is that your custom PATH variable doesn’t really translate into your running Emacs instance. This might show up as making it impossible to run things like Ruby or Ioke from inside of Emacs – complaining that it can’t find the executable in question.

Another thing you might notice is that your Ruby environment is messed up – all the gems you so carefully installed isn’t around, and overall things just seem weird. One thing that could cause this is when you have a custom built Ruby installation in for example /opt/local or /usr/local instead of /usr. But Emacs just seems to pick up the original versino that shipped with OS X.

The reason for all these weird behaviors is that if Emacs is started from the Dock, or using the application directly, it doesn’t actually pick up the carefully prepared PATH variable you have in your terminal. Instead it will go ahead and use the default system PATH, which is very restrictive.

The way I prefer to solve this is to make sure that OS X plist version of the PATH variable is the same as my terminal one. I do that by resetting this plist on every login. Of course, OS X will not actually reload this without a reboot. If you just want to fix this once – and you’re reasonably sure you won’t change the path again, you can execute this command from the terminal and restart. Everything should be fine after that. The magic incantation looks like this:

defaults write $HOME/.MacOSX/environment PATH “$PATH”

(Note, I’ve had to solve this problem twice, since the first time I encountered it I didn’t blog about it. So now I’m blogging so it might also stick in my long term memory. Maybe it’s enough if it’s in my blog term memory…)



Conference Hat Trick – QCon, RubyConf, JRubyConf


I’ve just come back from several different conferences. It’s been tiring but also very rewarding. The conferences I attended and presented at was QCon San Francisco, RubyConf and JRubyConf. I thought I’d just mention some of the highlights from these three events.

First QCon – after JAOO, QCon is my favorite conference. They always manage to put together an interesting week with great speakers and lots of things to learn. This year, me and Martin Fowler did a full-day tutorial about domain specific languages.

During the Wednesday I spent most of my time hanging out and chatting with people. I did attend Josh Blochs and Bob Lee’s Java Puzzler presentation. This is always an entertaining hour. I also enjoyed Douglas Crockfords keynote about the history and future of JavaScript. Hearing how this all happened is always enlightening.

On the Thursday I had my track about languages. I think it went very well, my speakers did a great job. Eishay Smith talk about Scala, Stu Halloway about Clojure, Martin Fowler about Ruby, Jonathan Felch about Groovy and Amanda Laucher and Josh Graham about F#. I’m very happy with how it went, actually.

During Friday I mostly sat in on Neal Fords DSL track. My colleague Brian Guthrie started out with a strong hour about internal DSLs in various languages. Ioke got a few code examples, which was fun. After that Neal and Nate Schutta talked about MPS. I haven’t seen this much detail about MPS before so it was helpful.

After lunch Don Box and Amanda Laucher did a talk about the technology formerly known as Oslo. I didn’t think this tech was anything cool at all until I saw this presentation. In retrospect this was probably my favorite presentation of the conference. What came together was how you can use M as a fully typed language with some interesting characteristics, and also the extremely powerful debug features. It’s nice indeed.

Glenn Vanderburg put forward some arguments against language workbenches. This made for an interesting hour but I’m not entirely sure I buy his arguments. And after that Magnus Christerson from Intentional showcased what they’ve been working on lately. Very impressive stuff as usual.

I only spent one day at RubyConf, but it was still enough to get a feeling for what was going on, spend some time with several people I haven’t met before and so on. Good times. Charles Nutter did a very good presentation about his Ruby mutants (Duby and Surinx). After that Ryan Davis and Aaron Patterson did a hilarous presentation about weird software.

JRubyConf was a total success. All of the presentations were very interesting, and provided insight into what people liked about JRuby and what they wanted from it. It was fantastic to see so many people come together just for JRuby. It’s great to be part of that. I did a presentation about testing with JRuby, and then I was part of the closing panel. Both went well.

All in all a great week of conferences.



QCon San Francisco, RubyConf and JRubyConf


I’m gearing up for the next conference stretch. This time it’s San Francisco next week, and I really hope to see lots of people at these conferences – they are gearing up to be something special.

First QCon San Francisco. Except for JAOO, QCon is the best general developer conference I’ve ever been to. Go check out the schedule at http://qconsf.com. This year I’m very excited about doing a full day tutorial about domain specific languages together with Martin Fowler.

I’m also in charge of the languages track, where I have five people who will talk about their experiences with different languages. This time there will not be much introduction to the languages, but instead experience reports, objective descriptions of what worked, what didn’t work and how you can improve your chances of success. The languages covered are Scala, Clojure, Ruby, Groovy and F#. Should be great fun.

Hopefully I will have lots of time to see other presentations too. There are many I would love to see. ThoughtWorks also happens to be a sponsor of QCon, so there will be a booth where it’s a big possibility you can find me or my colleagues.

I will do one day of RubyConf – the Saturday. Funnily enough I haven’t ever been to RubyConf, so I’m looking forward to this too.

Finally, the first ever JRubyConf will happen next Sunday. The program looks really interesting. I’m going to be talking about testing, and also be part of the ending JRuby Core Team panel.

I’m very excited about these conferences. Hope to see you there!



A week at Øredev


I just came back from 10 days in Malmö, Sweden, for the Øredev conference. I’ve had a great time. Part of that was because I had Stella with me, and she got to meet all my conference-friends, so that was nice.

But a big part of it is basically just the fact that Øredev is an outstanding conference.

Some of my impressions, things I learned and did in no specific order:

  • Hadoop is really cool and I wish I had time to learn more about it. Alex Loddengaard from Cloudera did a very good job introducing this technology in his tutorial. We got to do way fun stuff!
  • People liked my talk about Ioke – and I was very happy with how it went too.
  • Stuart Halloway is really good at introducing Clojure – I’m looking forward to his talk at QCon SF even more now.
  • Me, Tyler Jennings, Neal Ford, Dan North and Stuart Halloway spent several hours of BoF time to create a new BDD framework for Clojure – this was way fun hacking, interesting from a group management and design perspective and just plain fun. There is a distinct possibility that me and Neal will give a talk at the TW US Away Day about this, if anyone is interested.
  • Ze Frank is amazing. Really great evening keynote/entertainment.
  • Niclas Nilsson and Hans Brattberg did a very accurate depiction of common problems and failure modes of pair programming. Good stuff.
  • Tyler Jennings gave an introduction to Software Craftsmanship. Glad I didn’t miss this presentation. Very nicely done.
  • Kevlin Henney did a great presentation about agile modeling. I enjoyed it a lot.
  • We did a very fun closing panel that was basically just six geeks disagreeing about lots of stuff. I hope everyone else enjoyed it as much as the panel members.

Conclusion: Øredev was a great conference, I was honored to get the chance to speak there and I’ll definitely try to go back next year.



Should languages be multi-lingual?


I’m currently sitting in the Beijing ThoughtWorks office, and for some reason language is on my mind… =)

One of the discussions related to DDD that have turned up several times the last few months at conferences
is how you handle ubiquitous language when your domain is not in English. Since most programming languages are based on English, you end up mixing English and Swedish for example, if you are working with a Swedish domain. Of course, the benefits of working with these concepts in Swedish are very hard to argue against. But the dichotomy between the programming language and the domain language is definitely something that hurts my eyes, so I’m generally not very fond of that approach.

In fact, I haven’t heard anyone come up with a good solution to this problem, and this post is not really a solution either.

One of the things I’ve proposed to make this situation better is to create an external DSL that is fully in the domain language. The implementation of that DSL can then be implemented in English. The main benefit is that there is a clear separation.between the domain language and the programming language. On the other hand, the overhead of creating the DSL and also the complexities involved in translating the domain concepts into programming language concepts can become problematic too.

One interesting idea in Cucumber is the idea that you can easily add new natural languages to write the features in. When it comes to user stories at the level of testing that Cucumber provides, it’s really important to use the right language. So it got me thinking, could you use the same kind of approach in a general programming language too?

As an experiment I took a small example program for Ioke, and translated it into Mandarin, with simplified Chinese characters. Of course I used Google Translate for this, so the translation is probably not very good, but the end result is still interesting. I’m not going to try to get this into my blog, so take a look at the file at github instead: http://github.com/olabini/ioke/blob/master/examples/chinese/account.ik. As you can see there is nothing in there that even reeks of English. If you don’t understand Chinese characters it is probably hard to see what’s happening here. Basically an Account object is created, with a “transfer” method and a “print” method. Further down, two instances of this Account object is created, some transfers are made, and then the objects are printed. But provided my translation is not too crappy, this code should make sense to someone reading Chinese.

Now, this is actually extremely simple to implement in Ioke, since it relies on several of the features Ioke handles very easily. That everything is a message really helps, and having everything be first class means I can alias methods and things like that without any worry. Obviously your language also need to handle non-ascii identifiers correctly, but that should be standard in this day and age.

When thinking about it, something similar to do this can be created in languages like Lisp, Smalltalk, Factor, Io and Haskell – but most other languages would struggle. If you have keywords in your language, it’s really a killer – you would need to branch your parser to make it happen.

Of course, this approach only works when you can simply translate from one word to another. If the writing system is right to left, or top to bottom, it’s much more tricky to create a good translation.

I’m also not sure if this is actually a really good idea or not. It might be. The other thing I’ve been thinking about is how to handle multilingual editing. What if you want to be able to switch back and forth between languages? How can you handle identifiers with more than one name. Would you want to?

Lots of unanswered questions here. But it’s still funny to think about. Communication is the main goal, as usual.



Plan to write big software – and you have already lost


This idea came to me as a tweet, but was way too long for a tweet. As it turns out, it’s also something I’ve been saying a lot lately, since it’s the answer to one of the very common arguments against dynamic languages.

The argument usually goes like this: “Dynamically typed languages are fine for smaller programs and simple web applications, but if you’re building something big, something that will be several millions of lines of code, you really need all the tools you can only get from a statically typed language”. Where the statically typed language mentioned is typically Java. The argument is still common enough without any specific language name mentioned though.

Interestingly, there are several problems and fallacies in this seemingly simple argument. I’m not going to tackle all of them here, but just focus on the beginning. Namely the idea that you are building something big. First of all, how do you know that? Have you done anything like it before? And how do you know it would be big in a different language? How do you know you can’t decouple the application in such a way you won’t have to build anything big? There are so many assumptions that can be questioned here. But at the end of the day, my glib answer that summarizes this usually goes something like this:

“Optimizing for your software project becoming big is the same as optimizing a car to hit a rock wall – you are optimizing for failure”

I firmly believe that becoming big is really failure. Once you have a big enough project you have lost. It might still work, but the cost will be extreme, and maintaining it will be a large burden too.

This is the reason I like agile. It emphasizes small, working pieces all the time. If you work with code this way, you can’t really become big. Instead, your project will be forced to be modularized and divided into smaller, more logical components that are highly cohesive and decoupled from each other.



Ioke sequence support


The last two weeks I’ve been working on adding external iterators to Ioke. This work is now done and merged, so I thought I’d just describe it a bit.

But first, why do I need explicit iterators in Ioke? Ruby has gotten by without them for a long time, only implementing a Generator library using continuations, in the standard library. It’s pretty nice, since you don’t really need to do anything explicit to get external iterators from internal ones. Of course, the problem is that it’s very inefficient to implement them like this. So I decided that Ioke should have an explicit protocol for external iterators. You can implement internal iterators using external ones efficiently, but not the other way around.

The two major objects for this in Ioke is called Sequence and Mixins Sequenced. Sequenced is the mixin that gives you access to several helper methods if you implement the “seq” method. If you implement “seq” and mixin Sequenced you will also get an “each” method and Enumerable. The “seq” method is expected to return something that mimics Sequence and has one “next” method, and one “next?” method. That’s all. The “next?” method returns true if there is another element in the sequence, and “next” returns the next one. The protocol is undefined if you call “next” when “next?” would have returned false.

Sequenced give you an “each” method that in addition to the regular each-protocol will also return the result of calling “seq” if you don’t give any arguments to “each”.

Except for that, you will get several methods that just call “seq” and calls the same method on the result of that. These methods are: “mapped”, “collected”, “filtered”, “selected”, “grepped”, “zipped”, “dropped”, “droppedWhile” and “rejected”. These methods are also the same as exist on Sequence. These methods return new sequences that implement the same behavior as the methods with similar names on Enumerable.

Finally, Sequence also mimics Mixin Enumerable. Once you call one of the Enumerable-methods, the whole sequence will be realized, or as much as is necessary to give an answer. A small example of how you could use it:

(1..100000000) mapped(x, x*x) filtered(x, x % 3 == 0) takeWhile( < 10000 )

This example creates a range from 1 to 100,000,000 and finds all the squares that are less than 10,000 an d that is evenly dividable by 3.



JAOO – A great week in Århus


Late this Saturday I came home from a hard week in Århus, Denmark. Of course, it’s been a great week but it is definitely a change coming back home after it.

JAOO this year was great, just as you can always expect. What makes JAOO so fantastic is the combination of extraordinary presentations of all kinds, together with the socializing with all the fantastic speakers, and hanging out with the JAOO crew. All in all it’s a lovely time, and I never get enough sleep for some reason.

This year ThoughtWorks was there in force – we had about 12-14 people there, and 8 of us presenting. It’s always fun to be surrounded with TW people.

I’ll not go through the whole schedule, but I do want to share some of my favorites.

Rich Hickey was there, presenting about different aspects relating to Clojure and concurrency. As usual he was excellent, and I heard many good comments about both his presentations.

Intentional Software presented their Language Workbench, which I’ve been playing around with for some time. The presentation generated substantial shock-and-awe from the audience, which was fun to see.

The Tuesday featured the concurrency track, where I spent most my time. The whole track was very good, but it was capped off by Simon Peyton-Jones excellent talk about Nested Data Parallelism in Haskell, a very good presentation that meshed well with my interests. Simon is also a highly entertaining presenter. All in all, that presentation was definitely my favorite one this year.

On Wednesday the two presentations that stands out in my mind was Aino’s about design patterns – interspersed with dating design patterns. Very funny. And the other was by my colleague Richard Durnall, talking about lean.

Very nice stuff, all in all. Martin Fowler, Neal Ford and Rebecca Parsons gave another version of their DSL tutorial the following day. It’s amazing how much this tutorial have evolved since I first saw it.

On the Friday I saw parts of Sam Aaron’s Advanced Ruby tutorial; it’s good. I also gave my tutorial, which went fairly well too.

And that’s JAOO in a nutshell. A great week. It’s weird to come back after such an intense time.