Tuesday, February 23, 2010

8-)

As I read through .NET Book Zero and cross reference the MSDN .Net FCL documentation I find myself smiling often and occasionally chuckling. I had not expected this. Yes, Petzold has an amusing style but really it's more the delight of discovery that brings all this forth.

It is clear to me that the architects of C# and the FCL have OO in their blood. Not only that, the functionality found in the FCL is a testament to collective knowledge and experience in developing software solutions.

int is a instance of the System.Int32 struct, for example, and is rich in the functionality of it's members. Likewise, string, and instance of System.String. C# has put logic and functionality under the hood of what verteran C programmers might consider data value types.

Again... everything is an object. Even any classes or structs that I might define are all derived from System.Object. The C# language uses the word object as an alias for System.Object. So this method: System.Object.ToString is the same as object.ToString is the same as myObject.ToString (overloaded notwithstanding).

It makes me smile. 8-)

Monday, February 22, 2010

Print resources

When learning something new I often find it useful to simultaneously use several references. As though I can better understand what is in that Black Box by looking at it from different points of view. Some points of view I currently find useful include:

Properties, like intelligent value types

So, within a C# class, along with methods and data, we can define "properties". My first thought about these was that they were analogous to what I understood to be accessors methods in C++. To enable encapsulation the data in a class could be marked as private and any attempt to change it or read it would be done through one or more accessors. Yes, C# properties are are like that but the language syntax permits you to use a property just like you were using a value type.

class TheData {

private int m_privIntValue; //data cell not visible/accessible outside of class/object

public int IntValue { // the property to access/manage the data cell
get {
return m_privIntValue;
}
set {
if ((-100 <> value)) //logic can be placed within a property method
m_privIntValue = value;
else
Console.WriteLine("Must be between -100 and 100!");
}
}
}


So, in my program, if I have instantiated an object from TheData:

TheData myData = new TheData();

I can simply make assignments:

myData.Intvalue = 11;

or use it like a value type:

int x = myData.IntValue;



Beginner's Mind

"In the beginner's mind there are many possibilities, but in the expert's there are few." - Shunryo Suzuki-Roshi

I have made the decision to pursue developing an understanding of new software technology. Goodbye to aged C and Unix, I turn my attention as a beginner to Microsoft's .NET platform aspiring to develop proficiency sufficient to earn some certifications. It's my plan to leverage the certs in pursuit of employment. Official training starts next month... but I can't wait. So I have been digging into the very most top layer of the enormously wide and fabulously deep .NET platform by scratching at the surface layers of it's native language: C# ("see sharp"). Aside from absorbing syntax, the language is fundamentally Object Oriented. Everything is an Object. And most every tool one might consider using has been implemented in the vast .NET Framework Class Library (FCL).

.NET is intriguing. .NET is deep. I accept that I am a beginner only wading at the shallows. I accept that this is a reboot. It's a soft boot because I have memories of writing modular code in a procedural language - but it is a reboot all the same.

I begin the journey writing console programs, no windows, editing my source files with vi. (Unix habit, I like the editor!). For tutorial I am working through C# Station web site.