Category: Tips

By spgennard, August 22, 2010 4:13 pm

Last week I replied to a post about exceptions, it made me think those programming .Net daily take for granted the etiquette of using Exceptions. So I thought I would share some of my thoughts… well it is a sort of a rules’ish list.

  • Exceptions can be expensive, so avoid using them for normal conditions
  • Only catch the exceptions you can handle
  • Don’t hide/swallow exceptions
  • Don’t catch System.Exception as will also catch unmanaged exceptions such as System.Runtime.InteropServices.SEHException
  • Consider using your own custom exceptions or derive them from similar ones
  • Remember inner exceptions when processing an exception
  • Use the Exception suffix on your custom exception
  • Consider using Microsoft’s StyleCop to point out common issues
  • Avoid using System.ApplicationException if you want to use the code in the Silverlight CLR
  • Remember to serialize your own exception types
  • Use xml comment docs for the exceptions a method raises… it helps intellisense..

I suspect I might have missed something.. so feel free to comment..

Extending Visual COBOL 2010

By spgennard, July 1, 2010 9:08 pm

One of the many great reasons for choosing Microsoft Visual Studio 2010 as our development platform for Visual COBOL 2010 is it ability to be extended… which we have done but you equally use third party extensions too.

One of my favourite extensions is the spell checker for the editor, which is great for pointing out spelling mistakes, which for me can only be a good thing :-)

To install the extension, it is as simple as downloading it, clicking on the downloaded file, restarting Visual Studio and using it.

The spell checker I use with Visual COBOL 2010 is:

http://visualstudiogallery.msdn.microsoft.com/en-us/7c8341f1-ebac-40c8-92c2-476db8d523ce

For those interested, here it is in action…

Reflection and COBOL

comments Comments Off
By spgennard, February 13, 2010 11:56 pm

For the last couple of months I have working on Visual Studio 2010 and this include Microsoft CLR v4 and I was recently asked how to write a test that determines at runtime which CLR is being used and what assemblies it uses. I replies would use reflection. So I dropped my friend a mega simple demo… and here it is.

       $set ilusing"System.Reflection"

        01 myAssembly type "Assembly".
        01 usedAssemblyName type "AssemblyName".

        set myAssembly to type "Assembly"::"GetExecutingAssembly"

        display "My exe is " myAssembly::"FullName"
        display "and is using CLR " myAssembly::"ImageRuntimeVersion"
        display "and is loaded from " myAssembly::"Location"
        display "the initial method of this program was "
          myAssembly::"EntryPoint"::"Name"

        display "This assembly references -> "
        perform varying usedAssemblyName
             through myAssembly::"GetReferencedAssemblies"
              display "-> " usedAssemblyName
        end-perform

And the output of the program is:

My exe is clrver, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
and is using CLR v2.0.50727
and is loaded from d:\clrver.exe
the initial method of this program was _MF_ENTRYThis assembly references ->
-> mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-> MicroFocus.COBOL.Runtime, Version=3.6.0.0, Culture=neutral,
PublicKeyToken=0412c5e0b2aaa8f0

Manual for British Gas RC Plus Thermostat

comments Comments Off
By spgennard, January 29, 2010 6:37 pm

I recently tried to find our manual for our “British Gas RC Plus Termostat” on the internet as we have lost our original manual.

Anyway, after some research, I found they British Gas just re-badged them from Drayton Digistat and here is the links to the pages that contain the .pdfs’.

http://www.gasapplianceguide.co.uk/DigistatPlus2.pdf
http://www.draytoncontrols.co.uk/WorkArea/DownloadAsset.aspx?id=4235

Microsoft Application Architecture Guide, 2nd Edition

comments Comments Off
By spgennard, January 27, 2010 11:55 pm

Microsoft have just updated the “Application Architecture”.  I can’t say I have read it from cover to cover but it is being downloaded to my ebook reader…

The guide helps you to:

  • Understand the underlying architecture and design principles and patterns for developing successful solutions on the Microsoft platform and the .NET Framework.
  • Identify appropriate strategies and design patterns that will help you design your solution’s layers, components, and services.
  • Identify and address the key engineering decision points for your solution.
  • Identify and address the key quality attributes and crosscutting concerns for your solution.
  • Create a candidate baseline architecture for your solution.
  • Choose the right technologies for your solution.
  • Identify patterns & practices solution assets and further guidance that will help you to implement your solution

The guide can be downloaded from: http://www.microsoft.com/downloads/details.aspx?FamilyID=ce40e4e1-9838-4c89-a197-a373b2a60df2&DisplayLang=en

Panorama Theme by Themocracy