I got a Windows Phone 7 to play with for a while and these are some notes about the experiment.  I just did a tick-tac-toe based on this blog post changed a few things tho (like the use of extension method for checking for wining and replaced by bit shifting :D ), but I wanted to have some code to fall back to just in case.

NOTE: I have an android phone, and had an iPhone for a while in the past, so my expectations about this phone are probably based on them.

As soon as I connected the phone to my computer it prompted me to install the Zune software, after installation you get this:

Capture

restarting my machine? we are not in 1999, this shouldn’t be a requirement.

Also when I was trying to install some game, the phone displayed a message about the fact that some installations require re starting the phone. Very strange

Rather randomly on an LG –E90099 I get the error that the phone is pin locked (it isn’t :( ).

If while trying to debug to your phone you get an error, “The application could not be lauched for debugging. Verify that the application is installed on target device” that, for me , meant that the phone was locked (ie dark screen) Make sure you can see the menu and try again

Capture

After these initial errors, I pretty much moved pretty quickly.

I  am quite surprised by this, but at least for game development  (with xna) this little trial has been incredibly painless.

Regarding the phone OS,  there are some aspects that I really dislike:

  • A lot of screen is wasted, for example if i search online for something, I can only see about 2 to 3 results.
  • The facebook integration (I dont want facebook). Probably it can be turned off?
  • Figuring out how to un-link the hotmail account to the phone is quite tricky (it might be just me)
  • Having to restart your phone after installing an app is just not acceptable.

Things I liked about the phone

  • Dealing with text in general is superior at least to the android experience. ie writting texts and email was a good experience
  • Generally fast and non cluttered

In general my perception of the phone has improved after trying it . And I have to add I m pretty impressed by the Zune software, it looks good, it worked flawlessly. Comparing to iTunes and Samsung Kies it’s way ahead.

I like XNA, and the fact that it was so transparent to deploy a game to the phone was really nice.


So a few Scientists and a few developers met last Wednesday. It was hard to know where we were going to end and thanks so much to everyone that participated. The following is a summary of the tips we (scientist + developers) thought was a good idea

Tips for scientists writing code (1st Round):

  • Talk to other scientists that work on similar projects and share a list of your most used functions (I cant remember the name of the person suggestion
  • Every now and then meet up with other scientist writing similar code to you to talk specifically about the code you write, after all if you know the tools you are working with better, you are bound to be more productive
  • Use source control. There are pretty good open source alternatives and many places that offer free storage. Some source control options: Git, Mercurial, subversion. Some places to host your code: github, bitbucket, google code, codeplex
  • Use variable names that indicate what you are talking about.
    • Some bad examples: your_cat_name, sss, ttt, etc. Some good examples: portionOfSphere, portion_of_sphere.
  • In the case of IDL, avoid for loops and try to use functions
  • Try to get used to reading others people code so that you realise where you can improve, or point out things that can be done i na more effective way

 Help a scientist day

The above is all well and good, however. We were also thinking about collaboration. So Philippe came up with a great idea: Help a scientist day.

  • A scientist submits (somewhere to be discussed) a problem she or he thinks it could be solved with some help of more developers
  • people can ask questions about the idea (either technical details or just to check that its a problem similar to theirs)
  • People can vote on ideas (no need to sign up )
  • The ideas with most votes (that are doable) will be the ones that will be implemented by developer during “Help a Scientist Day”

So, we need to organize this day, please comment on G+ so we can get this going

Cheers


XNA is the SDK from Microsoft for game development.

  • XNA getting started tutorial. Well organized, paced  series of  XNA tutorials by a guy that teaches this. If you know nothing this is pretty good.
  • Xna workshop. Some posts and links to learn XNA Is kinda handy to see other people’s questions
  • Riemers XNA Tutorials. I think this is a link you want to keep, every time I search for something XNA related I get a post from this guy
  • 2D Camera with parallax scrolling. Does what it said on the tin, very comprehensive article that also links to other interesting articles.
  • Mono game. The good news is that there is a port :D … “MonoGame is an open source implementation of the XNA APIs that allows developers to build 2D games that run on Android, iPhone, iPad, Mac, Linux and Windows using the same code base, or reusing existing XNA code that runs on Xbox 360 or Windows Phone 7″
I ve been reading Learning XNA 4.0 its pretty good so far, well written and easy to follow tho with enough detail.
If you know of other good details, please comment :D

What an awesome experience to organize and participate in this event.

It was a long day but I think people enjoyed it, learned a lot and got to try a few new things.

Code Retreat. A bad picture of breakfastCode Retreat. Early birds2011-09-17 08.53.33

At 9, Jose  explained how a Code Retreat works and Kevin(below) explained Conway’s Game of Life, the problem to solve during the day.

2011-09-17 09.12.36

Sessions

A code retreat has many sessions of 45 minutes each. Below is how most of the sessions looked

2011-09-17 09.24.112011-09-17 13.59.20

2011-09-17 13.59.372011-09-17 13.59.28

Session 1

At 9.10 am we started our first session.

Constraint: To code Conway’s Game of life in pairs.

At the beginning of the session all the pairs were talking to each other, but after 5 min or so we saw a change towards writing code.

Retrospective:

  • A few solutions to the problem emerged.
  • A healthy discussion about the problem constraints.

Pair count by language:

  • Python: 3
  • Ruby: 4
  • C#: 2
  • Php: 1
  • Javascript: 1

Session 2

Constraint:  To discuss the solution for 10 min, and to test drive or unit test the solution.

Retrospective:

A pair came up with a solution that used 2 lists.
More people using javascript, as it’s a language that most can understand. Jasmine (BDD for Javascript) was a handy tool since you can run it in the browser.

Pair count by language:

  • Python: 3
  • Ruby: 2
  • C#: 2
  • Php: 0
  • Javascript: 3
  • Java: 1

Session 3

Constraint:  Avoid the use of primitives.

Retrospective:

In this session we got more feedback:

  • As a result of the restriction we got self documenting tests
  • Not enough time
  • Arriving at a better design
  • One of the pairs spent most of the time just analyzing
  • Some questions about testing in general. What do you do when tests are just too big? The general answer was around the lines of break it down into smaller tests and skip or remove from code and add to To do list. Another question was about mocking

Pair count by language:

  • Python: 2
  • Ruby: 1
  • C#: 1
  • Php: 1
  • Javascript: 3
  • Java: 3
— Lunch Break.  Retrospective: Yay! —

Session 4

Constraint:  TDD as if you mean it tho since not everyone was comfortable with testing, it was optional.
Retrospective:  Four pairs tried TDD as if you mean it, however the concept wasn’t very clear. (this was probably my fault, as I explained it badly, sorry)
Pair count by language:

  • Python: 1
  • Ruby: 2
  • C#: 2
  • Php: 0
  • Javascript: 3
  • Java: 1

Session 5

Constraint: No conditionals
Retrospective:
The general feedback was that the pairs felt  that they were arriving at more elegant solutions with more classes, which resulted in more readable tests.
Pair count by language:
  • Python: 2
  • Ruby: 1
  • C#: 2
  • Php: 0
  • Javascript: 2
  • Java: 2

Session 6

This was the last session after a long day. The feedback on the ground was that people felt a bit frustrated that they didn’t have enough time to finish the problem; so session 6 was: Finish the problem.
There was no retrospective as people started to leave. However it felt like people left happy. Splitters!!
NOTE: There is another Code Retreat in Dublin this coming  3rd of December as part of Global Day of Code Retreat check CodingDay.org for more details

In the last few years the tooling available to .net developers for unit testing in general has matured, these are some of the tools  that I either used or heard of :

Continuous Integration:

  • Team City: I use it and really like it, simple to set up and use, if you want to try it they have a free professional edition .
  • Cruise Control.net: Open source, used it but didnt find it too friendly, I m aware a lot of people use it
  • Hudson. Originally a Java only project but there are some success stories on the .net fence, has some features unavailable in the other two mentioned above.
  • there must be something else. ?
BDD Frameworks
  • StoryQ:  This is what I use. Like it because you write C# code with some constraints and it generates reports on the behaviour. Samples: code report
  • Cukes/Cucumber: I remember the first time I saw cucumber in action I was really impressed, however it’s hard to get buy in for a tool that requires another language installed, probably fine for some projects, it depends a lot on the project, the company and the culture.
  • SpecFlow:  you write features in Gherkin(the cucumber spec language) that are then compiled into c# code. Nice reports, but I find the generated code hard to read… ie a bit too verbose (example feature example generated code) however I wouldnt discard it totally.
  • NSpec:  You write c# code (very lambda-y)  and it generates reports.. like it even less for reasons similar to the above,  have a look at it yourself here
  • Fit/fitnesse:  I haven’t tried it, it supposed to be very good, I ll leave that one to you (would love some feedback on this if anyone reading did try it)
Unit Testing Frameworks.
  • xUnit: a nice, compact unit test framework, I like it because it has less noise,  no setup method (ie it uses the ctor for
  • nUnit:  The most popular one.
  • mbUnit: good support for RowTests.
  • _
  • msTests: the option by Microsoft. I tried this framework when it came out, so perhaps not valid anymore. My experience with it was that the same set of test ran 20% slower. Also it had poor support for theory tests. Maybe this all changed. I will guess that anyone using this framework does it because they can’t use anything else
Builds
  • Psake:  powershel based DSL for building
  • Rake:  Ruby based Dsl for builds, nice to use ruby, but sometimes needing the ruby dependency is a deal breaker
  • Nant: not something I would choose, but hey if you like xml this is the way to go (if you like Xml you might want to talk to your doctor too ;) )
  • MSBuild:  I find it non intuitive, I thought I was being unfair so I asked in twitter what ppl thought of it. One supporter and 4 not really happy with it (see below)
  • Final Builder : a commercial option, and not a bad one to be honest. Very easy to use (drag drop style) tho not as flexible as we needed.
Code Coverage
  •  NCover: does the job but I think the generated graph could be better. Running the tool was cumbersome too as far as I remember
  •  dotCover : really nice and integrated with resharper, it a bit rough around the edges with lambdas and other minor things, but a tool I use day to day
Feedback and anything that wasn’t mentioned yet , please feel free to comment
Cheers

During the past weekend I was at DDD Scotland, it was great to meet all the people there.

I  apologize for the amount of lolcalts that I added to my presentation (available below) and any feedback, etc more than welcome.

In many ways it was good to get the presentation out of the way early  because it meant I could focus on being out there listening to other folks smarter than me talk and meet some people.

After my talk I was at Gary Short’s presentation on hoe to measure performance, interesting and really well delivered. Some interesting questions too.

Then I was at Seb Rose talk on TDD and unit testing. It was interesting to see that you can test drive a C++ app. His advice was sound. He talked about the importance of setting a structure before starting to test. He talked about the importance of deployment. And how it was important that the tests were also clean and well designed. Link to his slides

After that there was lunch, unfortunately (or not)  I couldnt catch any of the grok talks as I was talking to people, one of the ideas we had was to open source a project (not mine :S) that would make using selenium+qunit on CI easier… will see how that goes.

After that I joined a talk by Toby Henderson,  The dark parts of Mono. I reallly enoyed this talk. Info about small standalone tools or libraries that you can use, with examples. Such as IKVM, Cecil, SIMD, Compiler and Gendarme.

Finally, I joined the “Ask the Speakers” panel, very relaxed and quite fun. We talked about the news (Mono and its future, other stuff I cant remember – please comment),  innovation and community. There is a post of note that goes into some of the stuff we talked about .

All in all a great event, thanks to everyone for making it possible.


DDD Scotland is happening next weekend, I’m really looking forward to it. I’m also very happy my talk got selected, thanks everyone that voted for it.  The agenda is very interesting here are my picks:

Starting at 9:30AM and If you are not interested in CQRS/ES,  there is two talks that sound interesting: Streams of Streams – Your Rx Prescription, by Ray Booysen and Chris Canal ‘s Monodroid Introduction, I could really use seeing a talk on this as I ve been playing around with it lately. Conferences are really those times when you wish time could effectively go backwards, damn causality… (look here if you want vaguely related lolz)

Later on Decision time again, there are two talks that I would be interested to see: Asymptotics and Algorithms – What You’ve Forgotten Since University by Gary Short. I m not going to lie, I had to look up what Asymptotics meant Confused smile . The talk is about calculating the efficiency of an algorithm, something we tend to leave to the framework these days.. but we probably should know about. The other talk I m interested in is Barry Carr’s  Caliburn Micro talk, it seems like that framework has packed some very interesting ideas, I only heard some of them  after listening to that Herding Code podcast with Rob Eisenberg.

The talk about scalable web  with Asp.Net sounds interesting too .

At 12:00 there is a talk that I need to go see, that’s Seb Rose’s talk on unit testing, reasons being: first, because its about unit testing, but the Skeleton reference I like too, the fact that he contributed some of the 97 things every programmer should know(or architect, cant remember which  one) .  Another talk that interests me but I wont get to is BDD with F# By Phillip Trelford

After lunch there are three really interesting sessions that I’d like to see:

  • Seb Lambla’s “Building composite applications with Open frameworks” from a very quick glance at the video available in Channel 9, it looks like a talk about using OpenWrap, and how to integrate it to your workflow, and that’s something worth watching.
  • “SpecFlow – functional testing made easy” by Paul Stack, would like to see how it compares to StoryQ…
  • “The dark parts of Mono” by Toby Henderson, interesting cause I ve been meaning to see this for a while.
  • If I was into Silverlight at all, the talk to not miss would be Daniel May talk on Silverlight Unit Testing “Real World SLUT (Silverlight Unit Testing)”

The last sessions of the day are also pretty interesting, I think the one I ll end up in would be: “How to build a framework, and why you almost never should.” by Richard Dalton , a last minute change could see me going to : “Rewriting software is the single worst mistake you can make – apparently.” tho what puts me off this is a probably wrong, and its the fact that is a story of migrating to VB.Net, a language that I honestly can’t understand why still exists or why does Microsoft funds, but leaving that aside sounds like a story worth listening to.

See you there


Hi :

Recently a group of us (tho mostly Pablo Nuñez ) translated the article from Udi Dahan Clarifying CQRS. Here is the link to it, if you feel that it can be improved please just leave a comment here and I can add you to the document with edit rights. Some terms where hard to translate.

Thanks to Pablo, Carlos Peix , Jorge Gamba and everyone that retweeted and helped.

———-

Hola:

Me pareció que el articulo de Udi Dahan, Clarifying CQRS, podría ser muy útil para la comunidad de desarrolladores hispano hablantes.

Así que algunos de nosotros decidimos traducirlo, aquí esta  el link , la mayoríadel credito debe ir a Pablo Nuñez . Pero también gracias a las demás personas que ayudaron: Carlos PeixJorge Gamba , etc (la verdad no me acuerdo quien mas perdón:) )

Si tienes algún comentario o corrección simplemente deja un mensaje aquí y te puedo agregar al documento con derecho de escritura.

Gracias


I ve been talking to some people over the past few months about CQRS, particularly CQRS/ES and at some point of the conversation I get the framework question.

I think the implementation of the patterns CQRS and ES is not trivial (it’s also not necessary to do both , but lets keep going) however, the escence of the advantages you get out of both comes from implementing the rules of the domain, in the domain. By making the state transitions explicit.

The number one reason why you should learn about CQRS without a framework is because, it could cloud your understanding of the domain with artificial constraints. Another important reason is that when you learn by doing, you understand the workings and shortcomings of a particular methodology.

That is not to say that frameworks are bad and you should never use them, but make sure that when you make a decision like that, it is a conscious one.

I remember one day when I was at a talk by Gregg Young, and he said: How many of you use (ms)SQL? How many of you made that conscious choice? (ie to use an relational database for storage) .  I realised then that, I didn’t make that choice or considered an option in certain cases, but what scared me the most is that I was making a bunch of assumptions as soon as anyone said “system” , it made me realise that most of those assumptions could blind me into not really considering all the options.


Say we are not concerned with the query side of things (because we have an autonomous query service that need not know about your aggregate roots). With that in mind, in which cases do we need to know about the aggregate root private data?

I can think of one case – when checking for duplication. Then we would have to

    • Be happy with eventual consistency (ie some check before actually trying to save) or
    • rely on the persistence layer for uniqueness and on failure, get a meaningful  error.

In any other situation, we are likely to be doing something that is meaningful to your domain. For example, lets pretend a product stock amount had to change, the code would look like this

Product product = _repository.Get(id);
product.Stock = 2;
_repository.Save(product);

class Product
{
     public int Stock {get; set;}
}

That code would have probably lived in a service, or even worse, in a controller What are the problems with this?

  • Lack of intent. When you look at the code for Product, you’ ll see a Stock (or quantity) property, and in this case its a pretty simple field. However you have no idea from looking at the code, how this property is used.
  • Possible implicit behaviour. There is always a chance that the setter contains some logic .
  • Context, perhaps adding Stock has certain rules, maybe when >100 are received  then someone has to be notified, or they need to be moved to another warehouse.

Instead, you can write an AddStock method, which in reality would do something a bit more explicit ( I m sure you could call it StockDelivered or similar, but I guess it depends on your domain …)

Product product = _repository.Get(id);
product.AddStock(45);
_repository.Save(product);


// and in the product AR
class Product
{
       public void AddStock(int receivedStock)
		{
			Contract.Requires<ArgumentException>(receivedStock>= 0);
		   	_stock += receivedStock;
		}
}

This is a more explicit  design. However, the question of testability comes to mind, and the way you write your tests depends on the flavour of DDD you are using. If you are using DDD with CQRS/ES, then you would be publishing an event with the changes. If you are not, then you could rely on checking the product stock before and after the operation, through a query service.

 

Related Articles

The Flawed theory behind unit testing (Feathers)

Doing it wrong: getters and setters




Categories

Follow

Get every new post delivered to your Inbox.