MyTechEd 2007 – Day 3

MyTechEd 2007 – Day 3

Clearly the best day of the conference until now, with two really great sessions: Pat Helland’s and Rafal’s.


The first session was Justin Smith’s “Connections in the Cloud – BizTalk Services and WCF“. This was an interesting session about BizTalk Services, with some demos to illustrate how it can be used. I’ve described the technology previously, so I’m not going to spend time here on it. I especially liked the demo where the access control to a service is done at the ISB-level, based on claims and w/out any change whatsoever to the service. We were also told the team is using agile methodologies, with new drops every 6-8 weeks. Workflow is obviously the feature everybody is waiting for. And I personally wish it had context-based routing, and not only named-uri/topic-like pub/sub. CBR is an immensely powerful mechanism available in BizTalk Server, and it allows for greater decoupling between the sender and receiver(s) of a given message.


Next was Matt Winkler’s “What’s the Context of this Conversation: Enabling long running services in workflow services“. The basic ideas of Workflow Services (in .Net 3.5) are implementing services as workflows, and hosting workflows as services. The session described the current mechanisms used to communicate between the wf host and its instances using applicational queues, and described how this works in long running scenarios. If this was BizTalk Server, this would be a session about Correlation and Convoys. Since its not, it was about the exchange of context information between the service and its clients so that the correct instances can be rehydrated when messages/invocations arrive. Matt highly recommends the “Conversation” sample from the SDK to learn about this topic. Having studied previous versions of WF, I’m glad they are dropping the Handle External Event/Call External Method ways of communication between host and workflows, which always felt strange to use.
This was not the greatest of sessions, but it was interesting nonetheless.


After lunch there was Pat Helland’s “Data on the Outside vs Data on the Inside“, the best session of TechEd IMHO. This is not a new session (also see this), it’s a couple of years old, but the ideas are still up-to-date. The session starts with the idea that services communicate using messages, and from there Pat explores the location of the data (inside services, or in messages being exchanged). The most interesting part of the presentation were the parallels between the theory of relativity and messaging. Definitely a great session. Some quotable sentences I noted: %u00abMessages are not from the now, but from the past. There is no simultaneity at a distance%u00bb, %u00abServices, transactions and locks bound simultaneity%u00bb, %u00abAll data from distant stars is from the past [so, each service has its own perspective]%u00bb and %u00aboperators is hope that something will happen in the future%u00bb.


The next session was “Silverlight, Asp.Net and Web Services in IronPython and IronRuby“, presented by Mahesh Prakriya. The session was very much about the Dynamic Language Runtime and the languages that use it. It included quite a few impressive demos of Silverlight and its interaction with IronPython, as well as using Web Services (and dynamic proxy creation). The Asp.Net demo was less interesting. I find dynamic languages really interesting (I love languages like Lisp, Prolog and Xslt), although much less structured that C++/C#/Java-like languages, and would like to experiment using these languages in some enterprise scenarios. Unfortunately, however, it’s possible to call from DLR languages into CLR languages, but not vice-versa. Which means I can’t develop over SharePoint, OBA-apps, or even BizTalk, calling into DLR code. Helas.


The last session of the day was Rafal Lukawiecki’s “Developing More Intelligent Applications Using Data Mining“. Rafal  is a great speaker, and this was a very good session, which is available online here at a previous event. Rafal is widely known to be able to deliver great sessions whatever topic (he did sessions on security, networking and MSF, at TechEd), being a very eloquent and expressive speaker. His session was dedicated to the use of data mining techniques in application development, and started by establishing the differences between OLAP (interactive exploration of data) and Data Mining (Proactive discovery of information/patterns). This “discovery” aspect, or “Predictive Programming”, is what can allow use to develop more intelligent apps, with adaptative user interfaces, data input validation, and business process validation. De session ended with a demo of Input Validation using Sql Server 2005 Analysis Services. Overall this was a very interesting session that left me with several ideas of possible applications in the development work we do at |create|it|.


[Edit]
And thus ended the third day of the event. At night, there was the portuguese country dinner, with all the portuguese people attending the conference. (Did I mention TechEd was largely about networking? ;-))

Hiring Talented .NET Developers at Sogeti

I’m thrilled to announce that business is so very good at the moment that Sogeti is

once again looking to increase the ranks of their Microsoft Practice. Sogeti

has been my employer since August of 2006, and I must say that I’ve been thrilled

with my experience there. The team that we have in Dallas are some of the brightest

folks I know. Of course, platitudes are not a reason to work for a company,

but enjoying what you do is key. In case you are not aware, Sogeti is a division of

Capgemini which focuses on regional IT services delivery. What does that mean?

It means our consultants don’t travel (for the most part) and are placed at positions

within their home cities.

We have at Sogeti one of the best work/life balance benefit packages I’ve ever encountered

in the industry, here are some details:

  • All full-time employee consultants are salaried, W2 employees. We are a consultancy,

    not a contracting body shop. Rolling off a project with a client results in

    bench time at the office while sales places you at the next client, not the end of

    your time at Sogeti.

  • Medical and Dental Insurance paid for the consultant, plus the option of a Health

    Savings Account which allows you to save money towards any sort of “out of pocket”

    medical expenses, even over the counter drugs, with pre-tax dollars. If you

    don’t use the money, it rolls over year to year, and becomes yours to do with as you

    wish at retirement age.

  • Comp-Time for every billable hour over 40 worked in a week. We’ve all had that

    nasty 60 hour a week project, they for the most part cannot be avoided, but with this

    plan you would earn 20 hours of Comp-Time per week to use to spend time with your

    family when work was less crazy. They reward time with time, not money, and

    that is key.

  • Three weeks of PTO for the first two years, four weeks after that (it goes up again

    but I forget when). Also twice per year you can purchase a week of PTO, meaning

    you could have as much as 5 weeks of PTO in your first year and that is not factoring

    in Comp-Time.

What sort of folks are we looking for you ask? .NET Developers of all levels

but if you have experience with any of the following technologies that would definitely

help:

  • BizTalk Server – We’ve got the premiere BizTalk practice in the area and would love

    to welcome more talented developers into the fold.

  • Microsoft Office Sharepoint Server 2007 aka MOSS 2007 – A hot technology at the moment

    and the emerging enterprise web technology. If you’ve work

    with Sharepoint, drop me a line.

So are you interested? Drop me a line at [email protected] with

your resume attached and I’ll get you in touch with the right people to start the

process. Remember, life is to short to do something you don’t enjoy completely.


Tim Rayburn is a consultant for Sogeti in the Dallas/Fort

Worth market.

1000 Lines Of Code

Scott Watermasysk, of .Text and Community

Server fame, has a post on

his new blog which talks about the start of his

current project at Telligent called Graffiti.

In it he discusses his opinion that if a first version of your project cannot be accomplished

in under 1,000 lines of code, then it probably is being over-engineered from the get

go.

Key to this premise though is the idea that you re-use pieces produced by others in

order to avoid writing your own code. He discusses a large variety of other

libraries which Graffiti uses, or used in the first few releases. Some have

been replaced, some are still used, but the point is something that is discussed in

“agile” circles quite a bit and circles around lots of catch phrases like “Release

Often”, “Keep It Simple”, “YAGNI” and the like. What I particularly like about

Scott’s example is that it is a stand against “Not Created Here” which is a horrific

airborne virus that many corporate IT departments have caught.

How many things that you’ve written code for do you know for a fact have been solved

before and you’re re-writing simply yo re-write? Data Access, yup. ORM,

yup. Security, yup. Nearly every problem has been solved before, and using an existing

library does not diminish the value of your project in fact it increases it because

your “Time to Market” will be much higher.

Go read Scott’s post, and when your done riddle me this dear reader : What is the

biggest piece of code have you personally written that you know you shouldn’t have?

Mine is easy, I’ve re-engineered an entire Rules Engine when BizTalk Server’s Rules

Engine was available to me. That was a big piece of code, like 3 developers

for 4 months kind-of big. Live and learn.


Tim Rayburn is a consultant for Sogeti in the Dallas/Fort

Worth market.

Distinguished Fields and Optional Elements

Thought this might be of interest to a few BizTalk developers out there.

It’s quite common practice to use Distinguished Fields in orchestrations, to get/set
the value of an element or attribute.

However, if the element you’re trying to set/get doesn’t exist, then this poses a
few problems.

Setting a Distinguished Field

If the element/attribute doesn’t exist in the target message, then you’ll get an exception,
no questions asked – there’s no way around this.
Under the covers, the SetDistinguishedField method
is called to set the value – and it doesn’t check if the element/attribute exists
first.
The same thing happens if you use the xpath() function
to set a value, and the element/attribute doesn’t exist – BizTalk isn’t about
to modify your message and add the element/attribute for you.

In this case, it’s your responsibility to check that the element/attribute exists.
If it’s a message that you create, then you have to make sure that the element/attribute
is created (do this in a map by mapping an empty Value Mapping functoid to it, or
setting the Value property to “<empty>“).

Getting a Distinguished Field

This is more interesting.
In a nutshell, if the Distinguished Field is of type string (or
any other nullable type) then you’ll get null.
Otherwise, you’ll get an InvalidCastException.

The reason for this is in the underlying code.

The orchestration calls XSDPart.GetDistinguishedField to
get your value:
public override object GetDistinguishedField(string
dottedPath)
{
    XsdDistinguishedFieldDefinition dFDef = (XsdDistinguishedFieldDefinition)
base.GetDFDef(dottedPath);
    object val = base._getXPath(dFDef.XPath, dFDef.IsDynamic);
    if (val == null)
    {
        return null;
    }
    if (val.GetType() != dFDef.FieldType)
    {
        val = XmlHelpers.ChangeType(val, dFDef.FieldType);
    }
    return val;
}

This method will return null if the element/attribute doesn’t exist otherwise it will
attempt to convert (cast) the value to the appropriate type.

However, the InvalidCastException arises
from your orchestration.
Let’s assume you had a Distinguished Field called isSuccessful which is of type boolean.

When you write something like

if (Response.isSuccessful)

in an expression shape, the code generated is this:

if (!((bool) __ctx2__.__Response.part.GetDistinguishedField(“isSuccessful”)))

Ahah! The orchestration does an explicit cast of the Distinguished Field value to
a bool.
And an explicit cast of null to a bool will raise an InvalidCastException.

However, an explicit cast of null to a string is fine.

So if you had a Distinguished Field called employeeName of type string, then the same
code would be:
if (!((string) __ctx2__.__Response.part.GetDistinguishedField(“employeeName”)))

And no exception would be raised.

Conclusion

If you’re using Distinguished Fields with types other than string, and the element/attribute
you’re referring to is optional then you must check that the element/attribute exists
before attempting to set/get a value.

In most cases, you’d do this by using the xpath() function
in an orchestration
(e.g. getting a count of the element/attribute, and checking that count >
0)

Just FYI….!

Visual Studio 2008, WCF Service Libraries, and CTRL-F5

One of the cool new features in Visual Studio 2008 is automated debugging for WCF service libraries. Simply create a new WCF Service Library project (using the new WCF project templates), press F5, and viola!


When you press F5, Visual Studio launches WcfSvcHost.exe, a generic WCF host application that hosts your service library. WCF Service Library projects now come with an App.config file — this is where WcfSvcHost.exe reads the service/endpoint configuration during initialization. A generic WCF client application (WcfTestClient.exe) is also started, and it communicates with your service via MEX to download metadata. It provides a generic mechanism for filling out the data required by each service operation, invoking the operation, and viewing the results. It even works with complex types unlike the ASMX-generated test forms. Sweet.


You can configure the service library to use a custom client application if you desire. Go to the Debug tab within the project properties and specify your app as a command-line argument ( /client:“YourClient.exe“ ).


Note: for some reason the latest drop of the BizTalk Services SDK (0.9.0324.0) breaks this feature. So if you have the BizTalk Services SDK installed and you try pressing F5, you’ll most likely get the following exception:



Unhandled exception has occured in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, the application will close immediately.


Object reference not set to an instance of an object.


If you uninstall the BizTalk Services SDK, this feature will work normally once again.