Yesterday we had the 3rd IOSCD. It was great fun, the code is all available here.

The sessions

IMAG0142 

 

and

IMAG0144

It was great to have some hardware to play with, people really seem to get a good kick out of that, there was a Netduino and two Lego NXT.

I m hoping that other people will tell us about their experience yesterday (hint hint ;) ).

Some of the sessions included: Ruby on rails app for the book club assistance (called and_on_that_basis , no idea why), netdruino hacking with some sort of Rx , and then using Rx over the wire, finally i was working on something called Code Shapes.

Just starting a tool(?) that will analyse each class and draw a diagram:

  • Hollow Ellipse – public method
  • Shaded Ellipse – protected, private, or package private method
  • Rectangle – field
  • Line – a use-dependency from a method to a method or a field.

as per Michael Feather post on this.


There is a bunch of things happening in Dublin in the next few months, I figured it would be handy to push a post on it.

30th of august – Windows Phone 7 . A joint event between MTUG and Dublin Alt.Net – Registration and Details

9th of September - Promiscuous Developer Meetup (location not confirmed) developers of different languages meetup and try to find the answer to life, the universe and everything, maybe it wont be 42 :) sounds kinda interesting. More info here.

11th of September – Open Spaces Coding Day III – A full day of coding on whatever topic is decided on the day , the last event was a really cool thing to do, learned loads. Hopefully this one will work out just as well.

25th of September – OSSBarcamp - The classic OSS event, to be held in UCD. Registration and details OSSBarcamp.

9th Of October – DDD Dublin. An event where there are a lot of developer presentations, presented by developers. The talks are selected by vote (ie not the organizers) , for more info on the series of events, please check here; the events  in Scotland and Reading in previous years were really interesting , so its worth taking note of the date. I ll update this post when there is more info.


Kick post on Types, nothing outrageous, but this was just a construct that I never used too much.

The other day a collegue and we got stuck on a method similar to this

void DoStuff(Type type)
{
var iInterface = typeof(ISomethingAmazing);
Type genericType = //how to get ISomethingAmazing<type>

//do more things
}

and well I didn’t know but you can do this

void DoStuff(Type type)
{
var iInterface = typeof(ISomethingAmazing);
Type genericType = iInterface.MakeGenericType(new Type[] { type });

//do more things
}

Why would you want this?
well say for example, you are working with a container and need to get all the ISomethingAmazing of whatever your type is
Particularly handy if you are using a handlers or factories a lot.

What happened?

Basically we just had information about the types we wanted but at compile type we didnt know the types, this is a away to return a runtime type even when you dont know what that type is.

I hope this is helpful for someone

Cheers


So I was getting an ” Could not Load File or Assembly” error, even thou I was pretty certain I was referencing the right dlls in the correct folders. What could this error possibly mean?
The actual error I had was:
System.IO.FileLoadException: Could not load file or assembly ‘Moq, Version=2.6.1014.1, Culture=neutral, PublicKeyToken=69f491c39445e920′ or one of its dependencies.
Some things I checked:
  • Maybe  I dont have the moq.dll assembly, but it was there.
  • Then I checked  the assembly version, my moq.dll was 4.x (the error stated 2.6.x was required), so there is a difference in the expected versions, why?
  • Checked all projects in the solution, all the ones using Moq.dll where explicitly pointing at 4.x
  • Reflector show time. I was using moq.contrib.dll on the project that was failing, and since it makes sense that such library would depend on moq, it was worth checking it out, this is what I saw

Reflector Screenshot

This means that moq.contrib.dll did indeed depend on moq, so I just needed to find a version of it that pointed to the right assembly, I was lucky because I had a set of dlls that work, if you are not so lucky, get latest from the moq.contrib google code and simply run the Build.cmd and you are all set to go (you can replace the moq.dll dependecy if they have moved on).
On the way I found some other interesting things
  • Like this thread, basically it said that this was possibly a compiler bug. I thought damn a dead end, but it wasn’t :) .
  • A tool to find out how the dll binding happen callled FusLogw.exe
FusLogw.exe
Also known as the Assembly Binder Log Viewer, awesome right? :D
Where is it?  I searched online and the tool seems to move a lot in differnt versions of Windows, In xp
it could be here: C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\fuslogvw.exe
In my windows 7 install I found it here: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin>FUSLOGVW.exe
Oh yeah and you need to run it from the command line as an Administrator
It might seem obvious, but you need to refresh after you run something that fails , it is, after all a log viewer

What is pair programming?

Its when 2 developers sit down together to write a piece of code. There is one person in the keyboard known as the driver and another person looking at the code and commenting about it, known as the navigator, these roles can change in time. The idea is that while you are typing you are likely to catch certain things and when you are watching you are to catch other things.

Why?

I dont know if this happens to you, but many times, when I m not sure how to solve a problem or when I have a solution to a problem that I m not terribly happy with, I will talk to someone else about it. Then, one of two things happen: whoever I talk to gives me an idea, or as I explain the problem I realised that I missed an important piece of the puzzle and find the solution, the hidden third option is that I don’t have a solution but I have more to explore.  Anyway the whole point is that verbalizing the problem,  gives you a different take on it; maybe makes it more real?, as you talk you realise that certain things make no sense, you  ask yourself questions.  You have more visibility and clarity

Another more obvious advantages is that two brains are more than one, collaboration can get you to really far. More eyes looking at the code will at least avoid silly mistakes, in the better cases it will drive you to better design, never mind the fact that two people will know this code really well, we all know that this is really handy in a team ( we all take holidays, have days when our brains just refuse to work, etc).

When pairing , each of the persons in the pair need to be really involved, there is no distractions,  ( so perhaps take breaks every hour and a half or so) this intensity means to me that its more likely that as a pair there are more angles of the problem that will be covered.

Whats wrong with it?

When people are pairing there are a few things I ve noticed that tend to go wrong

1) One way street. One of the pair is hogging the control and the navigator is quiet. This is probably the worse thing. the only possible advantage of this is knowledge transfer but I think this kind of pairing does more bad than good. One way to counter act this is using Test driven Ping Pong (see below). But education is key.

If pairing, then try to pair, not to control.

If  pairing try to collaborate you are not just watching a movie.

If things are going to fast ask for slowing down, its not going to get better if you dont understand.

2) We’ll fix it later. This is when the pair decide to do something below standard. I dont think its a terrible practise but it does leave a “bad taste” because even when the pair decide the task is accomplished , there is stuff left t do. also there is the broken window problem.

Test Driven Ping Pong

Given a driver and a navigator, the role changes per test, say we have Alice and Bob, Alice is the driver first, she writes a test, fails, they fix  the code so the test passes, goes green , they come up with some refactorings , then Bob is the driver for the next test and so on. This sounds like a good approach when the developers dont know each other well or they have an ego problem, or they dont know where to start

Informal Pair Programing

The navigator and driver roles change whenever is necessary, like when discussing stuff on a whiteboard . This is probably the best way but at the same time it requires the pair to be very involved and request changes often. I think this is more Organic(for lack of a better word) and pleasurable.

Any comments on this? i would really appreciate it particularly from people practicing pair programing often


Recently I started using Visual Studio 2010, if you follow me on twitter you probably know that this hasnt been a nice transition for me (apologies for the cursing btw)  I ve had many crashes, and I m pretty sure I m not alone, not only a quick search in twitter will reflect this (see image below, the only marked twitt is about a fix for something) , but a some of my co-workers had one or another problem.

It would be naive to think all the issues have the same source, and I know that many are related to the plugins ( I use Resharper with xUnit extensions and AnkSvn). What I m trying to say is that this post is not  to bash Visual Studio,  to be fair the IDE is pretty flashy, shiny, even amazing…. but you know what I want options,  something I can rely on and that I can bend to my will. Lets elaborate on that.

Using resharper means I m used to using shortcuts, templates and whatnot,  I know I should be able to bend an IDE to do what I want so I can code faster, be focused on what I m doing. On the other hand I can also see that having a comon IDE within a group means we can share tricks and learn about each other practises.

So today I saw this post by Rob Connery and I cant help but wonder, Is Vim the right way to go?, no idea but I know I m ready to give it another try.  However Id iek to set my expectations. I think what I would like is a more modular VS  (where I can turn things off).

Although it s a pain, the Add Reference Dialog speed is not my main issue,  it takes so long to add a reference that at least it makes me think “Do you really want to add that dependecy?” I would prefer if it wouldnt happen tho.

So, what do I want ouf of my IDE:

  • To write code, quickly
  • to rely on it, if it crashes, updates, looses references that It handles it elegantly
  • To get feedback about the code I write  quickly
  • yes to  intellisense , I m a terrible typist (maybe I should change that?) and it helps when you have long explicit variable names (sometimes I go overboard with this until I find better names)
  • to be able to change the way the code looks
  • to format the code to my will, even if it s stupid, I want to be able to try new things
  • to be able to do simple and complex refactorings easily and that their result is obvious before we event start the operation
  • good ctrl+z support
  • to leverage what I know, and induce me to do smarter things, after all the IDE has intimate knowledge about the framework I m using
  • that I can carry around my settings (shortcuts, templates, etc really easily)

am I dreaming? Possibly, but lets see whats possible


I think the best way to describe this is saying, When is the next one? (We think around late August, early September)
Thanks again to our sponsors: Jetbrains, Manning and Microsoft, and particularly to our hosts: the open source Lab in UCD, that place is just designed for this type of events.
Sessions:
- Rx :
- ook!
- Cucumber with Iron Ruby
- pLinq and Mono
- Mongo Db (a bit of a comparison between .net implementation and a ruby implementation)
All the code for the sessions is available in our repo.

Fluentmigrator is a really nice migration tool that allows you to tear your database up and down keeping version, please visit the project page for more info.

Anyway, the other day I had to create a composite index, and I didnt know how,  the way to do that is:

Create.Index(“Name_of_the_index_String”).OnTable(“Name_of_the_Table_String”)
.OnColumn(“Column_Name_string”).Ascending()
.OnColumn(“Other_Column_Name_string”).Ascending();

Looks kinda obvious no? but what threw me off at the time is that I was looking at the possible operations after OnColumn and there was nothign obvious there,

FluentMigrator Create Index Column Intellisense

then  I looked at the Sql documentation for CREATE INDEX

CREATE [ UNIQUE ] [ CLUSTERED | NONCLUSTERED ] INDEX index_name
    ON <object> ( column [ ASC | DESC ] [ ,...n ] )
    [ INCLUDE ( column_name [ ,...n ] ) ]
    [ WHERE <filter_predicate> ]
    [ WITH ( <relational_index_option> [ ,...n ] ) ]

The solution was (kind of) there, you could do more columns after you specify the sorting direction. Perhaps it’s  obvious but it took me a while to figure out. It was logical however not obvious.

Also on composite, before I created an index I thought about using composite keys, J.Miller has a post here on why that is not really a good idea ( have a look at the comments in particular). For me, it boils down to:

  • Maybe something that has meaning now, wont necessarily have the same meaning in the future
  • It’s harder to manage composite keys that it is to manage surrogate keys

There are more reasons for and against surrogate keys, but this was what was suitable to me at the time

Cheers


I m late with the Ada Lovelace Day article, I had the choice of making it on time but incomplete, or put some time and be late, and I chose the later this time. I really though the person and the topic deserved in depth investigation.

I didnt really know how to aproach the Ada Lovelace Day last year and this year I still dont know now, I think the best homage I can do is learn more about F# in this case.

This post is about Amanda Laucher and about F#. Amanda is the author of F# in Action. A speaker and most importantly a software developer, when you see her talking you can see she really likes what she does, and that fact is pretty inspirational.

I found quite a few of her presentations online

Then I also found some other F# resources

Wikipedia had a pleasant surprise in store for me with a really comprehensive introduction to the language, and also pointed me to a wikibook however when I started typing the code and tryng to run it I ran into problems because the parser looks at line breaks.

Disclaimer: I never done any f# before so anything below could be completely wrong (if so please let me know so I learn :) )

In a short time I learnt that

F# is

  • Not purely a functional language, some OO aspects and has type inference.
  • a strongly typed language
  • .Net language
  • has Garbage Collection
  • does Lazy evaluation ( this is really cool )
  • Some sort of Asynchronous workflow ( need to digg deeper on this)

More detail

  • Everything is inmutable by default, but there are mutable objects ( apparently the objects that you can get by interoping with, say,a  c# dll are mutable but i m not sure)
  • lazy evaluation
  • Asynchronous Workflows
  • You can pass functions as result of function executions, or be the result of functions, and have functions inside functions
  • Send parts of parameters into a function
  • have a collection of functions that can be started asynchronously (holy smokes!)

After looking around I also found some good videos from Erik Meyer on the topic, hes got a series of them you can have a look here, the series goes through the history of functional programming and principles, very interesting.

I can see a lot of potential on this, I find functional programming a big mind switch and I m sure it will take me a good while to do it properly, however, the goodness of looking at this code comes from the ideas you can take from different aproaches.

One thing that did strike me so far is that i ve seen bad variable names and no unit testing on it at all, on the other hand, the power that you seem to sudenly have is just incredible, tho since the paradigm shift is so big, I found myself stumbling and not being able to do things that i find really simple in c# (like print an array to the console, the difficulty was on realising that the line breaks are significant)

The real life example from the QCon talk from 2009 was a really good way to see the value of the language as real life usage, the QCon  talk from 2010 was really good because it dived deep into the language, language usage, etc.

I feel like I ve started learning something that will cahnge the way I code and I m really happy about that.


Hi all:

Just thought I d post here that a group of us in Dublin. Alt.Net are organizing a coding day the 24th of April in UCD, it should be a fun day of hacking some code. One of the really cool things is that James Gregory will be there talking about Fluent Nhibernate.

If this sounds like something you d’like to do you, can  register and find out more about it in codingday.org

Cheers



Follow

Get every new post delivered to your Inbox.