Scary times ahead

With the recent down turn in the economy, companies are starting to layoff workers to save a few bucks. Which drives home the point for me that it does not matter who you work for or what you do, being let go is always a possibility. As software developers, we should never stop improving and learning. While that may not prevent you from getting axed, even if that happens, you will leave as a better developer and take away with you all the experiences that you've learned, and should land on your feet just fine.

So never stop learning, improving and making yourself better. And you would never have to be afraid in times like these.

Becoming a better developer:
http://www.softwarebyrob.com/2005/07/02/betterdeveloperpart1makingfans/
http://www.eecs.harvard.edu/~ellard/libsq/ref/style.html

Version Tolerant Serialization

At times you may need to update your objects and add additional properties, and maybe you still have old clients that consume your objects, so you will need to update your objects in a way that makes it backwards compatible. That's where Version Tolerant Serialization comes in.

Let's say you have an object with one property. You add a second property called "MyProperty2", and the change needs to be version tolerant. You can implement ISerializable and do this:
public void GetObjectData(SerializationInfo info, StreamingContext context)
    {
        SerializationInfoEnumerator serializationInfoEnumerator = info.GetEnumerator();

        while (serializationInfoEnumerator.MoveNext())
        {
            switch (serializationInfoEnumerator.Name)
            {
                case "MyProperty":
                    MyProperty = info.GetString("MyProperty");
                    break;
                case "MyProperty2":
                    MyProperty2 = info.GetString("MyProperty2");
                    break;
                default:
                    break;
            }
        }
    }
You can also implement IDeserializationCallback to default your new property.

Of course if you are using .NET 2.0 or above, you should use the OptionalField attribute to mark your new property as optional.

    [OptionalField]
    private string myVar2;

And you can use these attributes to control your serialization:

    [OnDeserialized]
    [OnDeserializing]
    [OnSerialized]
    [OnSerializing]

VS 2010 and CHESS

Can't wait to play around with the new Visual Studio 2010. There are some cool stuff coming, including a concurrency troubleshooting tool called CHESS. Many a times, I've felt like I was at the edge of insanity trying to track down a concurrency bug. This tool may come in handy.

From Microsoft:

CHESS:
CHESS is a tool for finding and reproducing Heisenbugs in concurrent programs. CHESS attaches to a concurrent program and takes complete control over the thread scheduling. This allows CHESS to drive different runs of the program along different schedules. On finding an error, CHESS can replay the erroneous interleaving tremendously reducing the effort required to reproduce concurrency bugs. In addition to assertions in the program, CHESS can find deadlocks, livelocks, and dataraces. CHESS is integrated with the Visual Studio Team System (VSTS) and works for both managed/native programs.

CHESS has been applied to several Microsoft products, such as PLINQ, TPL, ConcRT, CCR, Dryad, and Singularity.

«November»
SunMonTueWedThuFriSat
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456