Learning NServiceBus

Standard

Over the past two years, I’ve been architecting and building a system, applying design principles I’ve learned over the years doing software architecture at Info Support, and from the excellent “Advanced Distributed Systems Design” course by Udi Dahan. Now, I should say that these are no “one-size-fits-all” design principles; in fact there’s never a one-size-fits-all architecture for anything. But they had a natural fit with the problem domain that we are working on.

The two year timespan stems from the fact that we have been (and are still in the progress of) migrating the system from a classic ASP.NET three tier architecture to a more disconnected and distributed one, using messaging where applicable. This has helped us achieve more flexibility, better separation of concerns and an overall faster system for the end user. We’re not finished yet, as there’s a lot of legacy code left to migrate and all the while, the shop has to stay open, but we’re definitely getting there.

NServiceBus logoOne of the tools and frameworks that have been crucial in this re-architecture is NServiceBus. For those who don’t know NServiceBus, it is a light-weight, very elegant .NET framework, built around the principles of a distributed, service oriented architecture, using messaging. It’s designed by Udi Dahan and his team at Particular Software. In fact, NServiceBus is the direct result of the architectural lessons and experiences Udi has learned, architecting systems for customers over many years.

While NServiceBus is very light-weight, it still has a bit of a learning curve, to really understand the concepts and apply them correctly. Especially if you haven’t done the ADSD course mentioned earlier, some things might seem a bit abstract to a developer at first.

There’s always been documentation on the NServiceBus website, but not always up to date and a bit fragmented to my liking. There’s also the very helpful and thriving NServiceBus community group, where you can ask a great variety of questions to a great bunch of experts. There’s even a great NServiceBus course on PluralSight by Andreas Öhlund. But with NServiceBus 4.0 out, the course material is a bit stale on some of the technical stuff.

What was lacking most was a well structured, easy to follow guide on using and understanding NServiceBus, to be used as a companion when building your application with it. Fortunately, there’s one now: the book “Learning NServiceBus”, written by the awesome David Boike. David is an NServiceBus Champ, a very active contributor in the community forums and an allround knowledgeable software architect.

Learning NServiceBus book coverLearning NServiceBus is a great companion to building applications using NServiceBus, as well as administering and operating those applications. What I like best about the book is that it’s well structured, building up from the most basic “hello world” type scenario to the more complex capabilities, such as Sagas, and error handling & second level retries. All the while, it provides great background info on the architectural considerations behind NServiceBus. David has a pleasant, witty writing style which makes it easy to read. Not your average “dry” software development book, luckily.

You can also download the sample code used throughout the book, but I find it a better learning experience to build the samples from scratch as you read the book.

The book focuses on the all new NServiceBus 4.0 release, containing a bunch of important changes compared to 3.X, which makes it all the more worthwile to check out this book!

My congrats to David Boike on getting the book published. Great work and well recommended! You can get it from the publisher’s website.

Azure Service Bus Notification Hub for iOS + Bonus Xamarin Binding!

Standard

Recently I’ve been working with Edwin van Wijk on the brand new Azure Service Bus Notification Hub by Microsoft. It’s a unified messaging hub for delivering push notifications to mobile devices. It’s became GA in August 2013, and now supports all major mobile platforms, including iOS and Android.

Here’s a video of our presentation on this topic, at our weekly tech meetup at Info Support HQ (it’s in Dutch):

The service is quite nice, and is a cloud based contenter to products like PushSharp. You won’t need custom hosts for the integration, which is a benefit over PushSharp and the likes. However, in its current (Preview) version, it doesn’t support nearly as many platforms as PushSharp.

The Notification Hub builds upon the Azure Service Bus infrastructure for relaying messages in a massively scalable way. This means that it also leverages Service Bus’s topics and subscriptions feature for easily grouping messages using Tags. A nice way to filter messages and distinguish groups.

Edwin and I did a session on this. You can find the slides here. The slides are in Dutch by the way.

For iOS, Microsoft has released a native Objective-C library as part of their Azure SDK. There’s a tutorial on MSDN that nicely describes the steps you need to take to consume the library in XCode.

In order to test it, you’ll need to set up quite a lot of prerequisites, including a Windows Azure Service Bus instance, a Notification Hub, Apple AppID and an APNS certificate. A bit finicky to set up, but once it runs, it works nicely.

Xamarin.iOS binding
It’s quite logical for Microsoft to release an Objective-C library at first. Still, I felt a bit dissatisfied having to write my app in Objective-C. I have been wanting to experiment a bit more with creating a C# binding to Objective-C libraries, so I’ve decided to make one available for this library.

I have a working version up on GitHub, which includes a sample. It’s based on the latest API version – you’ll need a Notification Hub created after April 2013 for it to work. You’ll also need to setup your own certificates and fill in the Service Bus namespace, Notification Hub name and Shared Access Secret Listen key.

Basically, you’ll use the library in the RegisteredForRemoteNotifications method on your AppDelegate class. I have a write-up on that in an older blogpost here.

The current binding is a basic one. Completion handlers are mapped to delegates, and I think some of the type mappings could be more C# friendly. I’d also like to make it async/await friendly but I’ll have to experiment with that a bit more.

I’d love to hear your feedback on this!

[UPDATE August 13th, 2013: I've updated the Xamarin.iOS binding to the GA version!]

Xamarin Evolve 2013 – Day 4

Standard

And so, Evolve 2013 has come to an end. Time flies when you’re having fun. This was day 4 for us in Austin. Four days of Xamarin mobile goodness.

This was another interesting day. It started off with a session by Josh Clark from Global Moxie, and author of Tapworthy on user interface design and touch. While his message – have users directly interact with content instead of indirections, such as buttons – wasn’t revolutionary, he had a couple of nice and inspiring examples to show us. Apps that have implemented some innovative UI’s. A nice session to start the day with.

Oh, and he had a picture of an OCD Chef’s cutting board… man I gotta have this in my kitchen :)

After that, I went to Marek Safar‘s session on Using Async in Mobile Apps. He shared some good tips and pointed out some pitfalls around SynchronizationContext when using Async.

Most of the day was spent in the hallways of the Hilton though, talking to people, meeting all the faces I have in my Twitter stream in person. This was awesome. Great to share a passion for mobile development with Xamarin and talk face to face about our experiences. Thanks Greg, John, Wally, Ben, Nic, Stuart, Miguel, Nat and all those I forgot to mention for catching up.

Of course, Marcel (@marcelv) and I did our own session titled “Sharing 80% of Code on iOS, Android and Windows Phone”. We decided to give our own take on code sharing, and how to achieve this in a low barrier, simple way. We spent a lot of time during the conference, speaking to developers with all different levels of coding skills and we found that a lot of them were impressed by some of the frameworks and approaches that were being presented for achieving code reuse, but for whom all of this went a bit over their head. These frameworks tend to hide a lot of clever tricks, and you also run the risk of over-abstracting. So we took our lessons learned from a real life example app we built for a customer, and explained some small but clever architecture and coding tricks.

We got great response afterwards, and got some requests for sharing some of our code. Marcel and I will be working on a blogpost, showing all of the constructs we presented today. Have an eye out for Marcel’s blog. We’ll put it up there and I’ll cross post it here as well.

I visited Nic Wise‘s session about MonoTouch.Dialog as well. It’s tough to be the last session of the day, but he did a good job. I’m not entirely convinced that MonoTouch.Dialog is a solution in every scenario, but it does provide a neat way to quickly code up an iOS UI.

So after that, it was time for the closing keynote already… Nat and Miguel announced Evolve 2014, and in order to show their commitment, five lucky birds in the audience won a ticket. Awesome, can’t wait for the next installment of this awesome conference.

In closing, I’d just like to give my compliments to the whole Xamarin staff and the production company for putting together an inspiring conference. I loved the attention to detail that was visible everywhere. I enjoyed the vibe, the great food, and the fantastic content.

See ya’ll next year!

Xamarin Evolve 2013 – Day 3

Standard

Day 3! Or actually Day 1 of the Evolve conference, to be exact. And whew what a day!

Of course the conference kicked off with the keynote by Nat and Miguel. What a well produced and slick show! A big stage, with gorgeous graphics on the big projector screens, awesome. You should definitely check out the video of the keynote here. We were proud to see Info Support there as Silver Sponsor:

Xamarin blew everyone away with a couple of great product announcements today. Only six weeks after releasing Xamarin 2.0, four major new features were announced:

C# 5.0 async/await
This C# compiler feature enables much cleaner syntax for async programming, resulting in better readable and shorter code. Moreover, less chance of bugs due to event handlers dangling around. Async/await was announced by Xamarin a short time ago as a beta, but available as of today in a final version.

F#
For those who like functional programming, F# is now a first class citizen in the Xamarin stack as well. I’m still new to F# but I’ll definitely check it out. A nice addition.

But the biggest features, that got the whole audience exploding were…

iOS User Interface Designer
WOW! This was some rabbit Miguel pulled out of his hat. An iOS UI designer embedded in Xamarin Studio, to replace having to resort to XCode’s Interface Builder. And it does not only replace it very well, but goes way beyond what IB does. Besides looking gorgeous, the designer tightly integrates with the code generator in Xamarin Studio. Adding controls to a view automatically adds member variables to the class. Actually they’re still outlets, but you won’t have to worry about them. So dragging lines from UI elements to Objective-C code files is over. I used to get so many smirks from Visual Studio developers when I demo Xamarin / XCode integration in my talks. This is all over now. No more explaining what an outlet is, because… as Miguel mentioned in his talk:

I am glad though, that Xamarin stayed closed to the Apple structure when it comes to the generated code. As far as I can see, the designer generates code that is compatible with code coming from the XCode integration. Controls are still marked with an [Outlet] attributes, etc. I have yet to try the designer myself, but I assume that XIB files and storyboards are instantly usable with the Xamarin designer.

Furthermore, any UI component that you might have in your solution, be it from the Xamarin Component Store, from a referenced DLL or self coded in your project, automatically becomes available in the designer. And what’s more, it shows a live preview of the control at design time!

I really didn’t expect this designer to be available so soon. I had seen screenshots and ideas from Miguel but I thought that it was still some time away from becoming a real product.

Again, kudos to the Xamarin team!

Like Miguel mentioned… If you ever think “Xamarin should do UMMM…”

Xamarin Test Cloud
Again, WOW! After the iOS designer, people weren’t expecting any more stuff. But then Nat came on and introduced the Xamarin Test Cloud. A fantastic new product that does automatic UI testing for virtually every smart phone or tablet device available on the market. Xamarin actually acquired LessPainful solutions for their infrastructure. Basically, Test Cloud is a test service that uses real, physical devices to run UI tests on, based on exploratory testing (i.e. hitting every feature in the app) or a prerecorded test script, expressed in Given, When, Then construct.

Here’s Xamarin’s own introduction page on Test Cloud: link

TechCrunch has written a nice introduction article on this as well.

So that was a shocker for the audience. Awesome. This is a major step for Xamarin though. With this completeness of vision, I think Xamarin will win over a lot of customers that were reluctant to come along with the Xamarin tools. Customers, at least the ones we’re servicing, were a bit reluctant about the maturity and completeness of the holistic vision and approach of mobile development. I think today, Xamarin nailed that question!

The sessions following after that were mostly good. I enjoyed Stuart Lodge’s session on MvvmCross, Sebastien Pouliot’s session on Advanced Build Mechanics for iOS and of course Scott Hanselman’s session, which was basically a nice celebration of the C# language.

And of course I enjoyed doing our own talk about creating a uniform login experience across devices. We’ll put the accompanying slides and source code online as soon as we have a chance.

Then the day ended with a Food Truck party in Brush Square Park across the street. Austin is famous for its food trucks, all specialized in a certain type of food. And they’re good! I had a Tex Mex style wiener, which was really nice and spicy, a nice corn flour tortilla wrap with chicken, cilantro and chilli. As a desert, there was ice cream. Not just regular stuff, but… salted chocolate and red velvet cookies. Heaven, for a foodie. Again, a great vibe among the conference visitors.

After the foodtrucks were closed, we got together at Maggie Mae’s for more partying. Austin has a nice vibe, there’s live music all around.

So tomorrow is the last day of the conference already. How time flies. There’s one more session for Marcel and me to do. This one will be about code sharing. We’ll dive into some of the more detailed, sometimes basic type of tricks and architectural patterns you can apply to achieve more code sharing but still leave the app easily maintainable.

See ya in our session tomorrow!

Xamarin Evolve 2013 – Day 2

Standard

Time flies. Day 2 of the Evolve conference has come to an end. Today was actually the second training day, and the conference itself has yet to start. Exciting!

The weather was nice again. Spent some time outside on the balcony, enjoying the sun and the warmth and a nice chat.

Austin

Today, the technical difficulties with the Wifi were gone so the training sessions went a bit smoother. Marcel and I actually started out in the Beginner’s track, that started with a session on navigation patterns. Some nice tips from Craig Dunn, who pointed us at the excellent Flyout Navigation and Sattellite Menu components, which provide new and modern navigation concepts for iOS apps.

After that, we jumped track back on the Advanced schedule for a module on Collection Views in iOS. The UICollectionView is a new UI paradigm in iOS, which drastically simplifies layouting collections of items in all sorts of forms. I recommend you take a look at this tutorial on the Xamarin docs site.

Speaking of docs, these last two days were a triumph for the Xamarin docs team. They wrote all the training material, which looks awesome and thorough. It is amazing how much great products and material is cranked out by Xamarin. The training material and the demo’s are exemplary of this.

The session I enjoyed the most was the one on Backgrounding, by Nina Vyedin. While she battled with the sound system that wouldn’t cooperate, she did a good job explaining the concepts around background tasks in both iOS and Android. Highlighting the similarities and differences, do’s and don’ts, before actually diving into code. All that with a couple of funny analogies to explain the concepts. Kudos.

Marcel and I had some work to do on our session, putting on the final touches, so we took some time in the afternoon to work on that. We did finish with the two modules on Code Sharing and Memory Management. Interesting talks. We’ll be speaking about our take on code sharing on Wednesday. The memory management module had some interesting tips on performance, something that’s very important in mobile apps. Mobile devices are not as powerful as laptop computers, so you have to be careful what you do with respect to memory usage and processor cycles.

The day ended with a fun and laid back welcome reception for the conference attendees. We had a couple of beers and some nice food and met some of the Xamarin folks. We decided to skip the GitHub Drinkup for tonight, but I hope everyone had fun there.

The reception featured a nice animation, projected on the big screen, that featured all nationalities present at Evolve. Very impressive. We learned that there are 11 Dutchies and I’m pretty sure that we’ve met them all :)

I haven’t gotten around to making more photo’s today, so these two will have to do. I did see another exciting bit of news fly by on Twitter today:

That’s awesome!

So tomorrow is going to be big! 200 additional attendees will arrive and join the 400 already here. The keynote by Nat and Miguel promises to be very exciting… Nat teased us in his welcome talk that there are going to be some very nice announcements. Can’t wait to find out!

I hope to see you guys in our session about Creating Unified Login for Apps. 2.30PM in the Gould Salon! Oh, and say hi to our colleague Henk, who’s manning the Info Support sponsor booth!

Xamarin Evolve 2013 – Day 1

Standard

Austin, TX skyline

Hello from Austin, TX! So today was day 1 of the Xamarin Evolve conference. What a day! Marcel (@marcelv) and I flew in on Saturday and we arrived at the hotel late in the evening, so there was no time to check out downtown Austin, famous for its live music scene. It’s obvious as soon as you arrive on Austin airport.

After a good night’s sleep, we went down to the conference area in the Hilton hotel to register and have a nice breakfast. Immediately, the great attention to detail Xamarin put into organising Evolve was apparent. Have a look at the conference badge:

The name badge also serves as a booklet containing the conference schedule and speaker information. The emphasis on the first name (printed in big bold letters) makes it personal and informal.

Next, the names of the conference rooms… They were all named after scientists related to Evolution (get it… Evolve) or monkeys. Illustrious people like Darwin, Dawkins, Gould, Goodall, Fossey, etcetera.

Things that make you feel that a lot of thought and attention to detail went into this conference. Xamarin can be proud of this.

We were also proud to see Info Support listed on the banner as a Silver Sponsor. :)

The welcome and keynote by Xamarin CEO Nat Friedman was nice. He told us how they were completely overwhelmed by the interest in Evolve. At first they anticipated around 250 people, but it soon went up to 400, and later on sold out at 600 people! Xamarin even had to change the venue and date in order to fit in all these people. A testament of Xamarin’s success and community passion for their products!

Passion is actually what describes Xamarin and Evolve best. All 70 (!) Xamarin employees are present at the conference, walking around, always available for a quick talk or questions, and all of them radiate passion for their job. The same with the participants. Mobile is fun. I’m confident that this vibe will stay during the remaining three days.

It was also great to meet and greet the Xamarin leaders. Nat, Miguel, Stephanie, all taking time to talk to everyone and eager to work together with their partners and the developer community.

This first day was dedicated to the Xamarin training. We did the Advanced track. After some technical difficulties – Wifi at a conference always sucks – we covered Notifications, Touch, Android Fragments, Animations and Graphics in iOS and Android. The training material is quite nice, as are the demo apps.

All day, we were very well taken care of in terms of food and drinks. Austin is a nice place for a foodie :) To celebrate our first day at Evolve, we were all invited to Stubb’s Bar-B-Q restaurant, where we enjoyed a nice BBQ… pulled pork, beef briskett, cole slaw, nachos and quacamole, you name it. All that in a nice atmosphere and accompanied with a couple of beers. Oh and great weather!

Tomorrow it’s day 2 of the Advanced training. Looking forward to that. Tuesday and Wednesday are conference days, and then it’s our turn to talk about mobile development with Xamarin. See you at our sessions?

Tuesday, 2.30PM: Creating a Uniform Login for Apps
Wednesday, 1.30PM: Sharing up to 80% Code for iOS, Android and Windows