Doing the "right" thing

Doing the "right" thing

I was suitably impressed that Dan provided feedback to my previous post re the patent around the Object Test Bench v’s BlueJ issue in which he covers the two points I was trying to make:



  1. The patent shouldn’t have happened – congrats to the team for admitting that they are only human and that mistakes do happen.  Along with the BlueJ community (which I don’t actually belong as I think this is flogging a dead horse) I’m interested to see the answer to “why did this happen in the first place”.  I think they would also like to see some attribution of the work that was done in this area prior to VS2005.

  2. The second point was that OTB has limited use – why do I say this and what features would I ask for? I appreciate that Microsoft is always listening to the community (for which I’m very impressed) but these two bits of feedback were either ignored or sidelined as not important:


  • OTB only works with the project that is marked as startup – and this includes class libraries.  If you are working on a class library (as part of an application) and you want to try something with a class you have to set that project to be the startup, experiment with the class, then set the application back to being the startup project

  • OTB has no memory – you can establish quite complex object graphs only to have them blown away when you rebuild/make changes to your application.

I’m sure there are other bits of feedback that I would provide on the OTB but these are the two sore points from my point of view.  Thanks again Dan for opening the discussion on the future of the OTB

Getting OneCare an WMDC to play together

Getting OneCare an WMDC to play together

Late last year I posted about my frustration with the betas of OneCare and the Windows Mobile Device Center (WMDC) not playing well together on Vista.  Now that both have been released I’m pleased to pass on the fact that there is a work around to get the two products to play together properly (many thanks to the guys at MoDaCo who posted this).  Of course this doesn’t help if you are experiencing the same issues as Mauricio!

Bogus Patent for what?

Bogus Patent for what?

I was just doing a bit of catchup reading and noticed a post on Dan Fernandez’s blog about a recently withdrawn patent that was for the Object Test Bench (OTB) that was introduced into Visual Studio 2005.  Having had a bit of experience with BlueJ while tutoring at UWA I was very disappointed in the limited functionality in the OTB.  In fact I would go so far as to claim that it was useless for anything but simple demonstrative examples – definitely not the production IDE quality that I would have expected (the same I must admit is true of the Class Designer). 


With this in mind I was shocked to learn of the patent that they apparently “accidentally” (what rubbish) submitted.  Following the link on Dan’s blog I read the post that Michael makes and his original comparison he did between the OTB and BlueJ.  Seriously, if you are going to patent something (which clearly wasn’t original) you could at least make it usable!

Microsoft Sync Services Configuration Example

Microsoft Sync Services Configuration Example

Over the last couple of days I have been putting together some sample code that will significantly reduce the amount of code you have to write to work with the Microsoft Sync Services.  Unfortunately one of the major issues with MSS is that you are responsible for nearly everything (unlike Merge which is pretty simple once you have set up the publication).  The configuration sample which can be downloaded here moves all the tedious code out to a configuration file, freeing your application up to delievery functionality!!!  This sample reworks the original samples from the Synchronizer blog, Demo I, II and III


Oh, and if you hadn’t guessed there is a reason why I recently blogged about .NET v2 Custom Configuration Sections.  <Shameless plug>If you are interested in learning more about these then you should purchase a copy of Professional Visual Studio 2005 which covers this in detail, including how to get intellisense within Visual Studio 2005 for your custom configuration sections.</Shameless plug>

User Interface – Who thinks it’s important?

User Interface – Who thinks it’s important?

I’ve just finished listening to two of Ron Jacob’s Arcast shows both of which covered aspects of User Interface. With the work that we are doing at Intilecta this is clearly an area that we place a strong emphasis on as part of our product development process.  What I don’t get is why everyone has suddenly decided to focus so heavily on user interface.  Perhaps it is the fact that Microsoft (and most other technology companies) was whipped by Apple when they stormed the market with the iPod.  With the recently introduced Zune it is clear that Microsoft is trying to put a stop to this market dominance but will they be in time to stop the iPhone???


If you look at the recent product releases and announcements from Microsoft it is clear that there is a significant move to combat this “lack of user interface”.  Just to name a few: WPF, Expression Suite, Vista, Office 2007, WPF/e, Atlas and the list goes on.  In fact if you look at the structure of Frank’s new look team you can see that user interface has it’s own evangelist. 


Ok, quick question to the floor – who has been involved in a project (that is going to have some sort of user interface) where they haven’t said “we want a user interface that really engages the user”?  I think that there has been enough talk about user interface so it is at least a consideration when we build an application.  Further there needs to be a distinction between poor user interface and stupid users.  One of the snippets on one of the podcasts was that the automated checkin stations at airports were poorly designed because a particular passenger didn’t read the screen and was left waiting for his ticket (the part he didn’t read was that because he was in an exit row he had to pick up his ticket from the counter).  Hey you can take a horse to water but you can’t make it drink – there is no excuse for user being idiots!!


Looking at two of the technologies in the list above, here are some comments:


Ajax/Atlas – One of the issues I have with this technology is that it is a patch for a generally faulty technology.  The whole concept of web applications with a request-response model has a fundamental latency that can only be minimised or hidden.  If this is done well (which can be done with Ajax/Atlas) then you have a web site that is pleasant to use but still no comparison to a rich user experience that could be achieved with a full client application.  I think the next step in this direction will have the returns that the web world are really chasing – WPF/e will provide a cross-platform, server deployed solution that has a rich user experience including media content.


WPF – Ok this is a technology that absolutely rocks.  If you know what you are doing you can build a rockin application that is a real joy to use (I must confess I haven’t seen such an application yet but I’ve been sold on the bouncing/rotating buttons!).  The issue I see here is that Microsoft are trying to get developers to use another technology because it “might” improve their user interface.  Most of the issues I actually see with most user interfaces is that developers don’t understand how to do proper user interface/framework separation – by this I mean the ability to carry out long running actions on a background thread so that the application remains responsive at ALL times.  This issue isn’t fixed by WPF and will continue to be an issue long into the future.


One point I would like to make in closing is that Ron chats with Simon Guest who has a great (although relatively simple) framework for building good user interfaces.  He separates user interface design into three parts:


Visualisation – How information is presented.  Intilecta provides this in the form of content panels and a navigation tree that is easy to navigate and intuitive.  We reuse knowledge established within the team to build a user interface that optimises the presentation of data so the user can see the information they need.


Foundation – Which patterns the application is going to use in order to reduce the amount of code a developer has to write again and again (and again).  IMHO if you have to write it twice you have written it once too many!  We had to build our own user interface framework as we found the Composite UI block to be too complex for what we wanted to do, and not a particularly good fit for the type of user interface we were building.


Context – This is how your application integrates into the total user experience.  In our case we have identified that Outlook is one of the primary business tools that our clients use.  As such we have ensured that whatever we do will integrate seamlessly into Outlook so that the user doesn’t waste time context switching.


In closing I would like to reiterate the importance of user interface.  Don’t take my negative comments as a reason not to get into these technologies and start building better applications.

.NET v2 Configuration Sections

.NET v2 Configuration Sections

Anyone who has written a custom configuration section handler for .NET v1 will appreciate the headaches and the painful process of parsing an xml block.  Well .NET v2 has a much better model for building custom configuration sections.  In this post I will walk you through the basics:


Getting Started: You need to make sure that your application has a reference to System.Configuration.  While by default there is a System.Configuration namespace it is quite limited and doesn’t include the classes you need to build your own custom sections.


We will start with a simple scenario and build it up.  In this case the scenario is that you want to store information about a Person in the configuration file.  Initially you only need to track a single person and you are only really interested in their name.  The easiest way to do this would of course just to add an entry to the appSettings section of the configuration file (alternatively you could use the Application Settings area using the UI designer in Visual Studio 2005 – but we will leave this discussion for another time when we look at application settings):


<appSettings>
   <
add key=Person value=Fred/>
</
appSettings>


While this serves the purpose it might mean that this setting gets mixed up with the other settings you might have defined for your application.  It also means that in code you have to do a by-name lookup for that value:


MsgBox(ConfigurationManager.AppSettings(“Person”))


This is where we can define our custom configuration section.  The first thing you need to do is define what the custom section is going to be called and the name of the .NET type that is going to be used to access the section information.  This is done with an entry into the configSections area of the configuration file:


<configSections>
   <
section name=CustomConfig type=ConfigurationSample.MySection,ConfigurationSample/>
</
configSections>


In this case the name of the configuration section in the configuration file will be CustomConfig and this will be loaded using the class MySection in the ConfigurationSample namespace.  This class is located in the ConfigurationSample assembly.  The next thing to do is to create the custom section in the configuration file.  Initially the entry will just be an entry section:


<CustomConfig/>


Now that we have set up the configuration file we need to create the MySection class that will be used to load this information at runtime.  Again initially this class will be very basic as there is no information to load:


Public Class MySection
   Inherits ConfigurationSection
End Class


To access this section in code you simply use the ConfigurationManager (as will the appSettings information) but this time you use the GetSection method to retrieve the MySection object:


Dim sect As MySection = TryCast(System.Configuration.ConfigurationManager.GetSection(“CustomConfig”), MySection)


Now that we have the basics it is time to go back and gradually add information to the custom section.  We will start with including a Name attribute in the section itself:


<CustomConfig Name=Fred” />


In the MySection class you simply define a property through which you can access this information:


Public Class MySection
  
Inherits ConfigurationSection
   <ConfigurationProperty(“Name”, IsRequired:=True)> _
  
Public Property Name() As String
     
Get
        
Return TryCast(Me(“Name”), String)
     
End Get
     
Set(ByVal value As String)
        
Me(“Name”) = value
     
End Set
  
End Property
End Class


Accessing this in code is as simple as making a call to the Name property of the MySection object:


Dim sect As MySection = TryCast(System.Configuration.ConfigurationManager.GetSection(“CustomConfig”), MySection)
MsgBox(sect.Name)


Clearly this doesn’t read particularly well as it isn’t really the Name of the section you are after.  What would be good is to be able to access sect.Person.Name.  This can be done using a class that inherits from ConfigurationElement.  The configuration file would be:


<CustomConfig>
   <
Person Name=Fred/>
</CustomConfig>


And the MySection class now looks like:


Public Class MySection
  
Inherits ConfigurationSection
  
<ConfigurationProperty(“Person”)> _
  
Public Property Person() As Person
     
Get
        
Return TryCast(Me(“Person”), Person)
     
End Get
     
Set(ByVal value As Person)
        
Me(“Person”) = value
     
End Set
  
End Property
End Class


Public Class Person
  
Inherits ConfigurationElement
   <ConfigurationProperty(“Name”, IsRequired:=True)> _
  
Public Property Name() As String
     
Get
        
Return TryCast(Me(“Name”), String)
     
End Get
     
Set(ByVal value As String)
        
Me(“Name”) = value
     
End Set
  
End Property
End Class

And of course the code to access this information is now:


Dim sect As MySection = TryCast(System.Configuration.ConfigurationManager.GetSection(“CustomConfig”), MySection)
MsgBox(sect.Person.Name)
 


But what happens if we want to store multiple people in this section.  Well there is a built in solution – all we need to do is inherit from the ConfigurationElementCollection.  This would give us a configuration section as follows:


<CustomConfig>
  
<People>
      <
add Name=Joe/>
   </
People>
</
CustomConfig>


And the MySection now looks like (I haven’t included the Person class again as it is the same as before):


Public Class MySection
  
Inherits ConfigurationSection
  
<ConfigurationProperty(“People”)> _
  
Public ReadOnly Property People() As PersonCollection
     
Get
        
Return TryCast(Me(“People”), PersonCollection)
     
End Get
   End Property
End Class


Public Class PersonCollection
  
Inherits ConfigurationElementCollection
   Protected Overloads Overrides Function CreateNewElement() As ConfigurationElement
      Return New Person
   End Function
   Protected Overrides Function GetElementKey(ByVal element As ConfigurationElement) As Object 
      Return TryCast(element, Person).Name
   End Function
End
Class


Now the access code would be:


Dim sect As MySection = TryCast(System.Configuration.ConfigurationManager.GetSection(“CustomConfig”), MySection)
For Each p As Person In sect.People
   MsgBox(p.Name)

Next


I hope that gives you an overview of how you can build your own custom configuration sections.  Of course your custom section is likely to be much more complex and make further use of the built in configuration support.  If you are interested in using this on the mobile device you will have to look to the Mobile Client Software Factory for a configuration implementation as the .NET Compact Framework doesn’t have configuration support.


If you want more information on building custom sections, take a look at Professional Visual Studio 2005