Thursday, December 10, 2009

Unexpected?

Big IT projects fail worldwide:

Are big IT projects doomed to failure? Software systems expert Robert Charette looks at some big failures in the news. Within the last week the UK has thrown up its hands and scaled back the National Health Service's National Program for IT after acknowledging that £12 billion has been spent with little to show for it. That story comes on the heels of a California newspaper investigation that looked at three big state government projects that are are $2 billion over budget, late, and performing poorly.

http://spectrum.ieee.org/podcast/computing/software/big-it-projects-fail-worldwide

Wednesday, December 09, 2009

Ballet 2.0

Tell me that it is not going to be a future classics… LXD

Tuesday, November 24, 2009

Thursday, October 08, 2009

Google Reader anniversary cleaning

No, they not turning 18 this month… It is mine two years of aggregating blogs with Google Reader and I must do the cleaning.

I’ve noticed that with time my list accumulates subscriptions which I rarely, if ever, read. Just one nice post or more often somebody’s recommendation makes me add the blog and nothing else. And it has obvious negative implications: my almost inexistent will-power gives up immediately as I see 200 unread messages waiting. I postpone it and next day additional 200 make it even less encouraging.
Then eventually I come to my senses and invent some kind of system to put away at least. First go those which don’t have new posts within last month (mine would fall in this category more often than not), then those which not interesting anymore (like I’ve lost interest in Joel Spolsky’s internal company news some time ago) and then those which topic lays away from my professional are of interests (that excludes travel and photography blogs, although I neither).

This time I will be doing something radically new – my goal is to eliminate 25% of subscriptions and keep it that way. If new blog comes along – one of the old ones should give it’s way. Unless I soften up and just add it again. Till the next anniversary.

Wednesday, October 07, 2009

Windows 7 Virtual PC

This is a new edition of the developer’s must-have software. Although it is not the only option yet, especially if your Windows 7 machine does not support the requirements for Windows Virtual PC, namely the hardware virtualization. It is good to know that Virtual PC 2007 (with SP1) is still an option, just add a latest hotfix and you should be good to go (note that Windows 7 is still not in a list of supported operations systems).

Surprisingly, the trick with speeding up Virtual PC by running Media Player on the host machine still works, though not to extend of Virtual PC 2007 case.

For those really adventurous, Sun Virtual Box is yet another virtualization alternative.

P.S. Two annoyances I’ve noticed with Windows Virtual PC so far, aside of noticeable slower performance of external (to the VPC) drives: no OS startup screen on VPC restarts and re-login prompt on VPC window resize. 
It is boring to watch a pointless progress bar, while VPC OS is starting behind the screen. My only explanation why they thought it would be a bright idea, is that they all are server folks and see system restart scares a bejesus out of them.
The second one is cured by allowing VPC remember login information during the first start. The screen looks like normal login request and account name is pre-populated with your login name, which makes it slightly misleading. Just enter “different account” info, which would be the VPC OS account. The stored credentials can be cleared through the virtual machine settings and you will be prompted to re-enter them next start. I don’t see much security problem in allowing to store a credentials, unless your VPC is on the external drive (as it better be) – in this case True Crypt is your humble saviour.

Technorati Tags: ,

Thursday, July 09, 2009

BizTalk architecture whitepaper

BizTalk Server 2004: A Messaging Engine Overview is by far the best document in helping to understand the BizTalk.

Despite being written for BizTalk 2004 it is still valid for 2006, 2006R2 and 2009 and makes an especially good reading between taking a First Look at BizTalk 2006 and digging deeper into the details.

Friday, July 03, 2009

Architectural, technical and spiritual videos

From Norwegian Developers Conference June 2009 (Scott Hanselman, Phil Haack, Michael Feathers, Juval Löwy, Rocky Lhotka and many more)

From Øredev conference Nov 2008 (Jimmy Nilsson, Eric Evans and many more)

Thursday, July 02, 2009

WCF thread safety in 25 lines of code

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
public class ThreadSafeService : IServiceContract
{
private int counter;

[MethodImpl(MethodImplOptions.Synchronized)]
public void IncrementCounter(int amount)
{
Mutex m = new Mutex(false);
try
{
Monitor.Enter(this);
m.WaitOne();
lock (this)
{
Interlocked.Add(ref counter, amount);
}
}
finally
{
m.ReleaseMutex();
Monitor.Exit(this);
}
}
}

I dare to say that familiarity with every technique used in this sample would make you comfortable in dealing with WCF multithreading and throughput issues.

Friday, June 26, 2009

Agile family values

The best thoughts taken from the last meeting of Toronto Agile User Group (heard or taken from the air):

In reality client doesn’t need to spend less money – he needs to spend it wisely.

In reality managers don’t need to ship software faster – they need to ship it predictably.

It is all about honesty and trust. Honesty to others and to yourselves: to be ready to admit that everything else is just smoke and mirrors. And to trust others that you can say it out loud without igniting political wars.

Monday, June 01, 2009

Applying Fluent Interface. Part II – fluent validation.

In of the podcasts on Dimecast.Net Derik Whittaker has shown very smart way to address object validation with Fluent interface.

First I couldn’t help myself but notice that “Painfulway Validation” could be replaced with a yield constructs (picked up from ScottGu’s tutorial):

public static IEnumerable<string> Validate (HostEntry hostEntry)
{
if (string.isNullOrEmpty(hostEntry.FirstName))
yield return "First Name is null";
if (string.isNullOrEmpty(hostEntry.LastName))
yield return "Last Name is null";
etc...


Maybe it is still painful to read but obviously less verbose. But anyway that construct is still to be replaced by Derek’s smart implementation.

Thursday, May 28, 2009

Awesome video

Technology is great – this video was shot at speed of 1000 and 2500 frames per second. Some moments look unreal. This small thing is just a taste – go and download the file from here.

 

 

SprintCam v3 NAB 2009 showreel from David Coiffier on Vimeo.

Sunday, May 10, 2009

MS SQL Server: Default database for Windows user

Never ever set custom database as a default for your Windows account. If you drop the DB (quite legitimate operation when updating or scripting it), you will be kicked out of your Server Management Studio session to never come back (not quite true - you still can sneak in but why would you loose few precious nerve cells?)

If you are the same unfortunate idiot as I am - there is a way to fix this. You can do all kind of voodoo stuff from the command line and shell but if you prefer UI, then the first challenge will be to log in to the SQL Management Studio, unless you have a spare admin account at your disposal.

1. Click "Options" button and change database to connect to (because you just deleted your default one).
2. Run the following statement: ALTER LOGIN [server\account] WITH DEFAULT_DATABASE = master
Now your account has a mastr DB as your default (how it was supposed to be from the very beginning).

Monday, April 06, 2009

Disk defragmentation

For me, who have left a part of his heart with XP, Vista defragmentation tool is a sore disappointment. There are may be some clever algorithms behind the scene, but I feel insecure, staring at incomprehensible message "Defragmentation is running. It may take minutes or hours...". Bill's balls! Why these guys slumming me with so much of unwanted graphics, would cut off the actually useful one?!

These are third-party alternatives I found:

1. PageDefrag from Sysinternals. The name is the best recommendation.

2. Auslogic Disk Defrag seems to have good reviews.

Saturday, April 04, 2009

Applying Fluent Interface. Part I - Test Data Builders.

Fluent interface is not as famous of a pattern as the Strategy Pattern but average developer encounters it far more often, sometimes not even realising it. Take C# String object for example: MyString.ToUpper().Trim().Replace("a", "A") – that’s a pretty much daily code.

In a sense Fluent Interface has an application to the state of the object similar to one which Decorator Pattern has to the structure of the class. Some kind of State Decorator Pattern – although the idea of the Fluent Interface is to produce deterministic results, while Decorator potentially could be designed in opposite way (though I can’t think of the reason as yet).

XP Toronto user group hosted “Maintainable Unit Tests” presentation where fluent interfaces were helping to create expandable test data builders (it is a little bit more organized in the Colin Jack’s post).

Imagine, you have Student object

    public class Student
{
public string Name { get; set; }
public DateTime DateOfBirth { get; set; }
public double Average { get; set; }
public Discipline Major { get; set; }
}


and you’re about to build unit tests which will evaluate business rules around any single property and even different combinations of them. Generating test objects may be tedious job which is often assigned to Test Set Up methods. As you progress, you may notice that some of the helper methods are useful between test modules and then you decide to extract this functionality to helper classes, which are evil.


Instead it is better to go the right OOP way and create classes which expose generic functionality and provide us with concrete instances of out domain entities to test.

Essentially it is an implementation of Builder and Factory (or Object Mother) patterns. Every domain entity’s property has a corresponding method in the relevant Data Builder class. Some of the properties, which we are not too much concerned about (like Name in the example) can be simply set to some default values.



 public interface IDataBuilder<T>
{
T Build();
}

public class StudentDataBuilder : IDataBuilder<Student>
{

private DateTime dateOfBirth { get; set; }
private double average { get; set; }
private string major { get; set; }

public Student Build()
{
return new Student
{
Name = "John Smith",
DateOfBirth = dateOfBirth,
Average = average,
Major = major
};
}

public static StudentDataBuilder New()
{
return new StudentDataBuilder();
}

public StudentDataBuilder WithAverage(double value)
{
return new StudentDataBuilder
{
dateOfBirth = dateOfBirth,
average = value,
major = major
};
}

public StudentDataBuilder Taking(string value)
{
return new StudentDataBuilder
{
dateOfBirth = dateOfBirth,
average = average,
major = value
};
}

public StudentDataBuilder Age(int value)
{
return new StudentDataBuilder
{
dateOfBirth = DateTime.Now.AddYears(-value).AddSeconds(1),
average = average,
major = major
};
}
}


Age method deserves a little bit of explanation. Of course, keeping DateTime Date Of Birth is the right thing to do. But from our testing prospective (at the very least) we will be interested in a Student’s current age. If we wouldn’t use the Age method in its current form, we would be forced to mock the Current Date-Time for our test harness, otherwise some of our tests would become invalid with time.

Notice, that in this Fluent Interface implementation the StudentDataBuilder object is immutable. Some other versions pass the same instance throughout all the methods. It may happen, that some testing scenarios can yield weird results in this case so it is better to keep them guaranteed unrelated. In this case we can safely “branch” objects for a different tests:

         StudentDataBuilder sdb = StudentDataBuilder.New().Age(20).WithAverage(95);
Student mathStudent = sdb.Taking(Discipline.Math).Build();
Student bilogyStudent = sdb.Taking(DIscipline.Biology).Build();

Thus with just three lines of code we have two completely independent instances which have some fields identical and some different. Test away!

Tuesday, March 31, 2009

Ajax Controls Toolkit: ModalPopup extender with UpdatePanel

Scenario: show popup (preferably modal) with editable fields in a Master-Detail mode and provide ability to accept or reject update.

Straightforward combination of ModalPopup extender with UpdatedPanel, containing data-bound controls will work pretty much out of the box with few caveats to consider, mainly with OK/Cancel buttons:

1. Place both OK and Cancel buttons outside the Update panel, otherwise when leaving the page you may get a JScript error "Microsoft JScript runtime error: Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method.".
When client-side objects of the Update Panel are being disposed, the cleanup script tries to remove all registered handlers. If buttons are inside of the UpdatePanel, their handlers are still registered as for all child controls by default, but weren’t re-attached during the callback. Obviously, you can spend time and do it properly, but simply re-placing the buttons will do the job while keeping layout appearance unaltered.

2. Now our buttons are outside of the UpdatePanel and we need to make it aware of relevant Click events. So we will have to add trigger to serve the OK operation:

<asp:AsyncPostBackTrigger ControlID="btnOK" />

Same will do for a Cancel operation but it will work just fine (and with less code) by setting ModalPopup.CancelControlID property.

3. In the case of the Cancel button a ModalPopup “window” will be closed automatically but if you want it to be closed after the OK click, you should do it manually by calling the mpMyPopup.Hide() method.

4. If databound controls were changed on a callback then don't forget to call the UpdatePanel.Update() method to refresh the data.

The resulting code is not the most efficient AJAX solution but it provides quite sophisticated business functionality at a reasonable price. Less additional code means less development time and less QA efforts as, if applied right, standard AJAX libraries are pretty robust.

Sunday, January 25, 2009

Quality and seniority

Another good article from J. B. – on a software quality. Similar to the Marxist Law of Transformation the development culture can reach a point at which driving forces behind quality/speed relation switch places: at first, rushing can hurt quality, but as soon as you’ve taken the barrier – increasing quality is able to speed up the development.

And how can we get super-sonic? By nurturing real seniority:

I wouldn’t agree though with necessity of changing employers in order to grow – you can find a place for yourself to be the worst from time to time within same company.

P.S. I like looking at the pictures better than reading and I happy to see that bloggers trying to keep up to par with R.I.P. Kathy Sierra’s blog

Neglecting blog for a good reason

Non-writing can be very easily excused: it may be because you stuck with a give-me-a-mercy-killing company which dries your will out and you sunk in dull routines where imagination is simply not welcomed. It may be a they-are-so-awesome company, which keeps you freaking busy and you just hooked up with all learning they inspire you to engage in.

And you can just be one lazy hog.


© 2008-2013 Michael Goldobin. All rights reserved