Follow @RoyOsherove on Twitter

Joining The BCL Types Wagon + Confession

Hmm. Ive been reading some of the latest posts discussing using BCL type names and not intrinsic language type name (i.e 'System.String' vs. 'string' etc.). I'll admit that up until now i have not used that philosophy in my *ahem* writing, Yet i totally see the rational behind it and will start using it consistently.

Some of the main reasons for not adopting it up until now have been few and petty. For example - I saw mucho ugliness in writing 'Int32' instead of 'int'. Somehow , this always (still does) seemed LPCSTR'ish to me. I've been programming in VB6 for most of my career and even though ive been using Win32 API's and getting into a little C++ here and there - I never liked its cumbersome notations  and ugly coding style. As the guys over at .Net Rocks love to say - "C++ is a Write-Only language, C# is a read-Only Language and VB.NET is a Read-Write Language." I agree with the first part. Thats exactly the reason my puny mind sees anything that looks C++'ish and begins to rant on and on... and Int32 is a classic candidate for this kind of ranting. Thinking about using this type name all over my code gives me the creeps. Looking at a full blown source code written by somebody else, with Int32's spread all over the place - in first glimpse - has the "shadow of the pointer" in it - meaning I start wondering "OK, Where are the pointers in this code? It sure looks like C++.."

"Enough! it's only Int32 for god's sake!" you say. Yes. But there's more (prepare - more stupid reasons ahead). Another reason i never even tried using BCL type names in my code was that the first examples and source code I've read that utilizes .Net code used BCL type names in full notation  meaning 'System.String' and 'System.Int32' instead of just String and Int32. Now that's scary. I thought to myself "Hmm, I have the choice of either writing these long-winded type declarations, or just writing 'int' or 'string'. hmmm... yah. I'll use the latter!" .  Later , When it was already evident that you needn't write these verbose declarations as long as you wrote your little 'using System;' at the top of the file, it was too late. The habit had already stuck with me.

I think there were more reasons, but i can't remember any (+ fear of looking really stupid and petty). I wonder -

1) Are there others who felt(or still do) the same way?

2) Should a person really spend 20 minutes writing about using or not using BCL types ? Is everything else in the world dead?

3) How many people read this?

Config Hell - continued

Config Hell