# Monday, 22 October 2007

How's this for error handling? :)

Human-Error-Handling

posted on Monday, 22 October 2007 10:06:42 (Romance Daylight Time, UTC+02:00)  #    Comments [2] Trackback
# Monday, 15 October 2007

Commerce-Server-2007-Logo  We're working on a couple of Commerce Server projects right now and common for both of them is the fact that we need to support multiple currencies and languages. "That's easy", you might think, "you just add additional languages to the catalog and you're done". Indeed that is the case for multiple languages but it turns out that supporting multiple currencies is a little more involved.

Requirements

Of course I need to support multiple currencies and languages but also multiple price groups so I can have different prices in countries using the same currency, say Spain and Holland where both use euro. Also I need to support pretty prices, i.e. the business user can specify the price like $9,99 or kr 5,95. I don't want to link a single currency to a particular country, e.g. I want Danish customers to be able see prices in Danish kroner as well as euro (the Danish euro price and not the Spanish one as they may differ).

Finally I need to support BizTalk integration with an ERP system with an internal category structure which makes sense to the business users and an external category structure for retail customers as defined by marketing. Of course I want all this to fit well in the Commerce Server way of doing this without compromising architecture and maintainability.

Requirements summed up:

  • Multiple languages
  • Multiple currencies
  • Price groups
  • Don't link currency to country
  • Internal hierarchy and completely different external hierarchy
  • Fit into CS way of doing things

Commerce Server Support

There are a number of features in Commerce Server which can help me support my requirements it's just a matter of using them in the right fashion to achieve the desired end result. Multiple languages are supported right out the box simply by specifying on each catalog which language to support. From there on in you can switch language when you're viewing any item in the catalog and edit text in whichever language you want. The catalog schema is fully extendable so you can use that to add a new field for each currency or price group you wan to support. We have virtual catalogs which allow you to move a product from another catalog into the virtual one and override values there. Finally we have catalogsets which is a way to bundle catalogs together and associate them users or groups.

In summary we have the following tools to work with:

  • Multiple language support on catalogs
  • Extendable catalog schema
  • Virtual catalog for overriding field values
  • Catalogsets to associate catalogs to users

What Not To Do

Now you could go ahead and use the multiple language feature to support multiple currencies but there are two problems with that: 1) Numbers are not overridable like text so you can only specify a single value across languages, you can remedy this by creating a text field and override that but then we'd be working with text values instead of decimal values and you would need to make modifications to the standard pipeline components which are looking for the ListPrice field on the products. Additionally you'd have to come up with a naming scheme for languages if you want to support multiple currencies in the same country essentially creating redundant text data because of it.

As a better alternative we could create new fields for each currency but it would break our requirement of maintainability as we'd have to create a new field each time we want to support a new currency. Even worse we'd have to come up with a naming scheme to support the same currency but in different countries, e.g. Spain_EUR_ListPrice, Holland_EUR_ListPrice, and come up with code which can support it in our pipelines. Interestingly this is one of the scenarios Microsoft is pushing needless to say that I don't agree in the least with this recommendation. Also each catalog in Commerce Server has a base currency specified which would be rendered useless or even worse would confuse the business users.

Using multiple fields would however make the integration story very easy because we simply map the fixed fields coming from the external source to Commerce Server.

What To Do

This is how I propose we solve the problem using virtual catalogs. Everything needs to be imported into a single base catalog which won't hold any price information, optionally you could use the base catalog for the currency which the company operates in internally but for our purposes I'll leave it blank as to only have a single model for multiple currencies.

Virtual Catalogs for Currency and Price Groups

Remember that each catalog in Commerce Server has a currency configured we'll leverage that by creating a virtual catalog for each currency we wish to support additionally we'll need to go one step further to support our price groups. In order to do that we'll extend the catalog schema with a field called price group which along with the currency will identify the correct catalog to look for when displaying products to the retail customers and when BizTalk is updating. To make the solution more maintainable we do a single "include all"-rule for each of the price group catalogs which will allow the BizTalk developers to assume that the product will always be present in all currencies, of course you can elect not to this but it will need a higher level support either manually or in the integration piece.

Base catalog - virtual catalog

Now I mentioned include rules in passing above so allow me to elaborate on them here a bit: To include products, variants, or categories from another catalog in a virtual catalog we do it by creating virtual catalog rules. We have four types to choose from: Include everything, include category, include product family, and include variant; for each of those you can specify that we're excluding instead of including. There's a fifth rule type which I'll mention for the sake of completeness though I won't use them in here: pricing rules which is a way of adjusting prices in the catalogs. In summary I chose an "include all"-rule to support my price group catalogs above which will bring in all categories, products, and variants which are imported by BizTalk.

Support for BizTalk Integration

Whenever BizTalk imports a new product it needs to lookup the correct price group catalog for each price group on the product and update accordingly while this makes the integration piece a little more complicated it allows the Commerce Server developers to use the product in the intended way.

Virtual Catalog Considerations

For maintainability it's important to only update price information in the virtual catalogs we've created. Updating anything else will break the override chain which means that future updates to say product description will not populate to the virtual catalogs in which we overrode the value. It may be what you want but you need to be aware of this behavior.

Custom Hierarchy for Retail Customers

Remember that we want to provide the business with the opportunity to completely customize the category hierarchy for the retail customers while maintaining an internal hierarchy which makes sense from a business point of view. Now we have the business view of things in our Import catalog which is reflected in our price group catalogs as well due to the "include all"-rule we've added to the catalogs but we need a way to do a different hierarchy for our retail customers.

Unfortunately we can't do an "include all"-rule because that effectively includes categories as well and once you've included a category you're effectively stuck with it in your virtual catalog, there's no way to remove it without removing the products within as well. This means that we need to do include rules for every product family we want to include which provides the ultimate flexibility but also requires more from the Catalog Manager tool. Basically you can do with Catalog Manager but that doesn't mean that you should :) The workflow for adding an include rule basically involves opening the virtual catalog, clicking rules, then add new rule, search for the product you want, select the product, click next a couple of times, and then you need to add it to your new category in the virtual catalog which is another couple of steps. Imagine doing that for 4000 products :) Obviously some work need to be done on the Catalog Manager to make the workflow more smooth, maybe drag and drop within the catalog hierarchies or some kind of two-pane UI with the two catalogs on either side. In any event something needs to be put into place to handle the workflow but that's for a different post.

With that done we have something like this:

Multi-currency-and-pricegroup-with-commerce-server-2007

Finally we do a catalogset for each required user segment to line up the catalogs for the correct users programmatically. Once that's done we should have all our requirements covered.

In Conclusion

Working with Commerce Server to support our requirements is essential even though it might involve a bit extra work to get there. We could've added an extra field for each currency we needed to support but that would have cornered us and ultimately created a less flexible system which might not support us in the future. We want to work within the restraints of Commerce Server without jeopardizing our systems design which in the end would render the decision to go with Commerce Server useless.

With an integrated solution it's important to keep in mind the opportunity which we have to keep some of the ugliness found in the systems we're integrating with at our system boundary enabling us to stay with a nice and clean design.

As with any standardized product it's important to know the tools available to us and how to use them in the correct fashion. Our little exercise above shows some of the capabilities of the catalog system and how you could leverage them to achieve a flexible solution while not compromising the design.

posted on Monday, 15 October 2007 11:15:56 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback
# Thursday, 11 October 2007

It turns out that I was lying when I proclaimed my upgrade to DasBlog 2.0 a success as I had a small bug. Apparently you need to change a config value in web.config which pertains to how ASP.NET 2.0 handles cookies otherwise you cannot use the Remember Me functionality when you login to view config, referral stats, etc.. It even says so in a friendly comment in web.config but of course you need to look for it :)

Uncomment <httpCookies httpOnlyCookies="false"/> in web.config and you're good to go. Remember this only applies if you're running it under ASP.NET 2.0 which is always the case with DasBlog 2.0 but not so with 1.x.

posted on Thursday, 11 October 2007 14:13:18 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback
# Wednesday, 10 October 2007

You're probably already heard the buzz about Microsoft releasing the code for the .NET Framework. I've held my tongue on this subject for a while because I wanted to formulate my own opinion on it instead of just doing the obligatory YAY-post. My stance on the subject is not as glowing as others I've seen during the past week.

In many ways I'm more excited about the new MVC framework than I am about the release of .NET Framework source code. Sure it's great to be able to step into the implementation of some class from the BCL but we've had that ability forever with Reflector. It's not THAT often I've had to bring out the big guns to debug a problem; in 99,9% of the cases the problem is not with the framework itself it's with our custom code. I fear that some people will start hunting for bugs in the framework instead of sitting back and actually considering the bug they're seeing before trying to debug it.

I'm not sure that the problems with patent infringement as outline in this post will be a problem but it certainly is something to keep in mind with the litigious environment in the United States.

I don't mean to belittle Shawn Burke's effort because he certainly did a very cool thing in getting this thing out there and he's been working on it on and off for a long time. He actually blogged about it the first time back in 2005 albeit in a less ambitious scope also check out his follow-up about the actual release. Much more interesting is the fact that the system they've set up will work for any product group which want to release source for their particular product; we probably won't see the source code for BizTalk floating around out there but there certainly are some interesting implications in this if their idea is carried beyond the framework itself.

What I like about this new development is the fact it's a manifestation of a more open and transparent Microsoft, we've seen it for a while now that the company is more open via the blogs and more recently with the open source announcements for ASP.NET AJAX Control Toolkit and IronRuby. The idea that Microsoft would release source code a few years back was preposterous but now we're seeing much more effort to support the community around the products which in turn I'm sure will bleed into the community itself and create more open source initiatives on .NET than what we have today.

posted on Wednesday, 10 October 2007 09:30:57 (Romance Daylight Time, UTC+02:00)  #    Comments [3] Trackback

I first heard about the new MVC paradigm for ASP.NET coming form Microsoft at JAOO when Oren Eini mentioned it at the MonoRail talk at JAOO. At the time not much information about the new frontend framework was available but with Scott Guthrie's announcement of it at ALT.NET information is starting to trickle out. Scott Hanselman has even more information on it including full presentations of actual code from the conference (done in Silverlight naturally).

While MonoRail has taken these ideas and run with them for a while it's great to see Microsoft stepping in with their own implementation as I strongly believe that that is the only way to create the adoption rates needed for people who need to get their job done.

I'd like to adopt a framework like MonoRail but in doing so I'd effectively cut customers and team members from access to third party controls built for WebForms and even worse we'd have to invest heavily in training new hires on MonoRail before they can effectively participate in projects when in fact I could spend that time training them on technologies which effectively bring much more value to the table like Commerce Server and SharePoint.

posted on Wednesday, 10 October 2007 09:05:21 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback
# Tuesday, 09 October 2007

VisualStudioLogo Have you ever spent more time looking for the item you wanted to add to your project than actually writing the code for it? I've spent plenty of time not being able to find that particular item in my Add New Item dialog because Microsoft just threw everything in there with a huge pitch fork.

Luckily for us K. Scott Allen found this annoying as well and went digging in the Visual Studio project templates and found that he could sort the list using a little Powershell script he did.

So he went from this to this:

clip_image002image

Download his Powershell script for sorting the Add New Item dialog and remember to grab Powershell as well to make it go. Please note that Powershell has policies in effect which means that you have to allow the script to run. I simply did a Set-ExecutionPolicy Unrestricted and then ran the script. I know I shouldn't be allowing all scripts to run but I don't really use Powershell for anything serious at this point so it doesn't matter.

Thanks to Daniel for this tip.

posted on Tuesday, 09 October 2007 18:23:54 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback
# Monday, 08 October 2007

As I mentioned in my summary of the last usergroup meeting we have a little more mainstream topic for the next meeting: Object relational mapping (ORM) and LINQ.

The next meeting will be held October 24th 19:00 at Ditmer A/S. Please note that we're not doing the last Wednesday this time around due to scheduling conflicts with the speaker. As always the meeting is open to anyone who wishes to participate.

Please leave a comment to sign up for this meeting

Practical Information

The meeting will be held:

Wednesday 24/10 at 19:00

at:

Ditmer A/S

Trindsøvej 9

8000 Århus C

Map

Agenda

Usergroup News

To keep everybody inform on the various stuff going on we'll begin with a short update on planned sessions, new initiatives, and so forth. This will also be your chance to give us some feedback on what you would like to see at future meetings or voice your interesting in presenting a subject matter yourself.

Object Relational Mapping and LINQ, Søren Skovsbøll, Ditmer A/S

O/R mapping is a widely used discipline in the .NET world. Only now Microsoft is entering the fray with two O/R mappers: LINQ to SQL and later ADO Entity Framework. LINQ to SQL has garnered a lot of publicity primarily due to the new query language which is available inside C#, VB, and other CLR languages.

Getting started with LINQ to SQL is easy but when your applications become more complex than the samples Microsoft provide you'll need to know what's going on under the hood and what an O/R mapper really is.

We'll dive into which patterns also all O/R mappers use: Identity Map, Unit of Work, Data Mapper, etc.. LINQ to SQL is a simple O/R mapper in that regard but making up for the fact are the rich design time tools which comes with Visual Studio 2008.

Søren Skovsbøll is  a development consultant with Ditmer A/S. He started working with O/R mapping when NHibernate was in its infancy with the 0.3 release. Mappers which will let you keep your domain model nice and clean is in high regard with Søren and he's even built his own O/R mapper from scratch called Matterhorn which was the first to support generics. He publishes a blog at Skarpt.dk.

Break

Tour de Ditmer

Morten Ditmer, the CEO of Ditmer, will do a lap around his company and enlighten us on Ditmer as a company, their values, and how they go about building software in Ditmer.

The Nutcracker

Have a problem or a topic you'd like to discuss? This is your chance to get the opinion from a bunch of intelligent people working with .NET. Would you like to demo a cool tool? Show a web site which has changed your life? It's all up to you, if you find it interesting chances are that others will too. So feel free...

Looking forward to seeing you and remember not to be shy even if this is your first attendance :)

posted on Monday, 08 October 2007 15:59:29 (Romance Daylight Time, UTC+02:00)  #    Comments [30] Trackback

He's no Singing Salesman but he sure got talent. Without further ado I give you hands farting Bohemian Rhapsody. (Blame our sales guy Robert for this one :))

posted on Monday, 08 October 2007 14:03:14 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback
# Monday, 01 October 2007

To bring the members of Aarhus .NET Usergroup even more benefit, I've created a group for us on LinkedIn. Feel free to join.

posted on Monday, 01 October 2007 21:27:35 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback
# Sunday, 30 September 2007

jaoo2007_1 JAOO is well over with and I'm just starting to get my head on straight again. I started out with my Going to JAOO 2007 post in which I wrote a little bit about why I was going to JAOO and what I expected to get out of it. In this post I'll try to answer that question and contrast JAOO with Microsoft TechEd the only other conference I've ever attended.

The conference is general felt a lot less cramped than TechEd which makes sense considering that TechEd accommodates around 4000 people while JAOO only does 1200. JAOO has a definite community feel to it, it's hard to explain but everything seems a little less tightly controlled and planned, a little more laid back if you will. Take for example the evaluation of a session: At TechEd you'd go to a computer and enter in a number of criteria to get the job done, at JAOO you place either a green, yellow, or red piece of paper to do the same. You definitely get a little less information per person but I'd wager that the JAOO folks get feedback from a lot more people than they do at TechEd. Same thing goes for the conference web site, the TechEd site is very professionally done with lots of gimmicks while the JAOO site is simple and functional. The two sites compare roughly like Hotmail and Gmail, one is pretty while the other is functional :) Now one is not necessarily better than the other, they are just different conferences with different audiences in mind. I definitely enjoyed both. One thing TechEd has going for it is the fact that they get session slides online immediately after the session is done which is nice for people like me who like to blog about the session. Essentially JAOO requires more from my note taking than TechEd does because I have the notes done for me at TechEd :)

My first reason for attending JAOO was to get a more diversified picture of software development. Naturally JAOO delivered on this in a big way. Simply put a great many of the big thinkers in OO were present at JAOO and I think it's safe to say that most of them are found outside of the .NET space. Don't get me wrong a lot of stuff is going on in .NET and in many cases .NET moves along more quickly as a whole because Microsoft controls the entire stack as it were. It was great to attend a session on enterprise frameworks and have Martin Fowler sitting right behind me asking questions of the panel. I'm glad I wasn't a speaker at that particular track as they must have felt the squeeze of having Martin Fowler present asking critical questions.

The content of the sessions was very different than what you'd get at TechEd. TechEd is basically about selling the latest and greatest Microsoft technology to the development community and while it's great to have one of the guys who actually coded ASP.NET AJAX sitting there answering questions it's still just a sales pitch. Again JAOO feels very different because we have very feel people selling an actual product. In many cases it's more about the ideas behind products than the product themselves making the content much more relevant. I'm convinced that the stuff I take away from JAOO with regards to architecture, frameworks, and methodology will be applicable in three years time while the same cannot be said about my knowledge about SharePoint 2007 and ASP.NET AJAX which I took away from TechEd last year. Technologies simply become obsolete too rapidly for that to be the case.

A couple of sessions stand out from the ones I attended: Hamilton Verissimo and Oren Eine did a couple of sessions together on the Castle project, specifically on MonoRail and ActivePack both of which were very interesting. I really like the alternative way of thinking about creating web applications and doing data access. MonoRail seems very interesting an I'd love to be able to roll it out on a project but I don't see it happening any time soon unfortunately, Active Record on the other hand might be something I can get out there soon but again a product like LINQ is something hard to ignore. The last sessions that stood out was Applying Craftmanship by Pete McBreen simply due to the fact that he presented the topic so well, he was funny and had some great points as well. Of course The Journeyman's Tale stood out as well, unfortunately it stood out like a sore thumb :)

So what is the verdict? I would definitely go to JAOO again and I firmly believe that JAOO is a conference you can attend every year without feeling that content is being repeated. For TechEd I'd say that that is not the case. With a product focus like is the case with TechEd new things need to happen with the products for the content to be different, this year and last years TechEd look pretty similar to me because not much has happened since last year product-wise. One thing I learned this is year is that with the massive amount of content you need to absorb at a conference taking notes on a piece of paper and then converting those notes to blog posts later is close to impossible. I just barely made it last year and this year I got swamped the

posted on Sunday, 30 September 2007 21:15:58 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback

We had little over ten people turn up for the meeting and we had great fun. I admit that the topic was rather esoteric as ESB, SOA, and BizTalk just doesn't apply to all that many people out there, especially in Denmark. ESB and BizTalk was the second part of our SOA topic and I think it rounded the topic off in a nice way. For future meeting we'll try to keep to topic of the presentation a bit more mainstream. Also the next time I plan a meeting I'll make sure not to collide with a major conference in town like JAOO. Having a usergroup meeting right after a full day of conference is a tall order, I know I went there straight after JAOO, I might not have been my most coherent self and it might have affected the turnout as well.

A big thank you goes out to Klaus Hebsgaard and Kristelig fagbevægelse for getting a nice space for us to hold the meeting, probably the nicest yet, and some very good sandwiches too.

Like always we started out the meeting by summarizing what the core group has been up to since last time. First of all we've been busy with getting new talks and speakers together and I'm proud to announce that we've got the next couple of rounds together at this point. I expect that we'll announce new meetings much earlier than we've been doing up to this point to allow people more time to sign up for the meetings. The topic of the next meeting is Object Relational Mapping and LINQ by Søren Skovsbøll and will be held at Ditmer A/S at October 24th at 19:00. Please note that we're not doing the meeting the last Wednesday of the month this time around due to scheduling issues. I'll do a separate post on the next meeting when I've got the last couple of details sorted.

We're planning a couple of meetings which are aimed at the inexperienced .NET developer because we do have a number of you attending the meetings and we'd like for the group to bring something to the table for everyone. As a follow up to that the first meeting we're trying to get a code camp together with the intent of teaching you how to create a .NET application from ground up the right way, or at least the way we feel is the right way. This is not only for the inexperienced developer as we need a number of experienced developers who can act as a kind of instructor at the code camp helping out with questions. I'd like to gauge the interest in this concept so please write me an e-mail if you're interested in participating either to learn something as an instructor.

We're still working on the web site for the group. All the technical stuff is basically done, we just need text and the pretty parts to be done as well.

Like previously we did a quick lap around the attendees to get a feel for who was present. We had a couple of new guys, one of whom had asked me before the meeting whether he could attend even though he hadn't been the previously. So I I'd like to take this opportunity to clarify that Aarhus .NET Usergroup is completely open to all who wish to participate regardless of previous attendance. We'd like you to attend every time of course to ensure continuity but it's completely up to you. You simply sign up to the meeting you want to attend and that's it. If you've attended a meeting previously you'll receive an e-mail whenever a new meeting is scheduled so you have the chance to sign up before anyone else.

Troels Riisbrich Underlien gave an interesting presentation on Enterprise Service Bus and BizTalk. The presentation focused on ESB as a technology and less on BizTalk although he gave us insight into some of the inner workings of BizTalk because they were at the heart of the ESB solution he outlined later on. Troels gave us information on how to go about building an ESB on BizTalk, the Microsoft guidance, and probably most interesting of all how Vertica has created and implemented an ESB for Bestseller. Download the slides if you want to either recap or get a feel for the content of the presentation. Essential an ESB is the way to go if you're considering doing SOA that's my personal take away from the presentation anyway. If you what want is a asynchronous, scalable and flexible solution there really is no way around the ESB as a concept.

After a short break and chatting in the hall ways we went back to the regularly planned programming where Holger Brøns Jensen the CIO of Krifa did a brief presentation on the IT organization of Krifa and the challenges they're facing. Krifa is definitely facing some interesting problems at the moment as they're moving their entire platform to a service oriented architecture, of course they have a lot of legacy which still needs to work so the last two meetings have basically been perfect for their needs. Krifa has done some very interesting stuff in the past and was off to the IP telephony races very early on which provided them with a nice head start on the callcenter side of things compared to their competition. Thanks to Holger for a very informing presentation.

Finally we had the unstructured part of the meeting which we call the Nutcracker. People usually refer to this part of the meetings as the most interesting as it opens up for discussion on various topics. we had a couple of good discussions this time around: Klaus had a problem getting their ESB to talk to WCF and we steered him in the direction of a possible solution. We even got Visual Studio fired up to show him the default binding profile for ASMX, of course I couldn't help but get sidetracked just a bit so I demoed a couple of features of ReSharper a couple of which have actually found their way into Visual Studio without my knowledge making for an interesting demo. Following that I wanted to get people's opinion on ORM and which they use themselves. I didn't really get that one off of the ground but the discussion took an interesting twist regardless so all in all a success.

Thank you to all who attended this meeting. As I started out by saying we're aware that the topic was esoteric and we'll try to keep broader topics of interest in mind for future meetings. I'd like people who plan to attend in the future to think about topics for the Nutcracker so we ca get the discussion going, maybe even prepare a short five minute talk to get the topic going.

posted on Sunday, 30 September 2007 13:25:16 (Romance Daylight Time, UTC+02:00)  #    Comments [0] Trackback