Finding Order with System.Object

I’m working hard to stave off the entropy of my consciousness. One approach is to learn something that creates order in the mind. I’m starting with the .NET Framework (pronounced dot net) Class Library. The .NET Framework Class Library is essentially a library of software for building software. It consists of a hierarchy of namespaces, which lends itself well to creating order. Actually, I don’t think the namespaces are truly hierarchical. They just appear to be. It’s not the actual namespaces that are hierarchical, rather it’s the data types that are organized by the namespaces. The inheritance pattern of the data types creates the relationships between namespaces.

The System namespace is often considered the top namespace. In a sense it is the top because all data types inherit from the System.Object data type. In other words, all the data types in the .NET Framework are children of System.Object. For example, the string data type (System.String) inherits from System.Object. So the hierarchy looks like this:
System.Object
  System.String

Everything to the left of the last period is the namespace. The word at the end is the data type. Consider the data type Font. The fully qualified name is System.Drawing.Font. The namespace is System.Drawing. The inheritance hierarchy looks like this:
System.Object
  System.MarshalByRefObject
    System.Drawing.Font

Notice that there’s a type in between System.Object and System.Drawing.Font. It’s easy to think that System.Drawing is a sub-namespace of System, until you see something like this. Here’s another good example:
System.Object
 System.Web.UI.Control
  System.Web.UI.WebControls.WebControl
   System.Web.UI.WebControls.Panel
    System.Web.UI.WebControls.WebParts.Part
     System.Web.UI.WebControls.WebParts.WebPart
      Microsoft.SharePoint.WebPartPages.WebPart

A Web part (in ASP.NET) is a kind of Panel, which makes sense when you think about. Panels are things you can turn on and off and use as containers for other controls. Web parts in SharePoint are a kind of ASP.NET Web part. That last data type – Microsoft.SharePoint.WebPartPages.WebPart – isn’t part of the .NET Class Library. It’s part of a Microsoft server application called SharePoint. And there are specialized kinds of Web parts in SharePoint that inherit from WebPart.

As you can see, it’s very complex but also very simple. It all starts at System.Object.

Advertisements

2 Comments

Filed under Uncategorized

2 responses to “Finding Order with System.Object

  1. Hey, I’m starting a .NET job in January! I have only a little experience with it (doing VB for a class) so I’m sort of learning it too.

  2. That’s cool. I’ve been working with the .NET Framework since 2003. Similar to you, I got only a little bit of experience in school with VB.NET. I’ve only used C# on all my production projects.

    In my school, we were discouraged from putting too much effort into a single language. We were instead supposed to focus on learning “how to program”. While it’s important to understand fundamental programming constructs, at some point you just have to pick a language and dig in.

    I’m starting with the .NET Framework Class Library because it’s the fundamental underpinning for .NET development. I also think that learning the namespaces and major classes of .NET will help with my understanding of object-oriented programming – another subject that was only briefly touched in school but is used quite extensively in production development.

    Learning the .NET Framework Class Library gives me something I can turn over in my mind when my mind goes idle. Actually, it doesn’t really go into idle. It’s more accurate to say that it descends into chaos and disorder. So for me the .NET Framework Class Library is a mind game.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s