More than a year ago I wrote a post and recorded a video about the Roman Numerals Kata. To be honest I haven't been doing many katas lately but as I've had this weekend for myself, I went back and revisited the Kata, in JavaScript this time. And also recorded a video:
I am not really sure about how my coding has changed in the last year. There's no doubt that JavaScript uses a very different philosophy to Java, and I'm a lot more confident writing JavaScript now, but other than that, not much seems to have changed.
The only common pattern I see is that TDD is really helpful. In both screencasts you can see me doing something wrong (mixing up symbols last year, and forgetting to set the main function for immediate invocation this year, for instance) and only by having tests failing I realised that they were problems. It really saves you time if you don't have to deploy your code and play around with it to see what you've broken. Also, being the first user of your own code allows you to put a bit of thought in your design.
In this version I was not interested about recursion or Maps in Java, and I decided to skip the outer BDD layer (although Jasmine would allow me to do so). What was more interesting was to go through the different Module pattern incarnations in JavaScript, and using jasmine-node from the command line, although the --autotest option keeps crashing on me so I cannot use it! I am not the biggest fan of autotest utilities but for these kind of deliberate practice they are actually quite nice.
Showing posts with label deliberate practice. Show all posts
Showing posts with label deliberate practice. Show all posts
Sunday, April 22, 2012
Thursday, March 8, 2012
A read-only API for P2PU
I've been part of the P2PU community for a good while now, and have organised a couple of groups within their platform so I thought it was about time to give back. On top of that, they use Python and Django, two pieces of technology that up to a month ago or so were completely unknown to me and I have always wanted to learn. Not that I know all that much about them right now, but there's nothing better for learning than using the tools in a real context and within a real project, so that is exactly what I've been doing for the last couple of weeks. #opensource_ftw!
After an initial proof of concept using tastypie, as recommended by the chaps in the python.ie mailing list, I have started to work on it a bit more seriously and it will hopefully soon enough be reviewed and merged with the main Lernanta codebase. My fork of Lernanta has an API branch where you can find all the code to date.
And you might be wondering... why am I telling you all this? Because I could do with some help! If you want to learn not only Python and Django but aslo about RESTful architecture and web services do not hesitate in joining me.
You can also have a look at the blog post in the main P2PU blog.
After an initial proof of concept using tastypie, as recommended by the chaps in the python.ie mailing list, I have started to work on it a bit more seriously and it will hopefully soon enough be reviewed and merged with the main Lernanta codebase. My fork of Lernanta has an API branch where you can find all the code to date.
And you might be wondering... why am I telling you all this? Because I could do with some help! If you want to learn not only Python and Django but aslo about RESTful architecture and web services do not hesitate in joining me.
![]() |
| Illustration by @alisonjeancole |
You can also have a look at the blog post in the main P2PU blog.
Labels:
deliberate practice,
development,
django,
github,
open source,
p2pu,
python,
REST,
social learning,
tastypie,
webservices
Sunday, February 26, 2012
Dublin GameCraft 2012
I spent the day with more than 100 game developers and designers yesterday at Dublin GameCraft. It was a lot of fun and although Donall and I didn't really submit our entry for any prizes, we recorded a short video of what we got up to, and here it is:
The topic of the day was: Dinosaur Angst, and as you can see, our dino was pretty angry! Our half baked game was based on OpenSimulator, using stuff we found in the web and LSL. Certainly not the best platform for good gameplay for a shooter, but it was fun to make, the atmosphere in the place was awesome, and have met some really nice people so that's what I call a great day!
The topic of the day was: Dinosaur Angst, and as you can see, our dino was pretty angry! Our half baked game was based on OpenSimulator, using stuff we found in the web and LSL. Certainly not the best platform for good gameplay for a shooter, but it was fun to make, the atmosphere in the place was awesome, and have met some really nice people so that's what I call a great day!
Labels:
3D,
deliberate practice,
development,
opensim,
programming,
simulation
Friday, September 30, 2011
the busiest September in years!
This has certainly been the busiest September for me in many many years. I can even say the busiest in my life.
After finishing August in a high note with the Ruby Ireland Rails 3.1 launch party, September started with a Ruby Project night in amworks in which we were working a bit on Conway's Game of Life.
The following week two events took place, on the Tuesday the dublinjs meetup with a fantastic backbone.js presentation by David and a kata by Wiktor, and on the Saturday I had the privilege to co-organise and co-facilitate the first code retreat in Dublin (and in Ireland as far as I know!).
If that was not enough, on Sunday I took a flight to Madrid to attend XPWeek. The Monday was a full day of talks, and the rest of the week I attended the TDD courses by Carlos Ble.
I have posts coming about some of these events so won't go into details here, but all the events were absolutely fantastic!
We have also been pushing a new release of Open Wonderland for a while and I think there will be some juicy news out very soon, which is very exciting!
And tomorrow, 1st of October I will certainly not be missing the SocketStream session that the AOL Dublin guys are preparing. That is if this stupid cold I've been nursing since I'm back in Ireland allows me to get out of bed!
After finishing August in a high note with the Ruby Ireland Rails 3.1 launch party, September started with a Ruby Project night in amworks in which we were working a bit on Conway's Game of Life.
The following week two events took place, on the Tuesday the dublinjs meetup with a fantastic backbone.js presentation by David and a kata by Wiktor, and on the Saturday I had the privilege to co-organise and co-facilitate the first code retreat in Dublin (and in Ireland as far as I know!).
If that was not enough, on Sunday I took a flight to Madrid to attend XPWeek. The Monday was a full day of talks, and the rest of the week I attended the TDD courses by Carlos Ble.
I have posts coming about some of these events so won't go into details here, but all the events were absolutely fantastic!
We have also been pushing a new release of Open Wonderland for a while and I think there will be some juicy news out very soon, which is very exciting!
And tomorrow, 1st of October I will certainly not be missing the SocketStream session that the AOL Dublin guys are preparing. That is if this stupid cold I've been nursing since I'm back in Ireland allows me to get out of bed!
Monday, July 18, 2011
Dublin JavaScript Group July meet up -- Kata Reloaded!
We are organising another Kata session for the Dublin Javascript meetup this month, which will happen tomorrow Tuesday the 19th at 6.30pm @amworks. You can sign up here.
These are my slides for the event, which are pretty much the same as the ones I used last month.
The initial idea was to have a presentation on Processing.sj although that has been postponed, but I'm sure Nigel will come up with something. And in any case we are going ahead with uncle Bob's Prime Factors Kata.
The solution, in the form of a powerpoint document, can be found here so you don't really have to worry about the solution itself and can focus on practising the Kata instead.
A couple of interesting points I've noticed after practising it a couple of times are the differences between his Java implementation and a JavaScript one, and my mixed feelings to his last refactoring, which I find a bit contrived. I prefer to stop at the level of 'while' structures because I believe it preserves the intent of the algorithm a lot more than if you go the whole way and replace them with 'for' structures. The result has more lines of code but in my head it's clearer. But as usual, this is a personal preference and everyone will have their own, which is a good thing!
The format for this part of the meetup will be the following:
I will go through the slides, which will take me about 3 minutes. Then we will set about 20 minutes for people to work on the Kata. Working in pairs using ping pong pairing would be highly recommended. The idea is that one person writes the first test, the other person makes that test pass and writes the following test, and this goes on until the Kata is solved. If you don't want to pair, that is fine. If you don't want to program at all, that is fine too!
During those 20 minutes I'll be available to help out, especially to any new faces that are not familiar with the concept of a Kata or with Jasmine. At then end of this period we will project one solution and have a short retrospective about it.
And that is all, please feel free to join us from 6.30pm at amworks. See you there!
These are my slides for the event, which are pretty much the same as the ones I used last month.
The initial idea was to have a presentation on Processing.sj although that has been postponed, but I'm sure Nigel will come up with something. And in any case we are going ahead with uncle Bob's Prime Factors Kata.
The solution, in the form of a powerpoint document, can be found here so you don't really have to worry about the solution itself and can focus on practising the Kata instead.
A couple of interesting points I've noticed after practising it a couple of times are the differences between his Java implementation and a JavaScript one, and my mixed feelings to his last refactoring, which I find a bit contrived. I prefer to stop at the level of 'while' structures because I believe it preserves the intent of the algorithm a lot more than if you go the whole way and replace them with 'for' structures. The result has more lines of code but in my head it's clearer. But as usual, this is a personal preference and everyone will have their own, which is a good thing!
The format for this part of the meetup will be the following:
I will go through the slides, which will take me about 3 minutes. Then we will set about 20 minutes for people to work on the Kata. Working in pairs using ping pong pairing would be highly recommended. The idea is that one person writes the first test, the other person makes that test pass and writes the following test, and this goes on until the Kata is solved. If you don't want to pair, that is fine. If you don't want to program at all, that is fine too!
During those 20 minutes I'll be available to help out, especially to any new faces that are not familiar with the concept of a Kata or with Jasmine. At then end of this period we will project one solution and have a short retrospective about it.
And that is all, please feel free to join us from 6.30pm at amworks. See you there!
Tuesday, June 21, 2011
Dublin JavaScript Group June meet up -- jQuery and Jasmine
In a couple of hours the JavaScript Dublin Group will meet up for the second time. The first meetup was last month, and it was basically a gathering to get to meet other people and talk a bit about organisation.
So this will be the first time for a technical session. Nigel Kelly will be talking about jQuery apps, and I will run a Kata session in JavaScript using Jasmine. I hope people will follow along. We will use the standalone version of Jasmine and the kata chosen for the session is Fizz Buzz.
I came up with the following 4 slides (yeah, want to keep it short!):
The slides will not make much sense on their own, so you better come to the meet up!
This means that I will miss the P2PU SICP study group session on IRC (freenode #sicp room) today at 7pm GTM, 3pm EST, but it's for a good cause, right? :)
So this will be the first time for a technical session. Nigel Kelly will be talking about jQuery apps, and I will run a Kata session in JavaScript using Jasmine. I hope people will follow along. We will use the standalone version of Jasmine and the kata chosen for the session is Fizz Buzz.
I came up with the following 4 slides (yeah, want to keep it short!):
The slides will not make much sense on their own, so you better come to the meet up!
This means that I will miss the P2PU SICP study group session on IRC (freenode #sicp room) today at 7pm GTM, 3pm EST, but it's for a good cause, right? :)
Saturday, June 18, 2011
SICP -- Starting with the P2PU study group
We have finally started with the SICP study group and I'm delighted to put some time into it. For once, I will focus all my effort and free time to work through and enjoy this fantastic book.
The goal of the group is to finish one section every second week, which gives us 6 weeks for the first chapter. Some people might think that 6 weeks is a lot but to be honest, at least for me, with a full time job, a part time PhD to work on, and all the normal social commitments, it's not that much time. So let's get cracking!
I decided to go back a re-watch the first bunch of MIT SICP lectures as it's been a while since I got around to see them first. I always have this funny and a bit weird feeling when I start watching one because for a moment I feel like I am watching an 80's sitcom or something similar. I'm probably just being silly but it always makes me smile!
The lecture series starts with Harold Abelson ranting a bit about the term Computer Science not being a very good one when it's not a real science, or even about computers. I do agree with him but if you want to know more about the subject you will have to watch it for yourself.
More interesting are his comments about the distinction between declarative or descriptive knowledge and imperative or procedural knowledge. Procedural knowledge or 'Know-How' can be directly applied to a task, whilst declarative knowledge tells us about truth. His example for this is the fact that the square root of a number can be expressed in the form of a mathematic equation(descriptive), compared to a way or algorithm to finding that square root through approximation (imperative).
He also explains that although you can learn most of the LISP language (its rules anyway!) in a short lecture, that does not make you a good user of the language. He compares it to learning the rules of chess and being a good chess player; you need the rules to play, but the rules do not make you any good at it. So you need to embed yourself in the context and the experience, and the techniques to do so are the topic of the course.
In Abelson's words, programming is all about managing complexity, and the techniques in this course will allow you to do so.
The lectures are divided into three main topics which do not correspond to the five sections of my book (my edition is from 1996), but that can be easily correlated, or so I think.
The parts discussed in the lectures are:
- Black-box Abstraction: I guess this will be chapters 1 and 2, building abstractions with procedures/data.
- Conventional Interfaces: I'd say this is chapter 3: Modularity, Objects, and State.
- Metalinguistic Abstractions: This is chapter 4, of the same title.
The fifth chapter of the book about Register Machines does not seem to be in the lectures, but I couldn't tell right now cause I have yet to watch them all.
And that is all for now. I will spend another couple of hours later this evening working through the book and preparing the meeting for tomorrow Sunday at 7pm GMT, 3pm EST. Meetings happen on the #sicp channel on freenode IRC and everybody is welcome!!!
The goal of the group is to finish one section every second week, which gives us 6 weeks for the first chapter. Some people might think that 6 weeks is a lot but to be honest, at least for me, with a full time job, a part time PhD to work on, and all the normal social commitments, it's not that much time. So let's get cracking!
I decided to go back a re-watch the first bunch of MIT SICP lectures as it's been a while since I got around to see them first. I always have this funny and a bit weird feeling when I start watching one because for a moment I feel like I am watching an 80's sitcom or something similar. I'm probably just being silly but it always makes me smile!
The lecture series starts with Harold Abelson ranting a bit about the term Computer Science not being a very good one when it's not a real science, or even about computers. I do agree with him but if you want to know more about the subject you will have to watch it for yourself.
More interesting are his comments about the distinction between declarative or descriptive knowledge and imperative or procedural knowledge. Procedural knowledge or 'Know-How' can be directly applied to a task, whilst declarative knowledge tells us about truth. His example for this is the fact that the square root of a number can be expressed in the form of a mathematic equation(descriptive), compared to a way or algorithm to finding that square root through approximation (imperative).
He also explains that although you can learn most of the LISP language (its rules anyway!) in a short lecture, that does not make you a good user of the language. He compares it to learning the rules of chess and being a good chess player; you need the rules to play, but the rules do not make you any good at it. So you need to embed yourself in the context and the experience, and the techniques to do so are the topic of the course.
In Abelson's words, programming is all about managing complexity, and the techniques in this course will allow you to do so.
The lectures are divided into three main topics which do not correspond to the five sections of my book (my edition is from 1996), but that can be easily correlated, or so I think.
The parts discussed in the lectures are:
- Black-box Abstraction: I guess this will be chapters 1 and 2, building abstractions with procedures/data.
- Conventional Interfaces: I'd say this is chapter 3: Modularity, Objects, and State.
- Metalinguistic Abstractions: This is chapter 4, of the same title.
The fifth chapter of the book about Register Machines does not seem to be in the lectures, but I couldn't tell right now cause I have yet to watch them all.
And that is all for now. I will spend another couple of hours later this evening working through the book and preparing the meeting for tomorrow Sunday at 7pm GMT, 3pm EST. Meetings happen on the #sicp channel on freenode IRC and everybody is welcome!!!
Labels:
apprenticeship,
deliberate practice,
education,
functional,
p2pu,
p2pusicp,
programming,
scheme,
SICP,
study group
Friday, June 17, 2011
learn, laugh and move on!
There's been a lot going on lately and as a professional procrastinator I couldn't let go the chance of putting off writing a new blog post, but with things going back to normal (hopefully!) it's about time for a bit of reflection.
It's been a very social few weeks, ending May with a double bill: The software craftsmanship conference in Bletchley Park, and a coding day with the chaps of codingday.org here in Dublin.
What can I say about scuk11? it was a great day with fantastic sessions and I got to meet a great bunch of Spaniards in red t-shirts. Happy faces all over... yeah, the bar was already open!
The Dublin event was also fantastic and although it was first thought as a coderetreat, the addition of scientists and their real problems changed the nature of the session itself and made of it a fantastic coding day. The group I was working with got a spinning cube in the browser, with three different lights and three particles lighting up the cube with different colours. Great fun using the Three.js library!
The month of June started with @silverspoon organising hack nights in a café near the city centre, that I sadly missed because I was in Barcelona for a conference. Spain was great, as usual, although it was raining most of the time, but that didn't really have an impact on things such as meeting old friends, the great conversations we had, and of course, the fantastic food!
On Tuesday the 14th we had the first meet up for the SICP study group at P2PU. You can see what happened in the new wiki. This is an open group which basically means that you can join in anytime that suits you. We will meet twice a week for the next couple of months, Tuesdays and Sundays at 7pm GMT, 3pm EST. We are hoping to finish a section every two weeks, including exercises. As chapter one of the book has 3 sections, we are hoping for a 6 week period to be done with it. Wish us luck!!! or even better, join in!!!
Last night the first Ruby Project Night happened in armworks. The space is absolutely great and I want to thank Alan for hosting it. We didn't really know what to expect at first, and after a bit of chat and trying to get the projector going, we started hacking away in a rails 3 gem, something that none of us had done before. We didn't get too far but at least we got it packing and installing fine. As soon as the @theirishpenguin pushes it publicly I will share the link here. It was great to meet a bunch of enthusiastic people and looking forward to meeting them again!
This morning I read this 'Help Wanted' message from @oisin in the ruby Ireland list. If you are looking for contract Ruby work you should definitely get in touch with him. His last talk at ruby Ireland was really interesting.
In the thread he mentions that they like egoless programming which brought me back to the this old post of mine. Weingberg's book is a very recommended read even if as myself, you were not even born when it was written!
An finally, more to look forward to as the first 'technical' meet up of the Javascript Dublin group will be next Tuesday 21st at 7pm. A presentation about jQuery for web apps and a kata with Jasmine are in the menu. Are you really going to miss that???
It's been a very social few weeks, ending May with a double bill: The software craftsmanship conference in Bletchley Park, and a coding day with the chaps of codingday.org here in Dublin.
What can I say about scuk11? it was a great day with fantastic sessions and I got to meet a great bunch of Spaniards in red t-shirts. Happy faces all over... yeah, the bar was already open!
The Dublin event was also fantastic and although it was first thought as a coderetreat, the addition of scientists and their real problems changed the nature of the session itself and made of it a fantastic coding day. The group I was working with got a spinning cube in the browser, with three different lights and three particles lighting up the cube with different colours. Great fun using the Three.js library!
The month of June started with @silverspoon organising hack nights in a café near the city centre, that I sadly missed because I was in Barcelona for a conference. Spain was great, as usual, although it was raining most of the time, but that didn't really have an impact on things such as meeting old friends, the great conversations we had, and of course, the fantastic food!
On Tuesday the 14th we had the first meet up for the SICP study group at P2PU. You can see what happened in the new wiki. This is an open group which basically means that you can join in anytime that suits you. We will meet twice a week for the next couple of months, Tuesdays and Sundays at 7pm GMT, 3pm EST. We are hoping to finish a section every two weeks, including exercises. As chapter one of the book has 3 sections, we are hoping for a 6 week period to be done with it. Wish us luck!!! or even better, join in!!!
Last night the first Ruby Project Night happened in armworks. The space is absolutely great and I want to thank Alan for hosting it. We didn't really know what to expect at first, and after a bit of chat and trying to get the projector going, we started hacking away in a rails 3 gem, something that none of us had done before. We didn't get too far but at least we got it packing and installing fine. As soon as the @theirishpenguin pushes it publicly I will share the link here. It was great to meet a bunch of enthusiastic people and looking forward to meeting them again!
This morning I read this 'Help Wanted' message from @oisin in the ruby Ireland list. If you are looking for contract Ruby work you should definitely get in touch with him. His last talk at ruby Ireland was really interesting.
In the thread he mentions that they like egoless programming which brought me back to the this old post of mine. Weingberg's book is a very recommended read even if as myself, you were not even born when it was written!
An finally, more to look forward to as the first 'technical' meet up of the Javascript Dublin group will be next Tuesday 21st at 7pm. A presentation about jQuery for web apps and a kata with Jasmine are in the menu. Are you really going to miss that???
Labels:
apprenticeship,
coderetreat,
deliberate practice,
development,
javascript,
kata,
open source,
p2pu,
programming,
psychology,
rails,
ruby,
SICP,
social learning,
study group
Thursday, May 19, 2011
Mutant-Java and the KataLonja
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!
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!
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!
Sunday, February 27, 2011
Roman Numerals Kata
Last month I joined an initiative by a group of Spanish Agile followers called 12 meses 12 Katas. The idea is that each and every month during 2011, we will be practising a Kata, and sharing our code through github, and for those adventurous enough to record themselves, also through this vimeo channel.
There is a ton of resources in the net about what a Kata is and why are they important so I will not get into that, but I would like to stress the last bit of pragmatic Dave's definition:
"[...] remember that the point of the kata is not arriving at a correct answer. The point is the stuff you learn along the way."
After having practised the February Kata a bunch of times, I wanted to write a bit about the process and reflect on my own deliberate practice and learning journey during these last couple of weeks.
As I mentioned earlier, the kata was a bit long for a video so I have sped it up! Generally katas are recorded with a piece of classical music as background. I've chosen a piece from my extensive collection, which pretty much means that it was the only 1 out of 6 classical tracks in my itunes that was long enough for the video!!! Hope you enjoy it!
Roman Numerals Java + cuke4duke (Double speed) from Josmas Flores on Vimeo.
There is a ton of resources in the net about what a Kata is and why are they important so I will not get into that, but I would like to stress the last bit of pragmatic Dave's definition:
"[...] remember that the point of the kata is not arriving at a correct answer. The point is the stuff you learn along the way."
After having practised the February Kata a bunch of times, I wanted to write a bit about the process and reflect on my own deliberate practice and learning journey during these last couple of weeks.
When I first saw the Kata, I thought it was going to be easy peasy. Yes, totally missed the point; it's not about the problem but about practising it, but in any case, I was so very wrong! It turned out to be a lot more complex than anticipated, and I even thought for a couple of days that I was having some type of programmers block. Sticking to strict TDD didn't help much either, when you are not as used to use it as you first thought!
I went through 3 different solutions:
The First solution was very complex and it was very influenced by Maths. I was tracking all this positions for different numbers, and had a ton of if branches and all that. Messy!
Then I saw a recursive solution to the Kata. YES, I SAW IT; call it cheating if you want to, I couldn't care less. When I saw the simple solution, it made me think...Why did I start coding without thinking a bit about the problem itself. I should have a look at the relations among numbers, which ones are the special cases, and so on. In a nutshell, the Domain is very important, even in small projects. That was Lesson one for me, hope it sticks!
I'd say it has to do with our nature or background as scientists. That initial thought of 'I can do this with a bit of math', yields an answer, but it is too complex, not so difficult to write, but long, and difficult to maintain. A quick but thorough look at the domain shows that the cases can be simplified if you play a bit with them. Special cases such as 4, 9, and all numbers terminating in any of the two, can be easily automated.
So I started working on a recursive solution. At first I wrote a recursion with a wonky base case, and it worked anyway on one direction (arabic to roman), but it did not for the opposite. There was a mix here of problems with copy by value in Java, and objects and primitives. If it hadn't been for the primitive case, I wouldn't have noticed the flaw in the recursion. Which leads me to think that test are great, but obviously not a silver bullet! You still have to get the algorithm right! Another example of this can be seen in my video, when I mix up L and D in the tests themselves! So Lesson two is: no silver bullets.
Recursion can feel easy at times, but when it is easy to write, it makes you wonder if there is another way. And in fact there was. In this case a simple loop could yield the same results as the recursion, and that was my last solution.
I feel that I have a better understanding of what Katas are good for, after practising them deliberately for the last couple of months. When you are in the job, you just go to the point, and choose a collection, or refactor to an iterative process, but you don't get to dig out more information. Doing the kata in my own time, I consider that spending some of it in the details of how to choose that collection, or when to refactor is far more beneficial. This is something I had read about before, but never experienced by myself. Lesson three: deliberate practice is necessary.
What else did I learn/review this month?
- review of Maps in Java (mainly due to the fact that I needed order in my collection). Although I started the kata with arrays (some people will say that it was faster and all that), I decided to go for a map in the end, cause having two different arrays (one for arabic numbers and one for their roman counterparts) was not expressing the intent of the mapping.
- review of recursion and refactorings applied to the recursion itself. Interesting to find out that most newish compilers will automatically substitute a tail recursion for an iteration for you, so if the intent of the algorithm is clearer with the recursion, I will definitely go with that form from now on.
- I wanted to use cucumber for acceptance testing so finally got to set up cuke4duke to run cucumber features on Java programs. It is so much fun!
- Writing cucumber features has reminded me (yet again) of my little knowledge of regular expressions. Also brings up the fact that writing features is a lot harder than reading somebody else's. Hopefully if I use them more, both things will stick in my brain, at least the basics anyway!
- Lastly, it has been quite strange to watch my kata after recording it. Does not feel like it is me (especially due to my supersonic typing up speed! Nah, it's fake, I've doubled up the speed cause the Kata was far too long!). It's definitely the case that what you think you are doing and what you actually do are two different things. The more I see it, the more I'd like to change things. But I think that that is good anyway!
As I mentioned earlier, the kata was a bit long for a video so I have sped it up! Generally katas are recorded with a piece of classical music as background. I've chosen a piece from my extensive collection, which pretty much means that it was the only 1 out of 6 classical tracks in my itunes that was long enough for the video!!! Hope you enjoy it!
Roman Numerals Java + cuke4duke (Double speed) from Josmas Flores on Vimeo.
Labels:
cucumber,
cuke4duke,
deliberate practice,
java,
kata,
roman numerals,
software practice
Subscribe to:
Comments (Atom)
