Sunday, March 28, 2010

Installing Life or Uninstalling it?

But now I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth”.

It’s astonishing to discover how many of us are existing without doing the most imperative thing in our life – living! Bizarre, but true, don’t know if anyone of you have observed it, but we (most of us, if not all) suddenly have become enclosed and to some extent aggrieved by the toxic environment encompassing us. And before you start dwelling into the Go Green initiatives, I must declare, this is not about carbon footprint, greenhouse gases or for that matter, earth hour! We are no longer happy (attempts to inherit virtual happiness have failed time and again).

The global economic downturn certainly triggered and aggravated it, but to solely blame it and move on would be an under-observation, indisputably leading to a lethal mistake. A quick glance down memory lane would bring back what now has become the epitome of happiness. School and/or college days, once sloppily spent, have now become desperately desired. Most of us would agree, we all were passionate about our to-be jobs. Why are we then loosing what’s called life – the intrinsically simple phenomenon of enjoying atomic moments sans dependencies?

At the time of inception, happiness, in general was supposed to encompass monetary capacity in general and fulfillment of passion, in particular. Most, if not all of us, have reached a point whereby the monetary fulfillment is somewhat achieved (before you start shouting no ways, ask yourself how much was the first paycheck that you got and how satisfied you were with that and what do you draw today), if not surpassed. What went missing was that flare, that passion which in the first place drew us to what we are into today.

For you Mr. Reader who is still figuring out what this post is all about, let me decompile the above LIL (Life Intermediate Language) code for you. It’s about our (you are allowed to exclude yourself if you so consider) inadequacy to achieve something simple, something atomic – a sensation called happiness! Every other disremembered friend I encounter nowadays seems to have a problem (the dictionary meaning of which is a state of difficulty that needs to be resolved). And regardless of the gravity of his problem, he simply wishes to resolve it! The keyword here is wish (the dictionary defines it as an expression of some desire or inclination), and also consider that one is wishing for the problem to be resolved and not making earnest attempts to do the same. My intent here is to express the undeclared, catastrophic phenomenon that is taking away life as it exists in the purest acceptable form, from most of us.

What follows might be considered a litmus check that attempts to compute whether you are missing life or living it.

If you don’t find yourself reacting yes to most of the points below, then must say
Houston! We have a problem!”

1. Do you like your company? (Intellisense suggests like as find enjoyable or agreeable)
2. Do you like to work with your immediate superior?
3. Do you like the people adjacent to you?
4. Do you like your day-to-day work?
5. Do you have time for yourself at the end of the day?
6. Do you spend adequate time with your family?
7. Do you have a private domain to cater to? (no Intellisense for this)
8. Do you think your current professional step would lead you to your esteemed destination?
9. Do you consider yourself to be adequately skilled and improving on a routine basis towards your desired level of expertise?
10. Do you believe in yourself and your aptitude to change the tide in your favor?

Shout out your Yes scores in the comments section, would be prodigious to know!

The programmer in me couldn’t resist myself from injecting some code (dependency injection?) into this post, so here we go.

The LINQ query for the above resulting questions could look something like this:

var query = from Moments in Life
where LifeTime != Timespan.Future
select Moments
order by gravity descending; //vital criteria appears first
query, in this case would be an IOrderedQueryable<Life> and not an IQueryable<Life> (I am just venturing into LINQ, so do bring out the compilation errors and/or warnings in the code above).

Happy living and for that, Happy coding too!

Sunday, March 14, 2010

Awaiting .NET 4

The .NET Framework version 4.0 is slated for release in April 2010 and everyone seems to be excited about it (everyone by definition includes everyone, so me too). Being the next big release of the framework, there exists number of enhancements and fusion of several new ways of writing old and new smart applications.
I sat down searching for what’s in it for me, the conventional (it’s the most reputable word I could afford for myself, corollary to calling bugs as exceptions) .NET developer for whom writing .NET code is not only about developing cool new smart applications (hardly get to do it thanks to the huge number of legacy and combo apps we need to upgrade day-in day-out) but also write that enlightening code quickly and smartly.
I have made an honest (as if honesty still exists?) attempt to compile what I felt was just so super cool changes to the framework or language in general. Let me #warn you not to expect the entire v4 enhancements from the lines that follow. That won’t ever happen (if I could do that MSDN would be hosted at my local desktop, right?).

1. StringBuilder.Clear(): I was surprised to see this as an addition to the v4 version, as all this time I had expected this member function to be omnipresent in the StringBuilder class (going by the superior and smart design of the .NET framework). Just recently while using it for dynamic html generation (I was using VB9 and still didn’t use VB XML Literals for some bizarre reason, which is indeed classified), I found the absence of this method. The workaround was setting the Length property to 0 which would then clear the contents of the StringBuilder object.
2. String.IsNullOrWhiteSpace(): As is eminent from the name of the method, it checks not only the Null or Empty content of the string object but also helps avoid the use of the Trim() method to make certain we don’t end up with a string of precious whitespaces. An authentic admittance though, I already had added my own extension method in my v3.5 extension methods repository that did verify the absence of both Null and Whitespaces before performing any further string operations and was aptly named String.HasValue(). I am indeed smart (I always knew this, but formally broadcasting it on this DateTime.Now).
3. ServiceProcessInstaller.DelayedAutoStart: While developing Smart Client applications it is a very common requirement to register the application to launch on Windows startup. However, as is eminent, too many applications loading on startup will upsurge the boot time significantly deteriorating the end user experience. This feature comes to the rescue by delaying the start of the application until all other auto-start services have already started.
4. SMTP Client enhancements: Some of the enhancements include enabling SSL mode in application configuration files, specifying heading encoding and most importantly, multiple replying to addresses through MailMessage.ReplyToList().
5. Guid.TryParse(): The TryParse method has now been added to the Guid, Version and Enum types and behaves exactly as its counterparts in other types.
6. 64Bit enhancements: Recognising the mainstream adoption of 64 bit systems the Environment class has been decorated with: Environment.Is64BitProcess and Environment.Is64BitOperatingSystem.
7. IEnumerable<T> everywhere: New overloads of String.Concat() and String.Join() now support IEnumerable elements so that you don’t have to convert them to strings prior to performing Join or Concat operations on them. Also enhanced are several System.IO members like the new File.ReadLines() which returns an IEnumerable<String> rather than a string array. This in turn gives superior performance benefits as its always (read mostly) desirable to read a file one line at time rather than loading the entire content in memory as in File.ReadAllLines().
8. Corrupted State Exceptions: How many times have I written the following?
// Something that should fail, or else why did i incur this try cost, right?
catch(Exception ex)
// Never do anything here. Let them come back to me for fixes (guarantees job security)
In .NET 4.0, corrupted state exceptions will never be caught even if you specify a try… catch block. Even though this is a huge obstacle (a setback or even a crisis) on my attempts towards my job security, yet I welcome it as it encourages writing more stable (in theory) code. Before you start depreciating your intentions to upgrade to .NET 4 for this particular reason, there is a switch that allows you to get the old behavior back by setting the following attribute LegacyCorruptedStateExceptionsPolicy=true in the config file.
This behavior can also be enabled on individual methods with the following attribute:
9. System.Data.OracleClient: Before you plunge into thinking why MS shelled it’s resources to enhance OracleClient, instead of their own franchise SQL Server, there is a surprise awaiting you. OracleClient is available in .NET 4 but marked as deprecated. Don’t believe me? No need to, just help yourself by visiting .
10. VB Auto Implemented Properties and C# Named and Optional Parameters: These are some of the language specific enhancements essentially following Microsoft’s strategy of co-evolving the two languages.
VB now has auto implemented properties thereby reducing the amount of code generated significantly (I hated VB Dev Center for not introducing it in VB9).
C# developers now stand equal by having named and optional parameters (which to me should have been there at least since v2 of the language).  

The list above was never meant to be exhaustive, it does not even attempt to touch the Parallel computing extensions and dynamic (or functional) enhancements to the framework, but it surely addresses most of us, the conventional .NET developers, writing managed code that manages our company, our clients and primarily us!

Happy Coding!