# Friday, 07 December 2007

Friday means weird stuff getting passed around and this Friday is no different. Sit back, relax, and enjoy some nice shadow play:

posted on Friday, 07 December 2007 12:50:12 (Romance Standard Time, UTC+01:00)  #    Comments [0] Trackback
# Monday, 03 December 2007

Commerce-Server-2007-Logo A while back a friend of mine posted a comment here asking me to describe what it's like developing with Commerce Server 2007. Initially I wanted to reply to him in comments but thinking more on it I really wanted to provide a different and real perspective on how Commerce Server is to work with as a product, a perspective in which I want to dig a deeper than the usual how-to and tutorials you see on the various Commerce Server blogs; mine included.

Check out part 1 Secure By Default and part 2 Three-way Data Access.

Testability

A topic which is very near and dear to my heart is testing. For a number of years I've been thinking about and trying to implement unit testing and test-driven development in Vertica but only recently have we been making progress on that front. Why then has it taken so long to get going with test driven development and unit tests in a shop where a lot of dedicated and enthusiastic people work?

The reason is simple: We' do most of our work on Microsoft server products like Commerce Server, Office SharePoint Server, and BizTalk and those products are not very well designed with regards to enabling unit testing scenarios. Now this post is entitled developing with Microsoft Commerce Server so naturally I'm going to focus on this.

Test driven development and unit testing require a lot from your architecture to make it work. In order to do effective unit tests in a system we need to able to divide the system up in just that, units. I'm not going to delve into the aspects of unit testing techniques here as that topic alone would require numerous posts to cover but suffice it to say that interfaces play a import role in enabling the scenario, class inheritance does as well.

Now how does this relate to Commerce Server? It turns out that you're going to have to look long and hard to actually find interfaces to enable mocking. Everything in Commerce Server is a concrete class, in some instances even classes which have a natural relationship doesn't share a common interface or even a base class which hampers our attempts at creating structured tests.

When developing with Commerce Server the Adapter pattern will become your friend, simply create an adapter for a particular piece of functionality in Commerce Server and work off of that instead of the real API and you're set. Unfortunately this means extra work for you as the developer if you want to create proper tests for your solution.

A lot of the functionality of Commerce Server is accessed via a class called CommerceContext, this works in much the same way as the HttpContext we know a love. Unfortunately it's heavily reliant on HTTP modules to initialize it thus making it tough to test. As a Commerce Server developer it's natural to go to the CommerceContext and access the various subsystems form there. Doing this however tightly couples you to HTTP which is a bad thing if you need your logic in a different context like say for unit testing. The remedy is simple but you need to be aware of this fact otherwise it will bite you in the ass at some point. I did a post on working with the profile outside of the ASP.NET context back when I was working with Commerce Server 2002; it just so happens that this particular technique is still viable today.

The bottom line with respects to structured testing in Commerce Server is that we're faced with many of the challenges we see when working with legacy code which has not been designed specifically for unit testing. By no means does this mean that it's impossible to do unit testing with Commerce Server; it does however mean that you need to be aware of the fact and design your architecture accordingly and that there will be areas which you won't be able to touch with your automated tests.

Developing with Microsoft Commerce Server 2007 Part 4: Magic Strings Galore

posted on Monday, 03 December 2007 07:40:26 (Romance Standard Time, UTC+01:00)  #    Comments [2] Trackback
# Friday, 30 November 2007

anug_logo_200x85 We know that the attendees at each meeting span vastly different levels of experience in .NET and our past topics such as Pragmatic SOA, BizTalk and ESB, LINQ and ORM have been pretty hard core so this time around we wanted to do something for the beginner.

I discussed the idea of doing a talk for beginners with Brian a couple of months back and fortunately he was keen to do so. What came from our talk wildly exceeded what I had had in mind at the time :)

Initially I was a bit worried whether we'd misjudged the interest in a meeting centered on the beginner because we had a pretty poor number of sign-ups but that took off the final week before the meeting and we ended up with around twenty people attending this one.

But before I get into the actually topic of our meeting let me first start out by summarizing what the core group has been doing since last time.

2007-11-28-Aarhus-NET-User-Group-1 2007-11-28-Aarhus-NET-User-Group-2 2007-11-28-Aarhus-NET-User-Group-3

Core Group One Person Down

Our core group and thus responsible people for running ANUG consists of Brian Holmgård Kristensen, Lars Buch-Jepsen, Peter Loft Jensen, and of course myself. You might notice that the list is shorter than it used to be. Morten Vadstrup sadly had to leave the core group because of time constraints. We're debating whether to bring on a fifth person again as we're pretty much covered with the people we have now.

Speakers and Meeting Places

As always we're looking for new speakers and places to hold the meetings. We've been very fortunate thus far to have very good support from the local companies but we're definitely starting to put more work into finding new place to hold the meetings.

As always I encourage you to ping me if the company you work in would be interested in holding a meeting at their offices. Getting a visit from ANUG is a great opportunity to market your company to just the right people if you're looking for talent. As a rule the company holding the meeting gets 30 min. to talk about their culture, development cycle, etc. in the interest of both giving something back to the company gracious enough to provide for us and also to give the attendees a better idea of the kind of companies that exist in the area.

Should you be interested in giving a talk on a particular topic please don't hesitate in contacting me. We're always looking for speakers. We're seeing tremendous interest in topics like Silverlight, Powershell, dynamic languages in .NET, even ASP.NET, basically most .NET related topics have come up during our discussions of what to bring up next so don't hold back :) Contact me today.

Schedule Meetings on Facebook

We looked into the various offerings out there to see what would support our needs when it comes to announcing the meetings in a structured fashion as it's quickly become clear that we need more than just the blog. With the blog it's simply not possible to schedule to far in the future as the post itself would get lost in the noise from the other posts.

We took a look at Facebook which is a site that I hadn't tried myself, luckily Jacob Saaby Nielsen took the initiative to form a Facebook group for ANUG. It turns out that Facebook provides just what we need to schedule our meetings so we've decided to go ahead and use Facebook for scheduling meetings and for signing up.

I realize that you need a Facebook account to get going and that that presents additional effort to get people to attend but in the long run I firmly believe that this way of doing things offers the best options for us as we need to leverage all the help we can get.

If you wish to attend a meeting I encourage you to sign up on Facebook as the companies giving us shelter usually are kind enough to also provide food and drink so be courteous to them and let them know that you're coming so they can order the right amount for us.

To make it easy to get to the group we've created an alias which is easy to remember. Just use www.anug.dk/Facebook

Become a Member of ANUG: Join LinkedIn

LinkedIn is now the official way of becoming a member of ANUG, we decided to stick with LinkedIn because of the professional aspects of the site. We really want our members to benefit from participating in the meetings and one way of doing just that is to expand the network of the attendees which LinkedIn is perfect for. Also we'll use the member list on the LinkedIn site to send out newsletters to keep you abreast of new meetings, updates on the group, and so forth.

As with the Facebook group we've created an easy to remember alias to get to the invitation to the ANUG group on LinkedIn. Just just www.anug.dk/LinkedIn

Upcoming Meetings

Our meeting schedule is booked until March which makes me very happy as my job is much more relaxed that way :) Coming this December we've got the Christmas dinner although it's too late to sign up now. Sorry about that.

January will bring a talk about C# 3.0 and VB 9 to be given by Henrik Lykke Nielsen, MS Regional Director for Denmark. The meeting will be held at the Vertica offices.

February brings us a talk on Team System and CMMI from Systematic, the meeting is to be held there as well. Details are still not completely in place for this one but I'm looking forward to it nonetheless.

March will be very interesting as it will bring us both our long awaiting Code Camp for .NET Beginners as a follow-up to this meeting. We haven't decided on a date yet but expect it to be sometime in the middle of March.

It's a two for one month in March so we'll give you a talk on Workflow Foundation by Henrik Kristensen from Scanvaegt International A/S as well.

More information will follow on Facebook.

New Concept for Meetings: Open Space

We've been playing around with the idea of expanding the social aspects of the user group for a while now and the way we intend to do is to employ the Open Space idea where the attendees themselves set the agenda and everybody participate in the discussion. What we see at the meetings is that people don't get nearly enough time to interact with each other as a consequence we'll do entire meetings which are about that and only that. I have high hopes for the concept and the attendees at the meeting did so too so that'll definitely be something to look forward to.

Suggestions

We got a suggestion at the meeting to snap more pictures at future meetings. We'll definitely try and do something about that. Everybody are welcome to bring a camera are fire away though :)

Professional .NET for Beginners, Brian Holmgård Kristensen

The main event of the evening was my colleague Brian who gave a very nice talk on .NET for beginners. The premise for the talk was to create a blog web application and in the process giving the attendees a look into some of the tools and techniques that go into creating such a thing.

Brian had a limited number of slides and instead chose to let the code speak for him. It's always an interesting proposition to do a lot of code on screen as a lot can go wrong when you choose to do so. We did get a first hand example of this as Visual Studio refused to play nice after only a couple of minutes of presentation. Ultimately it turned out that using beta versions of released software for a presentation is a bit too overconfident :) A break and a restart of Visual Studio made everything right and Brian could continue on with no further incidents to report.

One thing that is ultra important when doing a lot of code on screen is to run at a low resolution with nice big fonts which unfortunately Brian did choose to do. It's a technicality but it's shame that such a small thing deducts from an otherwise great presentation, and it was a great presentation. I was especially impressed by the level of interactivity, it was right up there with the LINQ presentation that Søren Skovsbøll did the last time around. People were very eager to know more about various ASP.NET 3.5 technologies such as Master pages and even the details of coding in the .NET Framework itself.

Brian paid great attention to detail and didn't leave anything hanging, every time he introduced a new concept he thoroughly explained it as to not confuse anybody. At times the attention to detail became also too much but with the fact in mind that the presentation wasn't intended for people like me I don't believe that that was a actual problem for anyone also but me :)

All in all Brian did a very good job in engaging the attendees and he covered nicely when Visual Studio started acting up. He'd made an entire story line to follow in which he started out with a static HTML page and gradually made it data driven; in truth a very compelling way of getting his points across.

The data driven web application is a demo that the Microsoft people are very fond of. You've probably seen it done numerous times but as always we try and do thing differently for the ANUG meetings. What sets Brian's presentation apart from the others is the fact that he actually did a properly n-tiered architecture, he even provided facilities to demonstrate the importance of encapsulation. No drag and drop of data source to be found anywhere, everything was done by hand. This part of the presentation is my very favorite because it not only sets what we do with ANUG apart from the Microsoft events which is our stated goal it also shows that doing a data driven demo app in the proper way is not only feasible but absolutely possible in the very short amount of time usually available to these kinds of presentations.

The guys present seemed very keen on getting their hands on the source code so we're providing it for download along with his slides.

Tour de Scanvaegt

Due to the many questions Brian's presentation did drag on a bit but luckily Henrik Kristensen was unfazed by this fact and gave some interesting insight into Scanvaegt which hosted the meeting. Scanvaegt is actually an old company which harkens back to 1932. I had no idea that they'd actually been around so long.

He went on to tell us about their way of developing the software supporting the huge and complicated machinery that they create. They've had a couple of bouts with agile methodologies and even tried to do a big bang implementation of XP as a process which was unsuccessful. They're father down the agile path agile now by adopting a slower pace and working with mindset instead of tools and techniques, something I wholeheartedly agree with as that's the way we're making it happen inside Vertica as well. We pick and choosing the pieces which make sense to us and implement them one at a time, it looks like we're pretty much on the same page there.

The highlight to me was when Henrik showed a video of one of the sorting machines which sorted chicken fillets into plastic trays, the fascinating part of this was that it placed the fillets facing the same way every single time it place a new on in tray.

He also told us about a cool sounding machine that's able to decide how large a particular piece of meat is by way of 3D photography. With a 3D model of the piece meat built up it'll then proceed to calculating how thick it must make each steak to get the desired number of steaks. Incredible. The videos really hammer home the coolness of this so I'm trying to get Henrik to put a couple on YouTube if possible.

Open Forum

We never got around to doing open forum this time around.

posted on Friday, 30 November 2007 20:30:53 (Romance Standard Time, UTC+01:00)  #    Comments [0] Trackback
# Thursday, 29 November 2007

On my way home this evening I had a most shocking experience: I encountered a ghost driver driving the wrong way on the free way on my side of the road. I was alerted to the situation by drivers in the opposite lane who were signaling with their headlights madly. Of course this got my attention but I had no idea what they were trying to tell those of us driven in the opposite lane. Moments later that became horribly apparent when I saw the car coming at us driven the wrong way on the free way. It blew past us in a matter of seconds; at first I didn't even understand how lucky I'd just been or even what happened.

This very moment as I'm sitting at home watching the news do I understand how lucky I actually was. It turns out that that very same ghost driver crashed into a car less than one minute after it passed me killing the ghost driver and seriously injuring the other driver who fortunately is outside danger.

I can't help but think that that seriously injured person could've been me if I'd decided to try and over take another car at the wrong moment or whether I could've done something to prevent the terrible accident which happened only moments after the car passed me by...

Read more about the incident (Danish)

posted on Thursday, 29 November 2007 19:40:12 (Romance Standard Time, UTC+01:00)  #    Comments [0] Trackback
# Wednesday, 28 November 2007

I was recently asked which podcasts I listen to and I've actually been planning to write about for a while. Commuting to and from work takes about 1½ hours of my time each day, my way of making an opportunity out of this time is to listen to a lot of podcasts. I learn something from the work related podcasts and I get to relax with the ones just for fun when my brain is fried after a day at the office :)

To mix it up I dabble with audio books from Audible.com but I've not yet gotten that routine down so I'm going to hold off with my commentary on that for now. Just know that if you're looking for richer content you can go there a get real books to listen to.

Work Related

Dot Net Rocks! w. Carl Franklin and Richard Campbell - Everything .NET. The first and definitely the best. You get a nice high level insight into many different products from Microsoft.

Hanselminutes w. Scott Hanselman - Lots and lots of information about .NET and its extended family. If you listen to only a few podcasts be sure to make this one of them.

ARCast.TV w. Ron Jacobs - Architecture on the Microsoft platform, higher abstraction level than .NET rocks.

Polymorphic Podcast w. Craig Shoemaker - the content is there but Craig doesn't keep a regular schedule which I dislike so I ditched it again. Still well worth a listen if the missing regularity isn't an issue for you.

ASP.NET Podcast w. Wally and Paul - geared towards the Microsoft .NET Framework and ASP.NET.

RunAs Radio w. Richard Campbell and Greg Hughes - a podcast for IT professionals working with Microsoft products. I listen to this to become better at understanding the issues which people of the development cycle has to deal with. Also I'm a hardware nut which is something they tend to talk about as well. Finally they offer up some nice tools and techniques for debugging problems which is something we as developers have to deal with due to increasing complexities and number of moving parts in the systems we build.

For Fun

Windows Weekly w. Paul Thurrot - news show that deals with stuff related to the Windows user, nice commentary on various news stories and they even talk about Apple from time to time.

Diggnation.com w. Kevin Rose and Alex Albrecht - Kevin and Alex chat about the new stories on Digg.com but mostly they are just fun to listen to. Caution! This one will make you laugh out load. I usually start my Monday morning drive to work with this one just to ensure that I get started on a good note. It's a video podcast but the audio version works very well.

Games for Windows - Talk about the newest games for Windows. Very funny. I actually don't get to play a lot of games due to lack of time so when I do I damn well make sure that they are the best. This is the place I go for that information.

1UP Yours - Talk about games for the console. I own a Nintendo DS and have a heck of a time to find good games for it. This is a great way to find them.

posted on Wednesday, 28 November 2007 13:11:33 (Romance Standard Time, UTC+01:00)  #    Comments [1] Trackback
# Friday, 23 November 2007

I had a problem today where a file exported from a system was showing up correctly in my text editor but whenever I tried to re-import it elsewhere my special characters where messed up; ÆØÅ showed up as garbled characters.

Of course the reason for this is the fact that the export sets an old code page on the file which isn't recognized by the receiving system so I simply had to change the code page of the file.

My instinct was to go with UltraEdit but I didn't have a license around so I thought that Visual Studio probably would get the job done for me and it did but it isn't too obvious how to do it; not that UltraEdit is intuitive in this area either :)

  • Open the file in Visual Studio.
  • From the file menu select Advanced Save Options
  • Select the code page

Visual-Studio-Advanced-Save-OptionsVisual-Studio-Advanced-Save-Options-Dialog

posted on Friday, 23 November 2007 11:32:44 (Romance Standard Time, UTC+01:00)  #    Comments [0] Trackback

Commerce-Server-2007-Logo A while back a friend of mine posted a comment here asking me to describe what it's like developing with Commerce Server 2007. Initially I wanted to reply to him in comments but thinking more on it I really wanted to provide a different and real perspective on how Commerce Server is to work with as a product, a perspective in which I want to dig a deeper than the usual how-to and tutorials you see on the various Commerce Server blogs; mine included.

Check out part 1 entitled Secure By Default.

Three-Way Data Access

Commerce Server provides a lot of functionality out of the box; in fact it provides not one, not two, but three disparate data access schemes. Talk about getting your money's worth :) What this translates to is two things: Blazingly fast performance and a high bar of entry for developers.

Basically each subsystem in Commerce Server comes with its own data access system which means that you as a developer will need to learn and master them all to be able to leverage the features provided by the product. There are some general traits to the various data access model: You won't have to do much SQL, if any.

The Profile system is our general purpose data access system that we use whenever we have a custom piece of data we need to store; user profiles, addresses, cities, etc.. You can think of the Profile system as half of an ORM, it will help you get your data into your application in a nice fashion without you having to do SQL which is nice but it doesn't provide the last part of an ORM, the O, the part that actually turns the data in objects. You could call the Profile system an RM because what it provides you a general purpose name value collection that you can build on top of. When everything is set up the profile system is quite nice to work with, sure the API is a bit primitive compared to a full fledged ORM but it certainly gets the job done and a couple of nice abstractions on top will get you a nice domain model to work with.

The Order- and Catalog systems are a different story in that they are very specific in their purpose; they only deal with specific domain objects: Order- and catalog objects.

I would point to the Catalog system as the very best part of Commerce Server, it feels complete and very well done, both feature-wise and data access-wise. There are no nasty XML files, no having to map multiple levels of abstractions before getting the job done, it all works and works beautifully. The Schema Manager tool is to Commerce Server Catalog system what Enterprise Manager was to SQL Server 2000: Your one stop place to setup schema for your database. Everything is handled in a graphical manner which is translated to SQL statements, procs, and physical tables. The Catalog system is set up for performance which is clear if you go ahead and poke around the database, tables are denormalized, physical objects are created for new catalogs, and so forth. Interestingly you can actually learn a lot from the performance database design by going through the various databases of Commerce Server.

Finally we've got the Order system where we have the third and final data access system and also the newest one in our happy little family. CS 2002 introduced XML mapping files to map orders, lines, payments to actual objects. In that respect we are actually dealing with a full ORM here, only it handles orders and various associated object but nothing else. You'll have to get your hands dirty with multiple XML files and you'll have to do manual updates to the database to get everything going. You won't however have to do anything to actually use the subsystem that's nice squirreled away in the API.

It's interesting to note that across all the data access schemes Commerce Server actually contains some very powerful APIs, if only they were combines and unified to provide the full flexibility to all the subsystems. As a developer you'll have to wrap you head around all the models; on the upshot of this the individual models are not that complicated to work with so it's not exactly a Herculean effort you need to put into learning the APIs: It's mostly a matter of knowing where to look. There are good reasons for the subsystems not being unified but I'd really like a single architect at Cactus to sit down and consider what needs to be done to leverage either a preexisting ORM or to unify the functionality found in the disparate DALs.

Developing with Microsoft Commerce Server 2007 Part 3: Testability

posted on Friday, 23 November 2007 07:00:08 (Romance Standard Time, UTC+01:00)  #    Comments [0] Trackback
# Thursday, 22 November 2007

visualstudio_logo I've often wondered how life as an add-in developer for Visual Studio is like. On one hand you have the power to create tools and utilities which will benefit you greatly in your everyday life and you get the added benefit of geek-cred if you do your job really well.

On the other hand though we've got Microsoft who for any given release of a product can annihilate your entire market simple as that. In the same stroke they create markets simply by making stupid mistakes so it's really a double edge sword when you're working in semi-competition with Microsoft.

I think the newly released version of Visual Studio 2008, ah 2005 I hardly knew you, is a shining example of that however small the example is.

TestDriven.NET an add-in which has proven very useful to me, particularly for a single function: Run Test in Local Scope. Basically it allows me to execute the test I'm currently in with a shortcut and you know that I'm all about the shortcut driven development :)

Visual Studio 2008 introduces unit testing features in the professional version for the first time ever and with it a nice addition which does exactly what I've used TestDriven.NET for in the past: Run Test in Local Scope. It's even bound to the same shortcut that I chose myself when I configured TestDriven.NET the very first time. Just go CTRL + R + T and your test will execute. W

With a single stroke of genius Microsoft has taken away my need to install a third party add-in in Visual Studio 2008 by providing me with exactly what I need out of the box. Of course the feature only works with MSTest which will be a problem for all you xUnit users out there but we've run with MSTest for a while now making it a perfect fit.

MSTest-Run-Tests-In-Local-Scope

Oh yeah - Microsoft released Visual Studio 2008 this week :)

posted on Thursday, 22 November 2007 08:33:30 (Romance Standard Time, UTC+01:00)  #    Comments [2] Trackback
# Wednesday, 21 November 2007

Commerce-Server-2007-Logo A while back a friend of mine posted a comment here asking me to describe what it's like developing with Commerce Server 2007. Initially I wanted to reply to him in comments but thinking more on it I really wanted to provide a different and real perspective on how Commerce Server is to work with as a product, a perspective in which I want to dig a deeper than the usual how-to and tutorials you see on the various Commerce Server blogs; mine included.

Now I started this out with the intent of covering everything in a single post but as that post got longer and longer I decided to split it up into multiple parts. So here's the first installment with a couple more to come soon.

Secure By Default

The first thing you'll come to realize in the first couple of hours working with CS is that security is a big deal in this release; both a blessing and a curse. A blessing in the sense that the security system provided out of the box provides rich possibilities for securing the various subsystems of Commerce Server. If setup properly all components are protected by multiple layers of security and you even have the possibility to go one step further than that by leveraging business data security. Basically the last layer of security allows you to specify what data users or roles can access, not only that but you can go down to operation level and specify which operations are available to particular groups of users. While this sounds like role-based security it's not, this is much richer than that and is more akin to code access security only with a business focus rather than a technical focus.

I started out by stating that the rich security features are both a blessing and a curse, so how can that be the case with all of the above? The fact of the matter is that with security comes complexity, imagine a setup with multiple web sites running in IIS each with its own app pool of credentials, this goes all the way to the database where the individual services have very specific roles assigned to them. Debugging an error in a setup like that is very difficult and this is some of the more bland stuff you'll encounter :)

Commerce Server leverages a lot of platform technology, one that comes to mind immediately is Distributed Transaction Manager the very same used by System.Transaction in .NET Framework 2.0. Basically MSDTC is great when it's working, when it's not you'll really come to loathe it. I've been through numerous debugging sessions where MSDTC either wasn't running on all machines, it couldn't do reverse name lookups over the network, firewalls were blocking ports, etc.. As I said it's a pain when it's not running.

What this is all boils down to is that not only do you need to know Commerce Server as a product; you'll also need to know the basics of the Windows platform. This probably seems straightforward, if it does all the more power to you, but with more and more abstraction levels on top of the metal people do have a tendency to forget the underlying platform.

Developing with Microsoft Commerce Server 2007 Part 2: Three-way Data Access

posted on Wednesday, 21 November 2007 21:42:04 (Romance Standard Time, UTC+01:00)  #    Comments [0] Trackback