Friday, May 8, 2009

Quote about understanding

Tell me and I will forget
Show me and I will remember
Involve me and I will understand

- Confucius -


I found this quote on the blog of the problem solver.
See: http://msmvps.com/blogs/theproblemsolver

(Solution) "Secure channel cannot be opened because security negotiation" (Geneva)

Today, I was doing some tests with the Geneva (Beta) Framework, again.

It took me some time to find the source of the following errors/exceptions my test applications where throwing:

  • Secure channel cannot be opened because security negotiation with the remote endpoint has failed. This may be due to absent or incorrectly specified EndpointIdentity in the EndpointAddress used to create the channel. Please verify the EndpointIdentity specified or implied by the EndpointAddress correctly identifies the remote endpoint.
  • The message could not be processed. This is most likely because the action 'http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding.

The problem was that my testclient was using a different bindingtype then my test Security Token Service.

For more information about what type of binding to favour, see: http://webservices20.blogspot.com/2009/04/which-binding-to-use-wshttpbinding-or.html

Perhaps this is usefull for you.

Monday, May 4, 2009

Event ID 1023: Fatal Execution Engine Error (Solved)

For some time I have been trying to solve this error that crashed my Visual Studio 2008 when ever I wannted to "Choose Items" for the Toolbox.

What worked for me was to uninstall Visual Studio 2008 PowerCommands!

Event Type: ErrorEvent
Source: .NET RuntimeEvent
Category: NoneEvent
ID: 1023
Date: 2-5-2009Time: 16:54:41
User: N/A
Computer: TEAMSUIT2008
Description:.NET Runtime version 2.0.50727.3082 - Fatal Execution Engine Error (7A035FC0) (80131506)

Complemeting FxCop with StyleCop!

I guess we all know FxCop by Now. But do you know about StyleCop?

StyleCop is a Source Code Style and Consistency Tool.

... FxCop performs its analysis on compiled binaries, while StyleCop analyzes the source code directly. For this reason, FxCop focuses more on the design of the code, while StyleCop focuses on layout, readability and documentation. Most of that information is stripped away during the compilation process, and thus cannot be analyzed by FxCop. ....

See: http://blogs.msdn.com/sourceanalysis/archive/2008/05/23/announcing-the-release-of-microsoft-source-analysis.aspx

Happy Styling!

Tuesday, April 28, 2009

Forget Role Based Security! (Geneva)

With the arrival of the Beta 1 of the "Geneva" Claims Based Access Platform you should forget everything you know about role-based security.

Claims based security is everything! It really  is!

Especially in any SAAS,  Heterogeneous or WCF-Services environment using Security Token Services is the technology to use... But honestly, it should be the security route for any solution!

I recommend reading this excellent document by David Chappel which gives a perfect conceptual (no code) explanation of what "Claims Based Access" and "Geneva" are about.

I also recommend reading this excellent document by Keith Brown which gives a perfect introduction (with code) to the whole "Geneva" suit!


Note: the "Geneva" framework cannot be installed on Windows XP nor on Windows 2003. A temporarily solution can be found here: http://travisspencer.com/blog/2009/02/installing-geneva-framework-on.html


Happy Claiming!





Monday, April 20, 2009

Quote about planning

Planning is everything, but the plan is simply the starting point...

(Source: Agile Manivesto 2.0)

Wednesday, April 15, 2009

TestCleanup quirks! (Unittesting)

Today, I am having problems with one of my unittests. The problem is that my resources are not cleanedup when they need to. This has to do with the unexpected time the 'TestCleanup' runs!

According to msdn one should use 'TestCleanup' to cleanup resources. Why are my other unittests failing that need to reuse this resource? 

I found a clear description of the 'problem' (is it really a problem or by design?) here:

Anyway, to me it is a pain! 
If you have a suggestion, let me know!

PS: I don't violate the 'do not depend on unittest order' - rule... this is about cleaning!

Wednesday, April 8, 2009

Generating testrecords for your unittests

If you are using Visual Studio Database Edition you are able to have VS generate testdata for you. Just what we need to have repeatable testresults.

But how does one execute these so called 'Data Generation Plans' from (unittest)code and from your build server?

You can find the answer here:

http://drowningintechnicaldebt.com/blogs/thomaswaldron/archive/2008/01/08/kick-off-a-data-generation-plan-programmtically.aspx


Happy testing!

Wednesday, April 1, 2009

Harvard Business Video's!

IT is about Business in the first place...

Therefor, to be succesfull in IT, generally, one needs to really understand the business.

To become a succesfull Software or Enterprise Architect you have to know Business Management principles. Therefor my repeating advice, read the Harvard Business Review Magazines and Harvard Business Review Onpoint's, there are just excellent!

To make things even more easy for you to start leaning Business Management Principels, Harvard is publishing some Video's on YouTube...

In my opnion a perfect place to start, though the magazines are so much better: http://www.youtube.com/user/HarvardBusiness

I hope you will enjoy Business Management as I do...

Happy learning!









To MVC or not to MVC?

A lot of exposure has been given to the recent releases of the ASP.Net MVC Framework recently.

It made me curious what it exactly is and in what projects I should use it and perhaps more importantly in which projects not?

After evaluating the current framework version, I have come to the following conclusions:
  • The Framework is perfect for you if you go down the JQuery route;
  • The current version is not for you if you go down the 'old' postback / webcontrols route; Currently form support is really limited but open for extention.
  • Biggest advantage: by default the urls are decoupled from the filenames. (think about security, flexibility and searchengine friendlyness!)

Note that this decoupling can just as well be accomplished by using for example:

  • UrlRewriter.net
  • UrlRewriting.net

For me, I keep an close eye on new versions hoping to see webcontrols/postback and a richer user interface being supported, soon.

Happy Viewing and Modelling!

No overload for method 'WaitOne' takes '1' arguments (foutmelding)

Do you receive the "No overload for method 'WaitOne' takes '1' arguments" error message?

Big change that you are need to install .Net Framework 3.5 Servicepack 1!

Happy programming...

Monday, February 2, 2009

Why SOA Works (QUOTE)

Object Oriented Design works because an Object represents a real-world "thing".

Service Oriented Architecture works because a Service represents a real-world "What we do".

--- 

Not sure whom is being quoted though I found it in "Service Architecture Methodoly, Version 1 - agust 2005, Capgemini".


Friday, November 28, 2008

Bad news packaged well

Ofcourse I never have bad news....

But if you do, make sure you package it well...

Make damn sure you are able to explain - plain and simple - how we got there, what the benefits are of our current unwanted situation, and how to get out.

Packaging does make a difference...

I guess I made my point... ;)


Unity versus Microsoft Workflow Runtime

Being a true Framework designer I love Inversion Of Control (IOC).

Microsoft's current tool of choise for IOC is Unity.

The other Day, I wanted to use my IOC-container inside the Microsoft Workflow Runtime. The reason for this is that I wanted my custom activities to support IOC;

Although the implementation is straightforward, it might save you some time.


public class UnityDefaultWorkflowSchedulerService: DefaultWorkflowSchedulerService
{
  private IUnityContainer _container;
  public UnityDefaultWorkflowSchedulerService (IUnityContainer container)
   {
      _container = container;
   }

   protected override void OnStarted()
   {
      //wrap the container in a singleton to make it global
      ServiceLocator.UseUnityContainer(_container);
      base.OnStarted();
   }
}

Please note that the example uses the IUnitityContainer directly. However, I like to wrap unity in my own IOC-container thus making the Inversion Of Control Container Inversionable. Get it?

Happy Inversioning.

Thursday, November 27, 2008

Anger is a gift (quote)

...
if you're not outraged, you're not paying attention. If you witness someone suffer undeservedly, that ought to madden. If you see someone profit through malice or fraud, that ought to infuriate. When you see cruelty, when you see pain, when you see injustice, and you know it would sacrifice nothing of moral consequence to end that cruelty, to soothe that pain, or right that wrong, and yet it persists, something has to explode inside you if you've got anything resembling a soul.
....

Tuesday, November 25, 2008

Stop Unittesting Its A waste Of Time!?

Ever noticed that some professionals (dedicated people most of the time) can have fatigues for certain attitudes or situations?

You know what I am talking about... Just think of Gordan Ramsy for example.

Today, I noticed that I am about to have some fatigues myself!
  • Don't tell me that working with a version control system takes way too much time making it impossible to meet your deadlines! Just don't!
  • Don't tell me that spreading (not adding) your code out over an interface, baseclass and factory takes way much more time! Don't!
  • Don't tell me that managers won't give you extra time to write unittests for your project! Don't, Don't, Don't!
In a desperate attempt to lose these fatigues and, to be honest, in the unrealistic hope to not have these discussions over and over again I will try to explain why this just is not true!


"Managers won't give you extra time to write unittests...?"


If you don't get extra time to write unittests it is probably a very good thing! I mean, why do you ask your manager for this in the first place? Are you asking your manager for extra time to have sensible variable names in the code you write? Are you asking for extra time for something "exotic" as comments? Ofcourse you are not! Same goes for (unit)testing! When your manager asked you how long it would take to develop that piece of software he ment "How much time will it take to develop the software in a sensible way!". Asking for extra time for comments or testing  or anything else that is normal when it comes to software development is your own attempt to get everybody frustrated... If this would be your attitude I bet that if you would get this mysteriously needed extra time in the first place , your software would still not meet quality standards only to find another excuse... but that's a different story.


"Unittesting takes way too much time?"


The first thing that pops into my mind is what do you compare it to? Changes are that you are comparing a well (unit) tested software system with a hardly tested at all software system. Sure testing takes a fair amount of time but this has nothing to do with unittesting or any other testing methodology.

To make this point extra crystal clear I will give you an example:

Today is your lucky day! Your are asked to extend your Acme-company's intranet with a way too simple news-part. 

Your current "timesaving" scenario:

You create the table in your database, write some queries and code to get the data in and out the database, some helper functions probably and finally the User Interfaces. Not using any sensible (unit)testing strategy you probably test the application by inserting, updating and deleting minimal news articles (subject=a, body=a, startdate=select from calendar, department=select from list) as long as it takes for the simple scenario to work. Tired of "testing" you do another test with a large newsarticle. You call it a day and a finished application ready to take into production... only for the nightmare (maybe not your nightmare but definitely mine). When users start using your application bug reports are being made to the helpdesk by phone and by email to be answered, added and forwarded via the bugtrackingsystem only to be discussed with the manager what to do and when. You find the bug, change your code again you do some simple and random testing, do a release (with all the overhead that comes with), close the bug and tell the manager and helpdesk for them to inform the original user.

Why did all these bugs hit you in the face? Because you did not test at all... If this is what you call testing I suggest you buy a book about testing software... I call it a waist of time....


Your new "timesaving" scenario:
Instead of doing those random dataentry scenarios that usually involve endless logins and selecting the needed menu buttons and options... I will write three simple test that do a "way too simple" insert, update and delete. I know that doing those will save me a lot of time compared to your scenario. I will run the tests and modify my code until it works. The time I have left I spent on writing some extra simple tests for my code (test principle: find defects early). Now that everything works I tie things up to my user interface and do some simple but serious Blackbox testing because the user interface contains hardly any code (test principle: software that is easy to test is easy to maintain).

Now when a bug report comes in I check it against my unittests to see why that situation is not covered. If it is covered it's simply a user interface problem easily fixed.

Conclusion:
Unittesting does not take extra time if you don't do extra testing. It does save time because you can just repeat and repeat your tests with one press of a button untill things work.

Of course, even if you would compair proper repetitive manual testing in comparison to proper unitesting, unittesting will saveyou time right from the strart (even before you start refactoring). Not to mention that unittesting not only results in less defects but also leads to better designs....

Happy UnitTesting, Today !

P.S.: I know the example is not UnitTesting by the book its more integration testing but that's not what this article is about...


Friday, November 21, 2008

What is Architecture (Quote)

"Architecture is the continues quest for finding, keeping and sharing the perfect balance between philosphy and pragmatism through continuous evaluation of all stakes in blind justice by utilizing all available creativity and knowledge ."

Marcel van Eijkel -Eindhoven, 21 November 2008

Thursday, November 6, 2008

Whats new in DotNet 4.0 (pdf)

Take a look at this .pdf to get a good but quick impression about the new types and namespaces included asof Dotnet 4.0 (and 3.5 servicepack 1).

http://brad_abrams.members.winisp.net/Projects/PDC2008/PDC2008-NETFX4.pdf

I think there is enough for everybody to benefit.

For me I particularly like:
  • the new biginteger datatype that is part of the new core;
  • the new concurrent-collection;
  • the mvc framework that is included;
  • the many new classes for the workflow framework;

What I like less about this release:

  • the entity framework seems part of this release. My experiences sofar before it was included in this release were disappointing;
  • in my opinion, the unity should have been part of the core;
  • new ajax stuff, but i would bet my money on jquery. No microsoft ajax for me anymore for a while;

Monday, November 3, 2008

My Favorite Code Snippets (Visual Studio)

Below, my ever growing list of my favorite Code Snippets:



happy Snippeting!

Friday, October 31, 2008

Visual Studio Unittest Inheritance

As your project thus your unittests grow and get more complex you might have to use every Object Oriented "trick" in the book to keep your UnitTests lean/mean/fast and flexible. Of course you don't want any redundant (unittest)code so applying inheritance to your unittests might seem a natural step (especially with provider/Inversion Of Control/Plugins beging used more and more).

Inheritance of UnitTests for Visual Studio however, still, is only partly supported by Visual Studio 2005 and Visual Studio 2008 (all editions). You can't define your baseclass/derivedclass in seperate assemblies.

To me this is a big limitation and the "obvious" solutions offered by Microsoft (copy/paste or add twice) for me are no option. I rather go for sharing in my version control system.

Just an other example of why UnitTesting as offered by Visual Studio so far "feels" a bit unmature. Speaking of which: the atrributename of "fixture" is so much more right then "testmethod"...

======== From MSDN =============

A test class is any class that is marked with the TestClass attribute. Test classes can now inherit members from other test classes. This means that you can create reusable tests in base test classes; derived test classes can inherit tests from base test classes. This feature eliminates duplicated test code and gives developers more flexibility while unit-testing production code.
A test class cannot inherit from a class that is in a different assembly. You can circumvent this limitation in the following way:
  • Define your base test class in a source code file and add the file to Project A.
  • Add the same source code file to a different project, Project B. To do this, right-click the project in Solution Explorer, click Add, click Existing Item, and then use the Add Existing Item dialog box to select the file.
    Although Project B builds into a different assembly, it includes the base test class. Other test classes in Project B can inherit from that base test class

===============================


For more information:

Visual Studio 2005: http://support.microsoft.com/kb/919649
Visual Studio 2008: http://msdn.microsoft.com/en-us/library/ms182516.aspx

Happy Testing!