Virtual Static Void

Virtual Static Void

Keeping track of the ever changing...
Framework Proliferation

These days, .net developers are certainly spoilt for choice. There are so many useful frameworks out there, that it has become difficult to decide which one to use. Also, getting to grips with each one requires concerted effort and time to fully understand the pros and cons.

Just take for example ORM frameworks, aside from the many Open Source implementations there are a plethora of commercial ones too.

In my quest to evaluate as many open source frameworks, I found the How-To-Select website, which has a section devoted to O/R Mapping Tools for .NET.

It is particularly interesting to watch the evolution of Open Source in the .net world... now I think I know why the Java folks have JSRs so that there is some commonality between implementations.

Switching on Enums

Having read Jared Parsons blog entry on Switching on Types, I was inspired to follow on with a class that switches on enumerated values. This is achievable using a regular switch, but this approach seems more elegant.

The expected usage as follows:

  // given enumeration
public enum HoldingField
{
Holding,
BookValue,
MarketValue,
EffectiveExposure,
}

...

// code to extract result from respective property of "h"
decimal result = 0m;
EnumSwitch.Do
(
HoldingField,
EnumSwitch.Case(HoldingField.Holding, ()=> result = h.Holding),
EnumSwitch.Case(HoldingField.BookValue, ()=> result = h.BookValue),
EnumSwitch.Case(HoldingField.MarketValue, ()=> result = h.MarketValue),
EnumSwitch.Case(HoldingField.EffectiveExposure, ()=> result = h.EffectiveExposure)
);

Here is the code for the EnumSwitch class:

  public static class EnumSwitch
{
public class CaseInfo
{
public bool IsDefault { get; set; }
public Enum Target { get; set; }
public Action Action { get; set; } } public static void Do(Enum source, params CaseInfo[] cases) { foreach (var entry in cases) { if (entry.IsDefault || source == entry.Target) { entry.Action(source); break; } } } public static CaseInfo Case(Enum value, Action action) { return new CaseInfo() { Action = x => action(), Target = value }; } public static CaseInfo Default(Action action) { return new CaseInfo() { Action = x => action(), IsDefault = true }; } }


 

Convention by Observation & Intuition

I can't help thinking that "Convention by Observation & Intuition" is a key skill that every developer should have.

After several years working in various different development teams, mostly highly-focused small teams, it seems that an important factor to the success of the team is each members ability to intuit the convention of things based on observation of what the other team members have done.

This applies to simple things such as project layouts, file naming conventions, directory structures etc... In my experience, we generally have little time to document such seemingly insignificant tit bits of information, let alone document fully our creations for the end users.

Maybe larger teams may have the luxury of time and team leaders who are able to produce documentation specifying the conventions to use, but I can't help wondering whether those guidelines are actually read to start with, followed to the letter and enforced.

So I can only conclude that a good programmer needs to be skilled in "Convention by Observation & Intuition".


.net Revolution?

I've been wanting to post something of this nature, but I guess my literary skills aren't quite as well honed as the author of the Ride Out the .NET Programming Revolution article on FTPOnline. It sums up some of what I'd been thinking about .net and programming in general.

In addition to the enhancements and paradigm shifts found in WPF, WCF and LINQ, I can't help wondering whether the simpler more mundane tasks programmers face everyday will ever be "attended to".

Examples of this include validation of variable and parameter values, the data access paradigm (which hasn't really changed at all) and even perhaps built in support for the model-view-controller pattern in windows forms and web pages, better collection classes with set type operations... I could go on...

An example of variable validation can be found in the Ada language when declaring an integer.

    weekDay: INTEGER range 1..7

Here the semantics of the variable are expressed and the necessary run-time checks are "magically" done to ensure only valid values within the range of 1 and 7 can be assigned.

I don't think any of the examples are really revolutionary and perhaps that's the problem. Perhaps some of the examples are too high level or 4GL'ish and thus are not considered for .net languages.

Food for thought...

I'm a DHSC

According to the Doolwind's Game Coding Site my programmer personality type is:

   DHSC

You're a Doer.
You are very quick at getting tasks done. You believe the outcome is the most important part of a task and the faster you can reach that outcome the better. After all, time is money.


You like coding at a High level.
The world is made up of objects and components, you should create your programs in the same way.


You work best in a Solo situation.
The best way to program is by yourself. There's no communication problems, you know every part of the code allowing you to write the best programs possible.


You are a Conservative programmer.
The less code you write, the less chance there is of it containing a bug. You write short and to the point code that gets the job done efficiently.

NQuery - Querying object graphs with "SQL" like strings

I discovered this awesome library called NQuery on CodePlex. It allows you to query an object graph using a SQL like syntax.

This creates some interesting possibilities for potentially writing the same queries which can work against the database and an object graph when caching is employed.

Check it out here. There is also a nice demo application which comes with it so you can test it's capabilities.

Welcome to my Virtual Static Void

After some 10 years of developing, I guess it's time that I started blogging. I'd like to start sharing my experiences and hopefully something good will come of it.

I live in Cape Town and currently work for an international software company. We develop best of breed financial software for asset managers and multi-managers. At the moment I am the project creator/owner of our investment compliance system.

I believe that software in the financial services domain faces challenges which other systems don't have, so my blog, although general in nature, will touch on some of these aspects.

I hope to post at least once a month, so say tuned.