Command-Query Separation

No, I'm not going to talk about CQRS, but the ideas behind both concepts are similar. The Command-Query Separation principle was first introduced by Bertrand Meyer in his book Object-Oriented Software Construction. Mr Meyer states as follows: Functions should no produce abstract side effects. Meyer differentiates two kind of functions when we design a class: Commands: those functions which produce abstract side effects (change the observable state of the object). Queries: those functions that don't produce any side effect and return some value.

Bilbostack

Last Saturday (January 17th) the Bilbostack conference was held in Bilbao. It was the fourth edition of this conference and it was a complete success. I'm really glad to be part of the organisation of Bilbostack, sharing this responsibility with Ibon Landa, Asier Marqués and Fran Mosteiro. I like to organize Bilbostack for many reasons: It's "easy" to organize. We don't open a Call for Papers. We meet one day in a beer, take some beers and make a list of the people we would like to speak at the conference.

Professionalism

According to Wikipedia, in some cultures the term professional is used as shorthand to describe a particular social stratum of well-educated workers who enjoy considerable work autonomy and who are commonly engaged in creative and intellectually challenging work. According to Google Analytics you probably come from one of these cultures. I have to admit that when I started to hear the term Craftsmanship I was distrusting, maybe because some of the people that used it tried to use it as a label to put themselves in a higher level than the rest of us.

Test Driving ASP.Net routing

In this article we will see how can we test drive the routing configuration of an ASP.Net web application. Let's start with our first test: [TestMethod] public void TestSimpleRoute() { RouteCollection routes = new RouteCollection(); RouteConfig.RegisterRoutes(routes); // Act - process the route RouteData result = routes.GetRouteData(CreateHttpContext("~/Admin/Index")); // Assert Assert.IsNotNull(result); Assert.AreEqual("controller", result.Values["controller"]); Assert.AreEqual("action", result.Values["action"]); } private HttpContextBase CreateHttpContext(string targetUrl = null) { var mockRequest = new Mock<HttpRequestBase>(); mockRequest.Setup(m => m.AppRelativeCurrentExecutionFilePath) .Returns(targetUrl); mockRequest.

Don't do experiments with your client's money

Imagine you "manage" a development team. Imagine you reach to have a product that your client is reasonably happy with it. Imagine that the architecture of the application is a mess. Imagine that you don't have any test. Imagine that the performance of the application is clearly improvable. Imagine that you can improve the user experience a lot. Imagine that you UI layer is made in a 14 years old technology.

Agile Dev Practices

Last week I attended to Agile Dev Practices, a brand-new conference done in Postdam, organized by Diaz Hilterscheid, the people behind the renowned Agile Testing Days. It was my third international conference (the first outside Spain) and the first one I have gone as a speaker. I had the good fortune to assist to Carlos Blé tutorial about “Practical BDD for RIAs with JavaScript”. It was a great tutorial, more suitable to do in two days (or at least, one and a half) but equally great.

A Premier League team will win the Champions League this year

Spain and Germany are dominating with an iron fist last Champions League editions. After a lot of investment, a Premier League team is ready to conquer the longed for trophy. In this article we’ll demonstrate this fact. The data We’ve borrowed the data for this study from the UEFA’s official page. If you go to this address http://www.uefa.com/uefachampionsleague/season=2011/matches/all/index.html# you’ll see all the matches played in the season 2010/2011. Change the year in the query string to see another year’s results.

Arrays in F#

Arrays are one of the basic data structures in F#. In this article we’re going to see an introduction of what can we do with them. Creation There are several ways to create an array in F# Create from a literal We can create an array with a predefined set of values. To do that, we just need to specify the values separated by semicolons and wrapped between [| and |]

Decorator pattern in F#

Introduction A couple of weeks ago my friend Ian Russell explained the decorator pattern at work. For those who don’t know exactly how it works, the decorator pattern allows us to add behavior to an individual object without affecting the behavior of other objects of that class (Wikipedia). The object oriented solution There are a couple of typical implementations of the pattern in C#. The “lightweight” version is “just” to create decorators implementing the same interface of the decorated class, and passing the decorated object in the constructor of the decorator.

Function composition and pipeline operator

As Scott Wlaschin points out in his excellent article function composition it’s not the same as using the pipeline operator. The definition of the pipeline operator is this one: let (|>) x f = f x So, take the thing on the left hand side of the operator and use it as the last parameter on the function in the right hand side. On the other hand, we have this definition for the forward composition operator (»)