October 18, 2011
I’v been thinking about this, so why not throw it up here? On the one hand it’s an oppotunity to say “I told you so” but ofcours on the other hand I might end up eating my words
Anyways here goes:
Screen will be 4 x resolution
Camera will have “flash” and be 4 or 8 megapixel
Will adopt Air body design and add black bezel
Will loose optical drive (and maybe a few ports? :))
Maybe a bit obvious..
April 24, 2011
So my app for the BlackBerry Playbook was approved a couple of days ago and wend live on AppWorld on the 19. of april. So far it’s averaging 80 downloads per day (it’s free) – 400 in total so far. It’s even got a five star rating – based on one review :-). Still it’s nice to know that somebody likes it.
Heres the AppWorld link: http://appworld.blackberry.com/webstore/content/35798?lang=en
Oh – the app is a clone of my iPhone / iPad app “My Little Book Of African Animals”.
March 18, 2011
I recently helped a collegue with Facebook integration on Windows Phone 7. The requirement was to log in and post a link to the users stream. I quickly came across the Facebook C# SDK found on codeplex at: http://facebooksdk.codeplex.com/. Unfortunately the otherwise pretty straight forward API is poorly documented, so it took me a bit of trial and error to get what I wanted. Here are the steps I took:
Read the rest of this entry »
January 28, 2011
I finally got a chance to try out the entire Windows Phone 7 experience, from creating Silverlight and XNA applications to deploying on actual hardware. But thats not the finally this post is about. The reason I am writing this post is becaus now i FINALY have what I have been missing from Windows Mobile for the last several years: a mature smartphone platform that i can develop for using my favourite toolchain and language.
With arround a days experience total, this isn’t exactly an indepth impression but I have to say I’m very excited. Developing in XNA compared to the work I’ve done in Cocos2d on iPhone is a really smooth experience. And Silverlight – well slap on a listbox, style it which ever way you please, databind it and it just works. A dream of mine just came true.
This is not to say that there isn’t a lot of kinks Microsoft needs to work on – a great platform is more then great developer support. Like the brower – don’t even get me started. And I’m not just talking about the rendering, I’m talking about the whole entering and editing a URL and what not. Also while deploying to WP7 is super fast, I can’t help but think that Microsoft could have done something so that i don’t have to manually unlock the phone each time i wan’t to deploy.
I’m not even going to mention the missing enterprise story here..
All in all I’m starting to think Microsoft have a winner on theire hands if they can keep the updates rolling out quickly. Noe i’m just gonna sit here and wait patiently for a chance to work on the platform professionally.
January 18, 2011
I got this real life question once again just recently:
“Could you show the name of the person who created each order in the list as well?” (domain changed to protect the innocent)
This question is a very basic, but very real, example of why I like the Command Query Responsibility Segregation (or CQRS) pattern.
With a datamodel that looks like the one above, the technical answer is usualy someting like: “Ok, how are we going to do this? Let’s put in a join to the User table. Then lets extend the order object with a display property (!!!) for the users name”. If the team is a little more trained you might hear something more along the lines of: “Ok so we’ll just specify in the query that the object mapper should load the user that’s associated with each order as well”. One is a little cleaner then the other, but both will most likely start to smell pretty quickly. Then somebody comes along and asks for a count of the items on each order and before you know it, your “FetchAllOrders” sql has balooned into some kind of monster join that no one but it’s mother can love (or figure out) and as an added bonus, performance goes south.
In a CQRS environment we have the priveledge of designing solutions like: “Sure, lets just store the user name in the viewmodel for the order list screen so it will be right there for clients to display. Also to make sure it’s kept up to date if it changes, let’s subscribe to the “UserRenamed” event.”.
And for the item count? Just subscribe to the “ItemAddedToOrder” and “ItemRemovedFromOrder” events and update “NumberOfItems” accordingly.
It just makes me feel all warm inside.
January 17, 2011
Working on my hobby poject I came across a familiar situation of having to interact with a (to my domain) external service. The service in this case is push notification. I know the “official” guidance is to not inject services (or anything else for that matter) into domain entities (I completely agree), but I was struggeling with how to follow this advice without breaking the incapsulation of my domain. The critical advice came from a blog post (http://thinkbeforecoding.com/post/2009/03/04/How-not-to-inject-services-in-entities – see “Behavior methods”) by Jérémie Chassaing.
The techniques is familiar, but i’m surprised how perfectly in makes sence for these kinds of cases. My event handler ended up looking like this (domain has been substituted for a basic blog for the example):
public class PostChangeHandler : IHandle<PostAddedEvent>, IHandle<PostUpdatedEvent>
public PostChangeHandler(ISessionFactory sessionFactory, ISubscriberNotificationService subscriberNotificationService)
this.sessionFactory = sessionFactory;
this.subscriberNotificationService = subscriberNotificationService;
void IHandle<CommentAddedEvent>.Handle(CommentAddedEvent domainEvent)
void IHandle<CommentUpdatedEvent>.Handle(CommentUpdatedEvent domainEvent)
private void NotifySubscribers(Guid postId)
using (var s = sessionFactory.OpenSession())
using (var tx = s.BeginTransaction())
var post = s.Get<Post>(postId);
Command handlers are a great candidate for DI in my opinion. Leaving it up to the command/event handler to supply the service to use in the concrete case makes a lot of sense too. I find that the above leaves me with a domain that describes exactly what i want it to: “Who should be notified?” – all while abstracting away the concrete “How”.
January 8, 2011
Continuing with unit testing the ASP.Net MVC JSON service I am playing arround with, I got arround to the login action. For whatever reason, an instance of WebClient does not preserve cookies across multiple requests. What that meant was that all thought I was logging in fine, subsequent calls were failing due to authentication.
Fortunately it’s quite easy to make WebClient preserve the cookies. Heres how:http://couldbedone.blogspot.com/2007/08/webclient-handling-cookies.html
I rolled that into a class called JsonWebClient, along with the other options I was setting on the standard WebClient in each test.
public class JsonWebClient : WebClient
this.Encoding = UTF8Encoding.UTF8;
private CookieContainer container = new CookieContainer();
protected override WebRequest GetWebRequest(Uri address)
WebRequest request = base.GetWebRequest(address);
if (request is HttpWebRequest)
(request as HttpWebRequest).CookieContainer = container;
Now I can do tests like this:
public void LogOnTest()
var webClient = new JsonWebClient();
var logOnModel = new LogOnModel()
Email = "email@example.com",
Password = "12345",
RememberMe = true
var result = DynamicJson.Parse(webClient.DownloadString("http://localhost/WebSite/Product/BE33A625-63F3-4014-85E7-D306F00A5A7E"), UTF8Encoding.Unicode);
January 1, 2011
I’m currently messing with setting up unittests for a JSON/REST’ish service. My goal is having (or at least have a looke at having :)) a test suite that executes over HTTP in exatcly the same manner as an actual client. One advantages of this I think, will be the ability to execute the tests against a remote system, once the system is deployed.
Trying to figure out the best way to inspect the returned JSON data, I came across DynamicJson (http://dynamicjson.codeplex.com/). The library combines the new C# 4.0 dynamic features with a JSON parser to allow for what you see below:
public void GetList()
var webClient = new WebClient();
webClient.Encoding = UTF8Encoding.UTF8;
var result = DynamicJson.Parse(webClient.DownloadString("http://localhost/WebSite/List/BE33A625-63F3-4014-85E7-D306F00A5A7E"));
December 22, 2010
I’m right now listening to the first episode of “Distributed Systems Podcast” – a brand new postcast by Andreas Öhlund, Jonathan Matheus, Jonathan Oliver and Rinat Abdullin.
If your following the CQRS/DDD google group (also very recommendable) you allready saw this, but in case you diden, it shows lots of promise. So there’s your “head’s up”
Go check it out: http://distributedpodcast.com
December 20, 2010
I just read the 10 pages that make up “Life beyond Distributed Transactions: an Apostate’s Opinion” by Path Helland (Amazon, Microsoft). If your at all interested in scalability, messaging ect., i highly recommend it: http://nosqlsummer.org/paper/life-beyond-distributed-transactions