Speaker: David Betz <dfb@davidbetz.net>

As supplemental material to this course you can watch the following videos...

The following book is a critically recommended resource for all .NET developers. It sets for the .NET coding guidelines and requirements.

For Firefox web development (and advanced client-side development in general!), go to jampadexp.net and login to watch my Firefox Web Developer series, which may soon be made public.

Introduction to Service Oriented Architecture (Dec 9, 2005)

In this session we discussed Service Orientation and Service Oriented Architecture. We started out by noting that, as Don Box puts is, object-orientation can get "expensive". and Component-based development can definately help with with certain problems in this area. We also saw how COM really was a component object model and how DCOM is "COM on the wire". Furthermore we noted that we work with COM with interfaces. An interface being the public view of what the COM object provides consisting of a a series of names for the the methods, what goes in to those methods, and what comes back from those methods. We also noted that the interface is at the heart of service orientation.

Next we discussed how COM+ and MSMQ can dramatically add value to your enterprise level application. COM+, otherwise known as Component Services, provides services such as transational support, object pooling, and queued components, which leads to the very powerful concept of MSMQ. We saw how MSMQ is a "send and forget" messaging system that allows you to asynchronously send messages and have them process at a later time followed a queueing model. This leads up to the next concept at the heart of service orientation: messaging.

Technologies based upon service-oriented principles are based upon the concept of a message, while technologies based upon remote procedure calls are more "coupled" with the caller. Even if not physically, there is a logical connection in the design. The message is one of the deepest fundamentals of service orientation, so much so that Don Box defines service orientation as "Message is the medium".

In addition to messaging assisting in prodiving a model with very low logical coupling, services are also said to have low coupling from their stand alone nature. That is, services are said to be autonomous or sovereign. This means that you don't have then "in" your application but as "part of" your architectural design. They are their own entity and aren't owned by another technology per se.

This led up to bring up the modern hot topic of service orientation: web service. Web services are services that reside on the web, expose an interface, and are communicated with via messages. Given this description it's not hard to see how web services are service oriented. The messages in web services are actually XML messages in a format known as SOAP or as it's sometimes called the XML Protocol, of which Don Box was a designer.

Web service interfaces are known as WSDL or Web Service Description Language documents. By obtaining a WSDL document an application has the information required to communicate with that web service, given appropriate rights, connections, and other principle resources.

We further noted that, in the .NET world, web services upgrade about 4x as fast as the .NET framework does. That is, you can think of Microsoft's web service implemenation as being at version 4, with version 5 due to release sometime in late 2006 or early 2007. The original Microsoft web service implementation is reffered to as ASMX. ASMX services provide basic web services appropriate for a wide range of interop. Subsequent versions of web services implement a host of web service standards often called the WS-* standards. These standards, among many other things, include the ability to add transational support and security to web services. The WS-* standards are just that, standards, and therefore have the theoretical ability to interop with consumers who understand the WS-* standards. Microsoft's implemenation of these standards as well as other web service enhancements is known as WSE or Web Service Enhancements. The current version is version 3 as released in November 2005 following the release of .NET 2.0.

Finally, we saw how WCF or Windows Communication Foundation was Microsoft's uniting of various communication technologies into one common programming model. Some of the technologies united in WCF include MSMQ, web services, and .NET remoting. Simply by understanding and implementing the WCF's ABC, a developer not under grasps the fundamentals of WCF, but can quickly and efficiently create very powerful services: A) set an address, B) set a binding, C) state the contact. In the demonstration we saw how, in WCF, IIS is no longer needed to host web services. By simply following the WCF's ABC, we were able to see a full web service hosted by a windows application. Given the uniting of many communication technologies, Windows Communication Foundation can therefore be thought of as Microsoft's service orientation foundation.

Introduction to Web-Standards Development (November 22, 2005)

In this session we covered one of the most important topics on the Internet: Web Standards. Web-standards development, or standards-based development as it's sometimes called, is web development adhereing to the W3C and ECMA standards. Much like how we expect improper C# code to get caught by the C# compiler, in standards-based development, we can expect improper markup to be caught by validators.

Today we saw the history of web standards dating back to the original web. Years ago, web standards ruled the web and this same rule is returning with feice power. We saw how Firefox, the Pheonix, is the promised savior to the Web and how it ushered in the new area for the web awakening a new awareness for web standards in web browser creators. With the advent of Firefox, the world has been propelled into the future even to the point of indirectly awakening a new world we call Web 2.0.

The material goal of standards-based development is to have one programming model which provides websites that look the same, or at least similar, in every web browser. The formal goal of web standards is simple: freedom.

The two principle technologies for W3C-based web-standards development are XHTML and CSS. Unlike HTML, which is an obsolete presentational markup language, and unlike XML which is a data markup language, XHTML is a structure markup language. It provides a nothing more than the structure and content for a webpage. XHTML is XML using an XHTML DTD and an XHTML namespace.

CSS is the visual language of the Web and is the designers code-behind. Just as C# (or VB.NET) is the code-behind for .NET developers, CSS is the code-behind for web designers. Much like the .NET code-behind, the CSS code-behind provides a clear separation which provides a high level of component-level cohesiveness with a low coupling architecture.

The combination of XHTML and CSS is a powerful combination for web developers and designers alike and many great examples of this combination exists on the web. Below is a list of some of the primary internet resources for XHTML/CSS, that is, web-standards development.

Introduction to .NET Data - Part 2 (Nov 8, 2005)

In learning ADO.NET there are various stops you can stop and given how simple ADO.NET is to program against, you can stop fairly early and still be very productive. In this session you were introduced to a new world of data-focused development and were given a strong thrust forward into the future of application development.

As we discussed last time, ADO.NET brings the concept of a dataset, a .NET internal programmic database. We also saw how you access tables as well as rows in those tables by property bags. To us ea properly bag, you really need to know what you are looking for. This can be a problem for many reasons. First, you have to lookup exactly what the column name is. Secondly, there is no help from the IDE. Third, if you misspell something, the compiler will not be able to catch your mistake. Fortunately, however, ADO.NET prodives a concept to help with this: the strongly typed dataset.

A strongly typed dataset provides a dataset tailored specifically for the needs of a particular set of data. To access a table, you no longer use a property bag, but you access the table as a composite object instead of the dataset (i.e. NorthwindDataSet.Orders instead of ds.Tables["Orders"]) The same works for accessing rows (i.e. Orders.CustomerID instead of row["CustomerID"]). Strongly typed datasets allow for a more consistent programming model, full integration into Intellisense, compile-time checking...and of course, great color syntax.

In this session we also went behind the scenes of a previous data-binding demo to see the data-access layer in ADO.NET. One thing we noticed was how verbose the code was. To allow for better code managability, we also saw the same data-access layer created for us by a third party utility called LLBLGen Pro.

This utility provides virtually unlimited power and amazing usability of data-access layers. You simply point LLBLGen to the database, tell it the entities you want to generate and it will generate an entire data-access layer for you. We saw how this dramatically shortened our data-access code from the verbose ADO.NET code to a simple strongly-typed, Intellisense friends, extremely flexible, color-coded set of methods.

We also saw how project LINQ provides for some of the same type of "in code" data access as LLBLGen. Using DLINQ, a developer can access database purely from C# without any third-party utilities. We also saw how LINQ also allows us to do "select" queries on data structures such as arrays.

Support Links

Introduction to .NET Data - Part 1 (Nov 4, 2005)

In this session we saw one of the most important components of the .NET framework: ADO.NET, a .NET developer's portal to the world of databases.

When first learning ADO.NET it's a good idea to learn it in segments. The two most basic segments are access objects and storage objects. Access objects such as SqlConnection, SqlCommand, SqlParameter, SqlDataReader, and SqlDataAdapter give a developer rich database interactivity while storage objects like the DataSet, DataTable, DataColumn, DataRow, and DataRelation allows a developer to locally work with data.

ADO.NET 2.0 brought many improvements to the ADO.NET model. Perhaps the most notable of changes is the promotion of the DataTable to an autonomous object. Work with ADO.NET v1, you will find that you must rely on the DataSet for most of your DataTable interaction. If you wanted to fill a DataTable with a SqlDataAdapter, you were required to fill a DataTable in a DataSet. In ADO.NET 2.0 you can use the SqlDataAdapter to directly fill a DataTable without the need to ever create a DataSet.

When work in ADO.NET you will find that for the most part you will have to rely on specific data providers for your data access. That is, you have to know at the time of coding if you are using SQL Server, Oracle, or another data source. Coding also usually requires hardwiring in the type of provider used. ADO.NET 2.0 brings a new model to the table with the System.Common namespace. This namespace provides a base set of objects to allow you to be more generic in your development so you can specify the database provider later at runtime. So, for example, you would use the DbConnection abstract class instead of SqlConnection or OracleConnection.  This greatly helps with making frameworks more extensible into the future.

Sample Projects

.NET Code Refactoring (Oct 21, 2005)

In this session looked at poorly designed code and provided some refactoring to allow for a more elegant solution. We also looked at a simple home-based application which provided a simple solution to keeping track of website notes. In this same example you were introduced to the concept of .NET serialization.

One of the most important things to remember when moving to a new technology is that that technology may have different technology paradigms than what you are used to. When moving to the .NET world it's important to note that the fundamental paradigm of paradigms is the foundation of object-orientation. In object-orientation for example you never expose private fields and in .NET specifically if you want to expose those publicly, you use properties. In addition to technologies paradigms, the new technology may have new coding rules and guidelines. Development in .NET is no different. Fortunately the rules and guidelines are clearly set stated in a few critically important areas. The first is the Microsoft Designing .NET Class Libraries seminar videos and the second is the official rules and guidelines book written by Krzysztof Cwalina and Brad Abrams. Both of these resources are critical for buidling .NET components. See the top of this page for these resources.

Sample Projects

Introduction to ASP.NET 2.0 Two-way DataBinding and Templating (Oct 18, 2005)

In this session we saw how ASP.NET 2.0 allows you to not only connection an object to a control for viewing, but you also saw that it works in reverse as well. All you have to do is setup a datasource to connection to the object and set the select and update methods. You can also set the delete method. Inserting, however, is not free, this requires a little bit of code. In the method that was demonstrated in the session, the insert controls were places in the grid footer thus requiring us to modify the entire grid to have more control.

This more control was provided by ASP.NET templating. By using templating you can create virtually any grid you can imagine. If you want a textbox column, then a drop down list column and then a bulleted list column, you can very well do that. ASP.NET even has enough information to do all wiringup and updating for you automatically.

Finally we saw how you can use events to attach some sort of life to your ASP.NET controls. For now you should merely accept that the events work, and in fact you saw that. In the future however you will see the mechanics of events and see that they are extremely powerful and used for much, much more than the UI control events that usually come to mind when we think of event handling.

Sample Projects

Introduction to Exception Handling (Oct 11, 2005)

In this session we discussed how you can handle these runtime errors in a cascading manner and even use them to your advantage. The entire .NET universe is based on a set of fundamental principles and concepts which control the entire system. Exception handling is one of these fundamental concepts.

An exception in .NET is basically a runtime error, but the concept has a bit more weight than that. Errors are usually seen as always bad, but exceptions allow you to use errors in a positive and actively productive manner.

Here are a few critical points for library developers and C# architects that we discussed:

  • You use try/finally ten times as much as you use try/catch
  • Never catch and eat an exception. That is, never catch and completely handle an exception. Always let it go through, or rethrow.
  • Never remove information from an exception, either rethrow, add information, or throw a new exception with the current exception set as an inner exception.
  • Exceptions always end in "Exception"
  • System exceptions inherit from SystemException
  • Application exceptions inherit from ApplicationException

It is the job of the As a presentation layer developer, that is, the ASP.NET developer, to finally handle the exceptions so end users will never have to deal with crashing applications or obscure error messages. To this end, you should interpret results to an end user in a way that translates the error into something positive. If the exception was thrown due to faulty user input, then you'll want to translate the exception into a positive message to the use via a status bar or message.

Notes

One thing however to remember is that .NET exception handling is not an excuse to write sloppy code. You should use exceptions to account for exceptional cases like a file missing, incorrect user credentials, a network connection failure, a database failure, an invalid configuration file, or in some cases even invalid user input. You will fundamentally rely on exception handling for cases that you have absolutely no control over. Using them to account for null references, for example, is a cop out and is a very poor practice.

Introduction to ASP.NET 2.0 (Oct 07, 2005)

In this session we saw how ASP.NET automatically remembers page information and how it uses the ViewState to store particular pieces of information about the page. We also saw how the web.config allows us to have a centralized configuration file. We also noted how .NET configuration files cascade. In addition, we saw how ASP.NET 2.0 master pages bring back the simplicity of framesets while leaving their annoyances behind. Finally we saw a quick tour of how databinding and the GridView control can dramatically simplify your data viewing life.

Notes

The promise of ASP.NET 2.0 is to bring a world where current ASP.NET developers code 70% less to provide even more amazing solutions. To an ASP/PHP developer, ASP.NET 2.0 is a shocking new world. It also provides a clear separation between the user-interface and the code behind it.

One thing to note is that ASP.NET is the least important part of all the .NET development we will be discussing. Though it's the first point of contact for users, It is merely the last leg of .NET development and only the tip of the iceberg. The world of .NET under the covers is the 90% to ASP.NET's 10%. Once you learn all the tools ASP.NET brings and master the best practices of the system, you will quickly take for granted many of the thingy you can quickly do and you will be able to focus more of your time on graphic design applications and technologies including Photoshop and CSS design. Because ASP.NET is for presentation developers, not for hardcore programmers, future ASP.NET lectures will have very little coding.

The ASP.NET series is meant for current web developers and the C#/.NET series is meant for business logic and database developers as well as C# architects. It's a very, very poor practice to have someone who is both the ASP.NET/CSS developer as well as the C# architect. Most of the skills that a C# programmer has will have in no way translate to the ASP.NET world. In fact, there could be severe paradigm hindrances which can actually prevent someone from doing both.

As a final word of warning: ASP.NET absolutely assumes that you are a master of XHTML and are very comfortable with CSS. It is primarily based on web-standards development. If you only know the old HTML/Table hacking development and don't know web-standards development then please put ASP.NET on the bench until you master XHTML and feel comfortable with, at least, CSS typography and positioning. Knowledge of CSS layouts is recommended, but given it's power and high learning curve, this more advanced topic can be learned later.

Introduction to Object-Oriented Design (Oct 04, 2005)

In this session we talked about object oriented design very quickly. We covered some ofthe foundational principles of OOD as well as some of the GRASP Patterns which provide more of that foundation.

Notes

The thing to remember about object-oriented design is that it is not procedural design. You do not come at problems with the mindset of "Let's do this then this then this" or "How can I get this done?", but rather "How can I build this?" When you are working in object-oriented design, you are creating an infrastructure, that is, you are the architect of the entire system.

As the term suggests, object-oriented design is more about design and planning than about development or programming. Most of your object-oriented work will be done in your mind, on a whiteboard, in a UML application, in a meeting, or, in the smallest of all cases, on a napkin in a restaurant. Development and programming should be the last thing on a person's mind when a person designs an object-oriented system. In fact, a C# architect should have the entire structure built in a visio-type of application or be able to explain it quiet well before s/he write a single line of code. This is a rule you will hear time and time again. It's one of the golden rules of software design.

Now, as with all areas of life, the fastest way to failure is to be a pragmatist (someone who does what merely works instead of what is right.) Saying "How can that feature help me?", which is an all-too-common reaction (and something I regrettably say every time a new culinary tool comes out), will not help your design process. Not only is this short-termed thinking that belongs to only to an expert, but this pragmatic thought is the seed that creates very rigid, inflexible, and difficult to maintain solutions. The best path to success is to focus on the solution and get there by providing a proper solution, not just one that "gets it out the door". After you have designed the foundations of your structure then you can focus more on integrating it with your current systems.

It is actually easier to teach a new programmer object-oriented design than it is to teach a veteran web developer or a flat VB development the same. "Experience" is a person's worst enemy when learning this new thought structure. The first principle that must be applied when going from one system of thought to another is to realize that you truly are going from one system of thought to another. This is the definition of a paradigm shift. The inability to paradigm shift will not only leave a person useless in the modern world of development and programming, but also in almost every area of life. The law of requisite variety (s/he who is the most flexible is likely to be the most successful) is truly in effect here. Building and infrastructure without clearly and plainly defining the outcome you wish to reach and thinking in the modern way of thinking, will leave, not a neutrally useless solution, but an actively damaging one. So, the ability to come to object-oriented design (and modern web development for that matter) with a tabula rasa, a blank slate, in your mind is critical to being able to provide great solutions in the future.

What's going to happen to the geeky Microsoft programmers? They used to live and breathe C/C++ and would never get near VB. While some of these will continue lower-level work, many of them are being transformed into C# architects. Knowledge of data-structures, algorithms, and other CS type of things is actually very useful in software architecture. The most important piece of any object-oriented design, however, is actually the design process.

Sample Projects

Introduction to C# (Sept 30, 2005)

In this session we briefly went over the particulars of C# and how if differs from other C/C++/Java type languages. We discussed the basic syntax of C# as well as some of the C# structures that you can use. Given this session you should be able to run off and make your own C# console applications.

Notes

I personally do not believe in classes for programming languages. I'm rather of the mind that if you want to learn a technology, you should learn the programming language on your own and that even your knowledge of the language should be taken for granted. That said, I did however want to give a simple introduction to quickly cover some of the pit falls that C# brings for C/C++ programmers. These are very subtle things that you would find in footnotes in books or would be likely to be missed in the course of reading.

Non-programmers who are only familiar with development languages like VBScript and VB may need more help with C-based languages. If you are familiar with ECMAScript or it's predecessor, JavaScript, then you should be good shape though. That said, C#, like Java, C, C++, and almost all other real programming, that is, non-scripting, languages is strongly typed. Those unfamiliar with this may need some more help. Fortunately C# resources are all over the Internet. Microsoft, however, holds to the same philosophy that I do: languages should be mastered and then taken for granted, so you will not find much in the way of C# syntax help on their website (or mine.)

Sample Projects

Abstraction and Servicing (Sept 23, 2005)

In this session you were introduced to the concepts behind abstraction and servicing.

Abstraction is something we were all taught at a very young age when we learned multiplication. At this time we were also introduced to code reuse, that is, in stead of writing 7+7+7+7+7+7+7 we wrote 7 X 7.

We also discussed object-oriented programming at a very high level. The most basic thing we talked about what how the class is the fundamental item in object-oriented programming. A class is a blueprint for an object and classes "inherit" functionality from each other.

Finally we talked about how the service-oriented world is different from the object-oriented world. If OO is about the theoretical and abstract, SO is about applied and concrete. Examples of concepts in the SO world are COM+ ("Enterprise Services"), Web Services, and SOA is a critical component of enterprise development.

.NET Preview Sessions (August 26, 2005)

This session mini-series was somewhat of a seminar-style introduction to the universe of .NET.

The first session was a presentation which explained some of the current problems with development and how .NET provides a single universal solution to most if not all of today's application development problems.

In the second session we dove deep in to the core components of .NET by seeing that .NET is completely language independent.

In the third session, we went to the opposite extreme to see how ASP.NET dramatically simplifies web development.

We also had a bonus fourth session to discuss the power of Firefox and how it can dramatically assist in your web development and ASP.NET development.

Session Appendices