Open Source and you – Resources
I was invited to give a talk on Open Source in DIT to a group of students. Link to slides http://www.slideshare.net/roundcrisis/open-source-and-you-5456161.
However here some interesting links:
- 35 years of Open Source http://vospe.com/2010/09/22/a-brief-history-35-years-of-open-source-software-a/
- The Open Source Initiative http://www.opensource.org/
- List of Open Source Licenses http://www.opensource.org/licenses/category and more here http://en.wikipedia.org/wiki/Comparison_of_free_software_licenses
- Reddit’s Open Source http://www.reddit.com/r/opensource/
Filed under: OSS, talk | 1 Comment
Tags: OSS
Manos de Mono – Quick overview
I heard about this new web framework the other day, the code its available on github/jacksonh/manos the main interesting thing I heard about it were:
- runs on Mono
- Has its own server
- Has no dependecies on Asp.net
- the main goal of mono is to simplify web application development
- routing appears to be simpler ( to use and test)
- command line for managing your apps (deployment included)
At this point, I wanted to see some code, I went to the example on github and I was pleasantly surprised
//
// A mango application is made of MangoModules and MangoApps
// There really isn't any difference between a Module and an App
// except that the server will load the MangoApp first. A mango
// application can only have one MangoApp, but as many MangoModules
// as you want.
//
public class MangoProject : MangoApp {
public MangoProject ()
{
//
// Routing can be done by using the Get/Head/Post/Put/Delete/Trace
// methods. They take a regular expression and either a method
// or another module to hand off processing to.
//
// The regular expressions come after the method/module, because
// Mango uses params to allow you to easily register multiple
// regexs to the same handler
//
Get (Home, "Home");
//
// The Route method will hand off all HTTP methods to the supplied
// method or module
//
Route (new DocsModule (), "Docs/");
}
//
// Handlers can be registered with attributes too
//
[Get ("About")]
public static void About (MangoContext ctx)
{
//
// Templates use property lookup, so you can pass in
// a strongly typed object, or you can use an anonymous
// type.
//
RenderTemplate (ctx, "about.html", new {
Title = "About",
Message = "Hey, I am the about page.",
});
}
public static void Home (MangoContext ctx)
{
RenderTemplate (ctx, "home.html", new {
Title = "Home",
Message = "Welcome to the Mango-Project."
});
}
}
- Like the module and App ideas
- like the simplicity of the code above
- seems to work at a slightly lower level of abstraction than MVC but I can live with that
- Interesting that it uses it’s own template engine, the syntax is nice, but I wonder why not spark, razor, nhaml, nvelocity. After all, It would be cool to use what I know already. Will have to find out.
Will have to do some more research on it
Filed under: unit-testing, web-development | Leave a Comment
Tags: manos_de_monos web web-development
Projects Organization – How to organize assemblies in your local machine to avoid nightmares
This is just how I organize folders and projects on my machine, there are endless possibilities , but I saw someone searching for it online and it did took me a long while before I settled on this, so I thought I would blog about it.
This can be a good or bad way of organizing, I think it depends on the kind and number of projects you are working on
Imagine you have a folder that contains the following folders
- code (Real code, shipable, or company proof of concepts with its own repo)
- spike (test to see if something works, Proof of concepts very basic)
- third-party (OSS libraries and frameworks, etc)
Inside my code folder, each solution has it’s own Lib or Libs or Libraries folder (eg One Lib folder per solution ). The story is very different in spike since I put projects there for stuff I never ever want to ship then I have a shared Lib or Libs or Libraries folder where I put everything I ever needed. In third party I leave as I got from source control .
Inside the Libraries folder I mostly try to keep a folder per project and inside a folder per version, something similar to this
if in doubt copy the assembly, disk space is cheap.
Filed under: Best Practices | Leave a Comment
Tags: dll assemblies layout
I had a bit of trouble getting to this, so for self reference more than anything, I thought I d post about it.
Given the following class
public class MyClass
{
private string _name;
public string Name { get { return this._name;}}
protected MyClass(string name)
{
_name = name;
}
}
I thought that the following would be the way to create an instance of it:
Activator.CreateInstance(typeof(MyClass), BindingFlags.NonPublic, null, new object[] { "MyName" }, CultureInfo.CurrentCulture);
However it throws a MissingMethodException: Constructor on type ‘ReflectionCreateInstance.MyClass’ not found. However if we add the Binding Flag for instance then it works.
[Fact]
public void When_creating_with_activator_Must_use_apropriate_binding_flags()
{
string myname = "MyName";
var myClass = (MyClass)Activator.CreateInstance(
typeof(MyClass),
BindingFlags.Instance| BindingFlags.NonPublic,
null,
new object[] { myname },
CultureInfo.CurrentCulture);
Assert.Equal(myname, myClass.Name);
}
If you try this with type.GetConstructor or type.GetConstructors the result is the same.
Checking the documentation for BindingFlag.Instance I find
So it was a case of RTFM I guess![]()
Filed under: .net | Leave a Comment
Tags: reflection
Yesterday we had the 3rd IOSCD. It was great fun, the code is all available here.
The sessions
and
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.
Filed under: .net, code_shapes | Leave a Comment
2010 Events Coming Up
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.
Filed under: Uncategorized | Leave a Comment
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
Filed under: Uncategorized | Leave a Comment
Tags: c#, generics
System.IO.FileLoadException: Could not load file or assembly ‘Moq, Version=2.6.1014.1, Culture=neutral, PublicKeyToken=69f491c39445e920′ or one of its dependencies.
- 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
- 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
Filed under: Uncategorized | Leave a Comment
Tags: fuslogw, moq
On Pair Programming
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
Filed under: Uncategorized | 3 Comments
Tags: pair-programming, xp
More than a text editor
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
Filed under: Uncategorized | 3 Comments
Search
-
You are currently browsing the roundcrisis.Find<Solution>() weblog archives.
