ASP.NET and Objects

   

We've been talking a lot about objects in this chapter, and I've mentioned several times that the .NET Framework provides a huge number of ready-to-use objects for you to use when you build web applications. These objects are organized in namespaces.

If you are familiar with traditional ASP, things such as the Request and Response objects will be familiar to you. They are used in a very similar way in ASP.NET. There are also object versions of just about every significant HTML element you've ever used for creating web pages, from simple anchor tags to very complex objects like the calendar object I demonstrated in chapter one.

In the scope of the .NET Framework, objects cascade from general objects down to very specialized objects the deeper you get into the namespace hierarchy. Just like in the barbeque example, the house is a very general thing, but the first or second floor is more specific. And as you go, the directions become more and more specific, down to the top drawer of the dresser where are socks are kept. That drawer has a very specific function in comparison to all the other things in the house. The second floor holds all the rooms within it, as well as the things each room contains.

So out in the root of the .NET Framework, where the System namespace is located, some very basic object classes are contained there, such as the data type objects like System.String or System.DateTime, which aren't linked to any specific task but are used in just about everything.

Then deeper in the Framework you can see objects that are function-specific, such as the HTMLAnchor object that resides in System.Web.UI.HTMLControls. As you can see, the deeper you look into the Framework, the more specific the function an object performs.

So out at the root is the System namespace. This is like the house in the barbeque example. Every other namespace is contained in this namespace, just like every floor of the house every room, every element, and every thing is contained in your house.

For you as a web designer, and for the rest of this book, we will primarily, with a few exceptions, be paying attention to just a few namespaces in the .NET Framework. They are

  • System.Web. This namespace •contains the vast majority of objects that you would use to build your web applications. It contains the objects we will focus on in the later chapters in this book, plus many others.

  • System.Web.UI. This namespace contains nearly all the objects and namespaces, including System.Web.UI.HTMLControls and System.Web.UI.WebControls, that you use to build your ASPX pages.

  • System.Data. This namespace contains all the objects needed for manipulating data and interfacing with databases.

  • System.XML. This namespace is explored later in the book and provides objects for reading, manipulating, and writing XML data.

Tip

You can find a very powerful web application called "The .NET Framework Class Browser" located at the following URL. It allows you to browse the entire list of .NET namespaces, the namespace hierarchy, and the objects contained within in a logical navigable format. When you locate any particular object, it shows you all its constructors, properties, and methods.

http://samples.gotdotnet.com/quickstart/aspplus/samples/classbrowser/vb/classbrowser.aspx


As you continue to explore ASP.NET, you'll dig deeper into objects and discover how the object-oriented design paradigm is really liberating after you can sink your teeth into it. If you are curious and want to learn more about object-oriented design, there are many good books available on the subject, including

The Art of Objects by Yun-Tung Lau. Addison Wesley, 2000.

Design Patterns Elements of Reusable Object Oriented Software. Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. Addison Wesley, 1995.

Please be forewarned that these books are very programmer-oriented, go very deep into the concepts of object-oriented design, and required a bit of patience on my part to follow. They are books that focus on teaching the concept of this programming method and don't have web-specific examples. I simply provide these titles as additional resources if you want to learn more about the concepts of object-oriented programming.


   
Top


ASP. NET for Web Designers
ASP.NET for Web Designers
ISBN: 073571262X
EAN: 2147483647
Year: 2005
Pages: 94
Authors: Peter Ladka

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net