Another month and another Kata with the 12meses12katas crowd. This time the kata is in Spanish, and it was created by the agilismo.es guys for the professional track of XGN2011. If anyone needs/wants a translation, do get in touch and I'll produce one. You can find the original version in github: KataLonja.
The Kata is about a Galician chap who wants to make some money by selling Scalops, Octopus, and Spider Crabs in a hired van. We are given a series of prices that markets in different cities will pay for the goods, alongside with distances, transport costs, and depreciation rates for the food, and we need to provide the most interesting route to get a best sale for our intrepid entrepreneur.
As a Galician immigrant myself, this is the simplest kata ever: I would drive the van right into my garage and the goods straight into my fridge; as easy as that!
Sadly this is not going to happen so let's get back to the kata. I'm certainly nowhere near finishing it, I only gave it a first go last night before bed but some cool stuff is already coming up out of it.
As I mentioned in a previous post, I use Katas to refresh some concepts that I haven't seen in a while, or that although I might use them in my day job, I've never gone deeper at them than the old getting the job done.
Last month I choose JavaScript for the bowling kata, and because I started way too late (the last day of the month!), that was the only implementation that I practised on the day. I will try and get this one practised in both Java and JavaScript, starting with the former.
Java has no associative arrays and it's generally accepted that you will use Maps instead. Maps can be very straight forward if you are using an immutable object as the key for your pair, but can get tricky if you decide to use your own class. So that's exactly what I did. It might not be the best fit for the problem at hand, or yield the leaner and cleaner code possible, but no one will have to maintain this code and it's going to be thrown away anyway so better have a bit of fun with it!
So I have created an immutable class for Seafood that I will be using as a key for at least two maps I'm using in other classes. That means overriding equals() and hashcode(), and being careful with state and escaping references to this. But as I said above, the code is nowhere near written, so what's the point of the post you will be asking yourself? I just wanted to share 3 links that have been helpful in digging a bit deeper in the adventure so far. They are:
In them you will find good advice on stuff such as when to create immutable classes and how, uses of immutability including the flyweight pattern, overriding equals() and hashcode(), and a great discussion on how to keep the equals() contract on extended classes, adapted from the book Programming in Scala into Java.
I will be digging a bit more, hopefully in the next couple of days, in topics such as choosing the right map implementation and a couple more things that I want to try (I'd like to write my cucumber step definitions in Ruby instead of Java but I'm not sure I can do that, so will have to find out!).
I also intend to write another post if I ever get to practise the Kata in JavaScript. Comparing both implementations would be cool so let's hope for that!
Thursday, May 19, 2011
Monday, April 25, 2011
SICP Study group at P2PU
As mentioned in a previous post, I have decided to learn JavaScript in a serious and deep way, and after following Douglas Crockford's advice on reading the little schemer, it's time for Structure and Interpretation of Computer Programs, also known as SICP.
Due to low numbers in the Anglo-Celt SICP Study Group, we have decided to open the group to the world through the Peer to Peer University (P2PU).
The course is still in draft but so far I've had great feedback from some of the core P2PU community members and I'm hoping that it will go ahead. You can see the draft of the course here: SICP Study group.
[UPDATE]: The course has been moved to the new P2PU site and it is now hosted here and open for application.
As usual, this is a peer to peer, community based effort, and everybody is welcome, even those of you that have read the book already. Assuming the role of mentor can be a fantastic experience, especially in terms of communication and other soft skills that are so important in our field.
To join the course all you need is the motivation to read the book and participate actively in the group, writing blog posts about what you are learning and experiencing, and be willing to share your solutions through github.
As in the previous course, I expect to use Open Wonderland for some of the meetings, but the course can be followed in an asynchronous manner too. If you are interested head to the course and apply (once it's open), or give us a shout if you have any questions!
Due to low numbers in the Anglo-Celt SICP Study Group, we have decided to open the group to the world through the Peer to Peer University (P2PU).
The course is still in draft but so far I've had great feedback from some of the core P2PU community members and I'm hoping that it will go ahead. You can see the draft of the course here: SICP Study group.
[UPDATE]: The course has been moved to the new P2PU site and it is now hosted here and open for application.
As usual, this is a peer to peer, community based effort, and everybody is welcome, even those of you that have read the book already. Assuming the role of mentor can be a fantastic experience, especially in terms of communication and other soft skills that are so important in our field.
To join the course all you need is the motivation to read the book and participate actively in the group, writing blog posts about what you are learning and experiencing, and be willing to share your solutions through github.
As in the previous course, I expect to use Open Wonderland for some of the meetings, but the course can be followed in an asynchronous manner too. If you are interested head to the course and apply (once it's open), or give us a shout if you have any questions!
Wednesday, April 13, 2011
Wonderland Wednesday -- Subsnapshot importer
We've been working on a new Open Wonderland module for exporting and importing parts of a world for the last couple of months. The idea is that when you have a world laid out, you might want to export bits and pieces, or even the whole space, to rebuild it at a later stage or in a different server, or simply as a backup of all your hard work.
Exporting is done by just right clicking in a model or container and choosing Export.
Importing is done by just dragging and dropping the exported file onto the Wonderland client. Easy peasy!
A couple of shots from today's session, in wich we are exporting and importing a bunch of the big fellas.
The module is taking this long to be developed because we are writing all the code as a group, and we only meet about 1 hour a week, so things are moving slowly.
As a result, we are all learning a big deal from each other, especially from Jon, but all of us have worked on parts of the module, which is really cool.
We are even using JUnit to test bits and pieces of the code. The codebase was not written with automated testing in mind, but we are doing all we can to move towards that direction, even if it's just in small doses, and the results are great so far, cause although we are quite far from being able to TDD or test-first even, testing after writing is saving us a lot of time in deploys and server restarts.
Better quality pictures can be found on facebook.
These sessions happen most Wednesdays at 1p.m EST, 6p.m GMT, and everybody is welcome, so hope to see some of you quite soon!
Exporting is done by just right clicking in a model or container and choosing Export.
Importing is done by just dragging and dropping the exported file onto the Wonderland client. Easy peasy!
A couple of shots from today's session, in wich we are exporting and importing a bunch of the big fellas.
![]() |
| Anyone needs an army? |
![]() |
| Well behaved big fellas |
![]() |
| bit to the left... bit to the right... perfect! |
The module is taking this long to be developed because we are writing all the code as a group, and we only meet about 1 hour a week, so things are moving slowly.
As a result, we are all learning a big deal from each other, especially from Jon, but all of us have worked on parts of the module, which is really cool.
We are even using JUnit to test bits and pieces of the code. The codebase was not written with automated testing in mind, but we are doing all we can to move towards that direction, even if it's just in small doses, and the results are great so far, cause although we are quite far from being able to TDD or test-first even, testing after writing is saving us a lot of time in deploys and server restarts.
Also we are not really pairing but 'grouping', and although communication can be harder than in the former, we are having a lot of fun, and that is what really counts!
These are a couple of shots of us working against netbeans and also the space we use, with the wallcard on the far end wall with all the stickies.
![]() |
| Close up of Netbeans in-world |
![]() |
| The group writing code, live |
![]() |
| The WallCard with all the stickies: we are almost there! ...almost! |
These sessions happen most Wednesdays at 1p.m EST, 6p.m GMT, and everybody is welcome, so hope to see some of you quite soon!
Labels:
3D,
development,
java,
open source,
open wonderland,
p2puow,
social learning
Monday, April 11, 2011
about JavaScript, Scheme and History
I've been doing a bit of JavaScript lately and I am shockingly enjoying it. I thought it was going to be a nightmare and a lot of copy+paste but after a good amount of reading and watching talks, I started to like the language. I've been collating bits an pieces of information in the ossdev-ireland wiki, mainly focusing it towards developers that only have to deal with the language in small doses.
Ossdev.org is a place to share experiences that overlap the different open source groups in Ireland. JavaScript and MongoDB are the two topics that seem to be gathering more interest so far, but it's been less that one week since the wiki was installed, so hopefully more topics will start being worked on soon.
The Irish Penguin is the one to blame for all this sharing craziness, and I hope more people get on board in the next couple of weeks.
As usual, following on links and references in talks and tutorials takes you to a thousand other talks and tutorials that you will never have the time to read and watch. I would recommend the fantastic series on Javascript by Douglas Crockford. I especially enjoyed Part I: the early years, cause although it does not contain any code, it is a great lecture in history of computing, and I totally agree that that is an area that we don't handle very well in the profession.
During that talk, Crockford recommends the little schemer as a book that will change the way you think about programming, so I had to get my hands on a copy of it. I have to say that it was a bit difficult to get started with it, because although it seems to be a book targeting children, there is no explanation whatsoever on how to start with the language itself. A bit more digging on the net and I finally downloaded DrScheme, and got it running. Although the site points to a newer version, namely Racket, DrScheme still exists as a package in Ubuntu systems, so that's what I'm using for now.
So this is my first scheme listing ever:
(define atom?
(lambda (x)
(and (not (pair? x)) (not (null? x)))))
(define lat?
(lambda (l)
(cond
((null? l) #t)
((atom? (car l)) (lat? (cdr l)))
(else #f))))
(lat? '(chunky bacon))
(lat? '(chunky (bacon)))
The first call to lat? returns true, and the second false. Let's see how long I can keep up with the parenthesis madness... the plan is to follow on to SICP, but I will have to finish this one first!
Ossdev.org is a place to share experiences that overlap the different open source groups in Ireland. JavaScript and MongoDB are the two topics that seem to be gathering more interest so far, but it's been less that one week since the wiki was installed, so hopefully more topics will start being worked on soon.
The Irish Penguin is the one to blame for all this sharing craziness, and I hope more people get on board in the next couple of weeks.
As usual, following on links and references in talks and tutorials takes you to a thousand other talks and tutorials that you will never have the time to read and watch. I would recommend the fantastic series on Javascript by Douglas Crockford. I especially enjoyed Part I: the early years, cause although it does not contain any code, it is a great lecture in history of computing, and I totally agree that that is an area that we don't handle very well in the profession.
During that talk, Crockford recommends the little schemer as a book that will change the way you think about programming, so I had to get my hands on a copy of it. I have to say that it was a bit difficult to get started with it, because although it seems to be a book targeting children, there is no explanation whatsoever on how to start with the language itself. A bit more digging on the net and I finally downloaded DrScheme, and got it running. Although the site points to a newer version, namely Racket, DrScheme still exists as a package in Ubuntu systems, so that's what I'm using for now.
So this is my first scheme listing ever:
(define atom?
(lambda (x)
(and (not (pair? x)) (not (null? x)))))
(define lat?
(lambda (l)
(cond
((null? l) #t)
((atom? (car l)) (lat? (cdr l)))
(else #f))))
(lat? '(chunky bacon))
(lat? '(chunky (bacon)))
The first call to lat? returns true, and the second false. Let's see how long I can keep up with the parenthesis madness... the plan is to follow on to SICP, but I will have to finish this one first!
Saturday, March 19, 2011
Talks at the Virtual Worlds Best Practices in Education 2011 Conference
In a couple of hours I will be talking about the Open Wonderland Development course that I organised through P2PU earlier this year. The time is 7a.m. PST or 2p.m. GMT and everybody is welcome!
This is the master schedule for the whole conference, which is finishing today.
Yesterday was the turn of Roland Sassen from Thinsia Research to talk about Wonderschool, their fantastic project that allows children in schools to use Alice through Open Wonderland. Roland also talked about some new research they are starting, to use Wonderland through thin clients and that sounds really exciting!
After that, Nicole and Jonathan from Open Wonderland Foundation and Wonderbuilders talked about the imminent preview 5 release that we are all waiting for!
As for today, I will be talking about the P2PU course and later on, at 1p.m. PST or 8p.m. GMT, Jon and Nicole will be joined by Kathryn Aten to tell us all about how to learn to program collaborative using Open Wonderland. This is a talk based on Wonderland Wednesdays which are our community weekly meetings in which we've been gathering together to write code collaboratively almost every Wednesday for the last 6 months. Can't wait!
This is the master schedule for the whole conference, which is finishing today.
Yesterday was the turn of Roland Sassen from Thinsia Research to talk about Wonderschool, their fantastic project that allows children in schools to use Alice through Open Wonderland. Roland also talked about some new research they are starting, to use Wonderland through thin clients and that sounds really exciting!
After that, Nicole and Jonathan from Open Wonderland Foundation and Wonderbuilders talked about the imminent preview 5 release that we are all waiting for!
As for today, I will be talking about the P2PU course and later on, at 1p.m. PST or 8p.m. GMT, Jon and Nicole will be joined by Kathryn Aten to tell us all about how to learn to program collaborative using Open Wonderland. This is a talk based on Wonderland Wednesdays which are our community weekly meetings in which we've been gathering together to write code collaboratively almost every Wednesday for the last 6 months. Can't wait!
Labels:
conference,
open source,
open wonderland,
p2puow,
programming,
research,
virtual worlds
Monday, March 14, 2011
Code retreat in Winchester
I had a quite big post written about the event in Winchester but as a proof of how much I learned in the space of just one day, I went into end of session mode and deleted it!
It was an intense day but very enjoyable. For me, my first code retreat and also my first time pairing with another person in the same room. All my previous pairing experience had been remotely, and I have to say that I did enjoy sitting side by side, but I could not do a fair comparison because I had never met any of these guys before, and shouldn't compare that with the familiarity of knowing the other person, even if only remotely.
Each session was surprisingly different from the previous one, not only due to the rules, but also due to personalities and languages. I must admit that by the end of the last iteration I had already lost a part of my brain. When someone said during the last retrospective that they needed a pint, I couldn't help but think that I'd rather have a bucket full to dunk my whole head in it!
Many thanks to everyone at Eden cause the organisation was excellent, and to all the participants for making it possible. It would've been cool to see @ecomba and @sermoa in a demo session of TDD as if you meant it; I'm sure I could have learned a lot from that. Also I have some concerns about retrospectives, mainly because only the more extroverted types participate more freely. A group of more than 20 people can be frightening for some. But such is life, right?
In any case, the event certainly surpassed all my (high) expectations and I can't wait to attend another one. If anyone is interested in facilitating one in Ireland, please get in touch and I could talk to local dev groups about it.
It was an intense day but very enjoyable. For me, my first code retreat and also my first time pairing with another person in the same room. All my previous pairing experience had been remotely, and I have to say that I did enjoy sitting side by side, but I could not do a fair comparison because I had never met any of these guys before, and shouldn't compare that with the familiarity of knowing the other person, even if only remotely.
Each session was surprisingly different from the previous one, not only due to the rules, but also due to personalities and languages. I must admit that by the end of the last iteration I had already lost a part of my brain. When someone said during the last retrospective that they needed a pint, I couldn't help but think that I'd rather have a bucket full to dunk my whole head in it!
Many thanks to everyone at Eden cause the organisation was excellent, and to all the participants for making it possible. It would've been cool to see @ecomba and @sermoa in a demo session of TDD as if you meant it; I'm sure I could have learned a lot from that. Also I have some concerns about retrospectives, mainly because only the more extroverted types participate more freely. A group of more than 20 people can be frightening for some. But such is life, right?
In any case, the event certainly surpassed all my (high) expectations and I can't wait to attend another one. If anyone is interested in facilitating one in Ireland, please get in touch and I could talk to local dev groups about it.
Sunday, March 6, 2011
Learning a new language through testing
I've come across this very interesting talk by Ola Bini on Adopting the JVM in which he talks, among other things, about learning a new language.
I've been trying to learn Ruby for months now, and although it's being quite a slow process, it is kinda working, but the fact that I don't write it often is a big drawback. Ola mentions that a good way to get started, if you happen to write your code in Java, is to test your code with some other language supported by the JVM such as Ruby through JRuby.
A couple of posts ago I recorded a kata in which I was using cucumber and cuke4duke to test my Java code but my step definitions were written in Java, and my unit tests used JUnit. I guess the best way to practice more Ruby would be to write the steps in Ruby, and to use RSpec to drive the design.
A quick search yields the missing piece in the puzzle; JtestR allows for just that, testing (or stretching) Java code using Ruby. I haven't tried it yet, but I certainly can't wait! and the fizzbuzz kata (March's kata in 12meses12katas) looks like the perfect ground to put it into practice. Let's see how it goes!
I've been trying to learn Ruby for months now, and although it's being quite a slow process, it is kinda working, but the fact that I don't write it often is a big drawback. Ola mentions that a good way to get started, if you happen to write your code in Java, is to test your code with some other language supported by the JVM such as Ruby through JRuby.
A couple of posts ago I recorded a kata in which I was using cucumber and cuke4duke to test my Java code but my step definitions were written in Java, and my unit tests used JUnit. I guess the best way to practice more Ruby would be to write the steps in Ruby, and to use RSpec to drive the design.
A quick search yields the missing piece in the puzzle; JtestR allows for just that, testing (or stretching) Java code using Ruby. I haven't tried it yet, but I certainly can't wait! and the fizzbuzz kata (March's kata in 12meses12katas) looks like the perfect ground to put it into practice. Let's see how it goes!
Subscribe to:
Comments (Atom)





