Review of .NET

I read an article in some rag called The Register. I got the feeling this is a British newspaper. But I am not sure. The article reviewed the rise of .NET and whether it achieved Microsoft's goals. I thought I would discuss some of the point brought up by the article.

It has been almost ten years since .NET first came out. This was a major shift in the Microsoft Windows platform. We were coming off Active X controls and the MFC framework.

.NET brought the common language runtime, as well as the new C# programming language. The base protocol used was XML. The goal was to combat Java from Sun Microsystems.

If you look at the programming language landscape today, C# is a success. A lot of people use it. More importantly, there are many jobs which require C# experience. One thing that is a bit disturbing is that Microsoft it not eating their own dog food. They don't seem to be using .NET for developing their own products.

The article concludes that .NET is positioned for the business app segment. This is the industry I work in. So it is a shame that I am not hot on the latest technologies in .NET. Time to study up.

Entity Framework

The ADO.NET Entity Framework (EF) is an existing object relational mapper (ORM). Unfortunately the version that came out with the .NET Framework version 3.5 got a lot of bad press with developers. Microsoft is going to release the next generation which they are calling EF4.

EF maps .NET objects to the database. The idea is that your database can change, and the EF mapper can protect your application from having to deal with these changes. EF is a competitor of the NHibernate product. NHibernate is an open source alternative. It is a surprisingly good implementation of an ORM.

Developers can use EF4 to help code web services. While EF4 may still not live up to the NHibernate standard, Microsoft is positioning EF4 as the main ORM.

ASP.NET 4.0

Microsoft has two main frameworks to do web development. The older one is the ASP.NET web forms framework. The newer is ASP.NET MVC. Let’s start with the older. The latest changes to ASP.NET web forms makes it easy for HTML to be styled using CSS. It also changes how easy it is to control the identifiers created by the framework.

Now let’s talk a little bit about ASP.NET MVC which is new for version 4.0. This framework in general has been designed to make it easy to test web apps. Big projects can be broken into pieces called areas. The developer divides the project up logically into these areas.

This is just a taste of new things in ASP.NET version 4.0. I am getting into web development myself. When I use the Microsoft tools, I might get heavy into ASP.NET. At that time I will continue to share my findings.

Introducing NHibernate

Hibernate is a popular Object Relational Mapper in the Java world. Now there is a port for .NET called NHibernate. Like Hibernate, NHibernate maps .NET objects to the database. It is licensed under the LGPL. In other words, it is free. This is becoming a popular method for .NET web developers to interface with a database.

NHibernate works just like normal desktop application persistence technology. As such, there is a tendency to have one global session for your whole application. However .NET experts recommend that you keep session lifetimes down at the transaction level. This will cut down on memory leaks as well as other problems.

Note that the NHibernate session is not exactly the same as a database connection. This session is managed by the NHibernate framework. Actual database connections may come and go with one NHibernate session.

Here is a peculiar fact with NHibernate. You have to make your class members virtual. That applies to all members. You should also be aware that the time for NHibernate to start up is long. Yes I know. That is no fun. So kick the NHibernate stuff off to a separate worker thread. Just recognize that NHibernate is not thread safe in the sense that two threads cannot access the same NHibernate session at the same time.

That’s all for now. Next time I want to revisit ASP.NET 4.0.

Object Relational Mapping

Object Relational Mappers (OR/Ms) seem to be a hot topic these days. The mappers connect object and database models. The actual mappings are defined in XML format. Microsoft currently has two OR/Ms available. The first is LINQ to SQL. The other and newer one is ADO.NET Entity Framework.

There are some difficulties with both of these OR/Ms. The tools generate objects with names that match the corresponding database entities. This is not what developers always want. A further complication is when the database names change after the object model is generated.

If you use LINQ to SQL, and the database name changes, you must get rid of the previously generated object entities. Then you must regenerate them to match the database updates. That is a clunky mechanism. In the past, my team has encountered a lot of pain to manually update object models when we used other OR/Ms.

I plan to write about this topic more deeply in the future.

Version 4

I am now a subscriber to the MDSN print magazine. My first issue discussed a number of new tech offerings from Microsoft. These include the.NET Framework 4, ASP.NET MVC, and ASP.NET AJAX 4.0. While researching these topics, I also came across information on new ASP.NET 4 core services. I will briefly cover all of these areas today.

The .NET Framework 4 has a number of modern facilities. It has support for parallel computing like PLINQ. It also includes lambda calculus support (functional programming). Code contract is supported in this release. Code contact programming is an advanced method of assert programming. Finally there are a number of new programming languages supported like F#, IronPython, and IronRuby. The last two are the .NET versions of the popular Python and Ruby.

ASP.NET MVC is to be used for building web applications. It makes use the of the model view controller pattern. This is an alternative to ASP.NET Web Forms programming. One major goal of ASP.NET MVC is to be very testable. That means it was designed to be used with Test Driven Development (TDD).

ASP.NET AJAX 4.0 contains support for data driven web applications. You can do live data binding. You can also make use of the DataView control. ADO.NET data services can be employed. You can also make use of the Observer design pattern.

ASP.NET 4 has many upgrades to the ASP.NET core services. These include a new auto start feature. It allows you to initialize an application pool before accepting the first HTTP request. It also supports a true HTTP 302 redirect. There are new configurable URL size limits instead of the old hard coded 260 characters. You may set a flag to enforce validation of cross site scripting (XSS). Finally you can perform data access directly from the client in the web browser.

The Maestro Language

I have heard the rumors about a new language from Microsoft called Maestro. It will be for use with the .Net platform. This language will be specialized for parallel programming. The goal is to make it easy for programming to do parallel processing without spending much time on that aspect.

Components in Maestro will be isolated from each other. Therefore a large part of the language will deal with message passing. The language will have access to all of the .Net framework. However it won't be meant as a stand alone language. Instead it will be used in tandem with other .Net languages.

Maestro is still in the early phases of development at Microsoft. You will not hear a lot about it for a while. Doctor Dobb's did an article on it. Or at least they interviewed a guy from Microsoft about Maestro. Some have determined that Maestro looks a lot like the Erlang programming language. The Maestro development team begs to differ.

Silverlight 2

Microsoft has recently released Silverlight version 2. It is a rich Internet application (RIA) platform. This platform is a subset of the .NET framework. It has the goals of being able to enable media and RIAs. The stated benefit is the ability to leverage existing .NET skills that developers have.

The Visual Web Developer Express IDE is currently a free offering from Microsoft. It supports Silverlight development. Developers are free to use any programming language with Silverlight.

Currently the supported browsers are Internet Explorer, FireFox on the PC and Macintosh, and Apple Safari. Linux browsers are suspiciously absent from the list. There is hope for the Linux community however. The Moonlight project is Silverlight version 1 running on Linux.

The majority of developers use AJAX for RIA purposes now. However that is a primitive option. It also forces you to write complex code which must run on the server for the design to work. Besides, Silverlight has a cooler name than AJAX.