Monday, November 22, 2010

A very weird bug

.. with an even weirder resolution

The other day I was working with a consultant from another firm to try connect our systems together. Previously we had exchanged WSDLs and even a stub service so we didn't expect to many problems implementing the real stuff.

The other client had brought his own laptop and that was quickly hooked up into the network. That was an easy start.

But ...

Things started to get really weird when I tried to connect my client app to his service. To make it a little more clear to you all: the service was a .NET 3.5 WCF Service and I was consuming it using a .NET 2.0 webservice client. The 2.0 bit was manadtory as our application is still limited to that version of the .NET Framework.

We were greeted with the following very weird error:

The message with Action 'http://tempuri.org/ITheOtherService/GetObjects' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).

Googling it didn't give me a clue.

To add some more info: he was running his own domain and Active Directory on his machine. And I also had to use a NetworkCredential to get access to the service. I could see the MEX output in Internet Explorer (using the correct credentials) so connection was verified. We were connecting using the IP address of his machine.

Question marks all over

Completely baffled he gave me a test application that he had used to test the setup with a colleague in his office. We got a error message that prompted me to add the hostname and IP address to my hosts file. We had an error about linked XSD files that couldn't be found because the hostname could ot be resolved.

After that little hack we had no problem making call and getting results. Completly stunned we stared at our screens. OK, fine by me.

The big application where all the work was made still did not function. Still showing the same error message.

Another even simpler app was created, making a simple call to the service. And it worked. But still not in the big application we needed to hook up.

Details are the devil's hiding place

In another test run I then saw that I had configured the big application using the IP address. The hostname was not yet in the hosts file when I first configured the service address.

The test applications we used both of them used the host name in stead of the IP address and they worked.

After having changed the configuration to use the hostname evrything started working.

I still haven't found out why it did.

Well, who cares?

We then continued to do the testing and had to make onlysome small changes as we both had done a great job in building our apps to mutual specs. So, it was all in all a great success. But something keeps itching me.

Well, who cares why it worked with hostnam? Well I do care! I have no real idea what the reason is why it worked one way and not the other. SO, if any of you can point me to the reason of this, please leave it in a comment.

Also, maybe this story helps you to solve your weird error. If so, please leave a commoent.

Monday, November 15, 2010

A discussion about creation

.. too early in the morning

Every now and then I am invited to a job interview to sit at the employers side of the table.'That is kind of fun as well. I do enjoy sitting on the other side, because I have the feeling that I am the one who is to make the decision whether to take the position or not. Once they have invited me for the interview I am pretty close to getting hired. At least that is the mood I try to get myself into on most of these occasions.

As I am a developer I mostly attend the interviews for developers. I am usually the ally of the prospect in that sense. The manager that sits there as well is most of the time a non-developer. Someone who knows we need someone with .NET and C# skills, but has no real idea what that means. I am there to see if he or she has any real developer's skills.

Questions to ask

A colleague of mine has very goo question to ask the candidate. He tells the candidate that we would like the manager start programming or at least understand some more what we are doing. One of the things the manager still can not understand is, what is Object Orientation? Can the candidate explain that so the manager can understand the concept. I have heard some hilarious answers to that question. One of the apparent advantages of Object Orientation is that you can spread the objects across multiple servers. The same candidate explained some of the aspects of OO with a dog as an example, one the methods could be Bark() or Sit(). When asked how one would distribute such behavior across multiple servers he fell silent.

Another good and slightly more tricky question to ask is about difference between the terms class, type and object. I must admit that I had to think about that one to come up with a good example. I propose the following example of a Person class, with as properties: first name, last name and birth date. Let's pass those along in the constructor and you get to the following code:

Person person = new Person(firstname, lastname, birth date);

The first word "Person" is the type of the object "person" being created. The class is Person in which a.o. the used constructed is found.

All right, purists, kill me in the comments, but it gently.

A question to ask

I then started to let my mind go wandering where it will go.

I thought about namespaces. I happened to have been in some discussion with namespaces and doing it better than it was in common practice at this job I was at.

The class Person would be in something called

  • Human

Then I started expanding:

  • Nature.Human
  • Earth.Nature.Human
  • Creation.Nature.Human
  • God.Creation.Nature.Human

Hmm, sounds like intelligent design. Note that I haven't named God, that would turn off some other Persons from the namespace Hardcore.Christian.God.Creation.Nature.Human.

Or for those rather having the Evolution Theory, it could be something like:

  • Darwin.Evolution.Mammal.Primate.Human

But working along these ideas, ultimately, all namespaces would be positioned below God or Darwin. That would be strange idea. And what about the Flying Spaghetti Monster?

The God Class

Then I found myself wondering about the God class. "You should never create a God class." It must be one of the ten Developer's Commandments. Which namespace would that God class be in? I became stuck at this point. I at least understand now why I should never creat a God class, because there is no namespace to put it in.

On top of that does the God class derive from object? Or from a divine object? Or the other way around: does object derive from God?

Philosphical

So, there I was completely philosophical before 9 in the morning. Suffice to say, I didn't get much work done all day. Especially no Divine Work.

Please someone help! Define devine!

Friday, November 12, 2010

Scope creep can be nasty

.. but scope run seems worse

I've had it happen way too often on me: scope creep. Slowly, but surely small things get added and one moment you notice that way too much things are happening and need to be done on that small project.

I have been there and seen it and let it happen and still let it happen way too often. Almost every project scope creep comes creeping in.

But it can be worse

What is also possible in these 'agile' processes that are so hip these days that scope creep can go so fast that it not just adds some extra, elaborate features, but that it changes the complete application you are working on.

Sounds like horror?

Maybe this sounds like horror to you, but it can be a blessing as well. It prevents the moment where the client is proudly presented with the end product and then tells you that it is by no way what he wants.

To me it has been a good experience.

I know, I know

.. it's been too silent

Lately I have been busy with loads of stuff and hardly had the time to write some stuff here. But I have some posts in the pipeline. Promise

It will take some time though, before I can publish as a lot of things are happening.

uhm ...

I'll see you soon, I hope.