Rodrigo Guerreiro

"The purpose of a programming system is to make a computer easy to use", in The Mythical Man-Month
posts - 61, comments - 16, trackbacks - 14

Thursday, October 14, 2010

How about an extension method?

imageSince the release of this nice feature for the .NET Framework, many of us are using extension methods to simplify our code. And according to the DRY principle it’s best to not re-invent the wheel. So, you can search for already “invented” extension methods in the site http://www.extensionmethod.net/

 

ExtensionMethod.NET is a database of C# 3.0 and Visual Basic 2008 extension methods. It contains many user-rated extension methods that will expand your code library immediately.

Extension methods add functionality to existing classes and allow you to expand the .NET framework. This way your favorite functions integrate seamlessly into the framework. For more information about extension methods visit the C# 3.0 and Visual Basic 2008 MSDN Library pages.

posted @ Thursday, October 14, 2010 7:25 AM | Feedback (0)

The Quine problem

Some time ago, Bruno presented to me and Manso the Quine problem (in the context that it’s a problem used in job interviews). In simple words it’s a program that outputs its own source code without using any IO (of course it uses the standard output for the obvious reasons).

I accepted the challenge and developed my very own implementation in C#.

using System;

namespace Quine
{
class Program
{
static void Main()
{
var s = @"using System;

namespace Quine
{1}
class Program
{1}
static void Main()
{1}
var s = @"
"{0}"";
Console.Write(s, s, (char)123, (char)125);
Console.ReadKey();
{2}
{2}
{2}"
;
Console.Write(s, s, (char)123, (char)125);
Console.ReadKey();
}
}
}

Now I challenge you guys.

Until next time ;)

 

P.S.: wow…two posts in the same day :)

posted @ Thursday, October 14, 2010 7:09 AM | Feedback (0)

Friday, June 05, 2009

For whom is sleeping

Have you heard of Project Natal? If not then you’re definitely sleeping…

Fortunately I hereby provide you a real nice video that should hook you up :)

 

Until next time ;)

posted @ Friday, June 05, 2009 7:52 AM | Feedback (0)

Friday, April 24, 2009

ASP.NET MVC – What is that?

Many people still think like this. Others think they know what MVC is, but are all wrong. Another type of developers still think that Web Forms is the way to go and MVC generates all bunch of crappy code.

To all of them I say this: Go Learn MVC Now!

…or go read Rob Conery’s post. He wrote a all lot better the reasons why you should learn MVC than I could ever write.

Until next time ;)

posted @ Friday, April 24, 2009 12:45 PM | Feedback (0)

I’m jealous of the Norwegians

You’re probably wondering why I’m jealous of the Norwegians. As you know, I live in Portugal, that beautiful place bathed by the Atlantic ocean. And now you thinking: “He lost it completely. How could he be jealous of the Norwegians? They have snow and cold when he has sun and warm temperatures. He has lovely beaches when they have nice rocks.” Well, all of that is true. But I’m still jealous and the reason is this.

The Norwegians are so luck. They have the opportunity of watching speakers like Scott Hanselman, Phil Haack, Michael Feathers, Robert C. Martin (aka Uncle Bob), Roy Osherove, Juval Lowy, Ted Neward, Michele Leroux Bustamante, Ayende Rahien, Jeremy D. Miller, Ian Griffiths, Jimmy Nilsson, Scott Bellware and Glenn Block, just to name a few. And all of them are going to be there this year. All together. Oh…I’m so jealous!!!

At some point, in the NDC site, you can find the following:

“The idea behind Norwegian Developers Conference is that it should be able to measure up against any conference in the world. All the speakers are experienced and right at the top of their respective trees.”

I don’t remember in Portugal having this quality in our developer conferences. Until when I have to wait to someone come up with a conference with this quality in Portugal? Until when I have to wait to watch Scott Hanselman or Jeremy D. Miller without having to exit my country?

In Portugal, I estimate that exists, more or less, 10.000 developers. There’s enough audience to support a conference of this quality. I hope that this post enlights someone (aka business-person) to start a similar developer conference able to rival with the best in the world.

Until next time ;)

posted @ Friday, April 24, 2009 8:01 AM | Feedback (4)

Wednesday, April 22, 2009

Where the developer meets the social

Today, I’ve watched the presentation that Scott Hanselman gave in Devscovery last monday. (if you also want to watch it, check Scott’s post)

His keynote got me thinking, whereas the reason for this post. I’m just going to write about my own experiences and I assume that who reads this later may or may not agree with me.

I’m not social. Period!

You may think that as developers our work needs a very small percentage of social interaction. Basically, meetings. Well, but if we want to succeed as developers and climb the ladder in software engineering you’ll need social interaction. I’m really up for information/knowledge sharing. We, the geeks, know the tools that better help us doing that sort of thing.

 

Where am I

  • Blog: This blog has the purpose to share my ideas with others (and getting their reaction, which until now result in just one person) but mainly I’m using it in order to google myself later :) and you can find great developer/blogger out there that have valuable information. I do think that reading blogs is far more important than writing one. There are already great information on how build apps using best practices, a specific technology, how to test our code and so on.
  • Linkedin: In the past it was usual to exchange business cards. I remember my father having an agenda with all his connection’s business cards. But now, I use Linkedin simply because the people on my network is constantly updating their profile and anyone who wants can check what I’m doing or what I’ve done. Since I created my profile I was contacted more often, for job interviews.
  • Twitter: Where you’ll find me more often. I really like the way I’m getting information from the people I follow. The Twitter usage is suppose for you to write what you’re doing. But I’m using it mostly to share articles and posts that I find interesting. And that engaged some very interesting discussions.
  • Stackoverflow: I blame myself for forget to mention that lately you can also find me at Stack Overflow. It’s an incredibly web app that allows a community information exchange. The site is like QA with wiki. Very cool. Way better than this one. [UPDATE]

 

It’s all about sharing information

I think that is also important some sort of gathering where we all discuss and exchange ideas in software engineering. See one of my latest posts:

…put people talking and sharing experiences with each other.

The bottom line is: developer meeting the social == exchanging information

Until next time ;)

posted @ Wednesday, April 22, 2009 2:28 PM | Feedback (1)

Wednesday, March 04, 2009

ASP.NET MVC RC2 + xUnit + Gallio

In case you didn't notice, ASP.NET MVC RC2 is out. Following that release, I've decided to create a new ASP.NET MVC project, but using xUnit instead of MSTest for the test framework. I also want this change to have no impact in the way I develop, which means that I want the unit tests to run inside Visual Studio 2008.

 

Why xUnit?

Here's why.

 

Introducing Gallio

From Gallio homepage:

The Gallio Automation Platform is an open, extensible, and neutral system for .NET that provides a common object model, runtime services and tools (such as test runners) that may be leveraged by any number of test frameworks.

The Gallio platform seeks to facilitate the creation of a rich ecosystem of interoperable testing tools produced by and for the community at large so as to address a far wider range of testing needs than any previous independent testing framework has done before. Unit tests, integration tests, performance tests, and even semi-automated test harnesses should all be able to leverage common facilities where appropriate. Moreover, they should present consistent interfaces to the world so that they can easily be integrated into the systems and processes of the enterprise.

At present Gallio can run tests from MbUnit versions 2 and 3, MSTest, NBehave, NUnit, xUnit.Net, and csUnit.  Gallio provides tool support and integration with CCNet, MSBuild, NAnt, NCover, Pex, Powershell, Resharper, TestDriven.Net, TypeMock, and Visual Studio Team System.

 

Combining all together

DISCLAIMER: The following steps are provided "as is" without any warranty or support. Use this under your own responsibility. Also, this only works in Visual Studio 2008 Team System and I'm assuming that you already have the ASP.NET MVC RC2 installed (but I assume that this also works with RC1 but I haven't test it).

 

1. Download xUnit (xunit-1.1.zip) and Gallio latest releases.

2. Unzip the xUnit file and run the xunit.installer.exe. In the ASP.NET MVC section click on the Enable button (case it's enabled which in this case you'll need to do nothing) and you'll get the green result, like in the picture below.

image  image

3. Execute the downloaded GallioBundle-3.0.5.546-Setup-x86.msi installer and follow the instructions.

4. Create a new ASP.NET MVC project.  When the below screen appears you're now able to choose the xUnit as the test framework. Click OK.

image 

5. Now the tricky part. Unload the test project (right-click on the project and choose the Unload project option).

6. Right-click on the unloaded project and choose Edit...csproj and you'll get something like this:

 image

7. Right below the image element paste this.

<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>  
8. Save and reload the project.
9. Build the solution. Probably you'll get the errors below (if not go to step 10). This happens because the xUnit project templates are built for the ASP.NET MVC RC1 and we're using the ASP.NET MVC RC2. Simply add references in the test project to the assembly System.Web.Routing and System.Web.Abstractions. See the release notes in case you're interested knowing what changed. Basically, this assemblies are no longer distributed with the MVC installer because are already shipped with .NET Framework 3.5 SP1.
image
10. Build again the solution and hopefully all goes OK.
11. Now go to Test->Windows->Test View. Again, this only works in Visual Studio 2008 Team System. With luck you'll have 9 unit tests.
12. Select all and run. You're now running the tests successfully inside the Visual Studio 2008 with Gallio (Check the icon between the checkbox and the result column).
The two last tests are failing, once again, because are built for the RC1. I'll leave the resolution to you :)
image 
 
Success! Hope this helps someone.
 
Until next time ;)
 
Technorati Tags: , , ,

posted @ Wednesday, March 04, 2009 10:35 AM | Feedback (1)

Tuesday, March 03, 2009

My vision in Portugal

Last weekend it was held in Seattle the ALT.NET conference. One of the things that grabbed my attention was that they practiced the Open Space Technology. That's an interesting approach on sharing our thoughts with the all the ones attending the conference. Although, at least for me, the real advantage of the ALT.NET conferences (and also the ALT.NET user groups) is that put people talking and sharing experiences with each other.

For the past weeks Bruno and I have been talking about patterns, methodologies, open source apps and alternative tools. I think that's very into the ALT.NET spirit. Unfortunately, our thoughts are being kept just to us. No one is taking advantage of our conclusions.

My vision is: a software discussion user group in Portugal (or one in Lisbon and another in Porto). I'm releasing this thought as my own. I haven't shared it with anyone. But I would like to know if someone else thinks like me and advocates this idea. I know that exists this group that have been engaging a lot of discussion in the subject of software. But I would like to have in Portugal a freely available discussion on software open to everyone. Senior developers mixed with junior and newbies. A real exchange.

Please send me an email with your suggestions\ideas (rodrigo [one dot] guerreiro [a] agilior [another dot] pt). I would like very much this idea to grow. That's my vision.

posted @ Tuesday, March 03, 2009 8:16 AM | Feedback (1)

Friday, February 27, 2009

Follow me around...

...here. Also I've updated my blog page with my recent tweets ( <-- left side).

If you're interested in the couple words that I mumble every once and a while, follow me :)

posted @ Friday, February 27, 2009 10:03 AM | Feedback (0)

Wednesday, January 21, 2009

An one year delayed welcome post...

ONE YEAR. That's the time I had to wait to post a welcome to João Manso. Finally he started to post.

What I have to say about Manso (that's how we call him, or, as he prefers, "O Manso")?

I've worked with him in two distinct companies, including Agilior. Also he and Pedro were my classmates at ISEL.

It seems that I can't get rid off him. Just kidding!

Welcome Manso! :)

posted @ Wednesday, January 21, 2009 7:37 AM | Feedback (0)

Powered by: