Going Native
Not sure if the new excitement is going to stick. However it seems like more frequent C++ language updates are planned for the future. I am hearing more and more about the upcoming C++14 changes. And there is even remote noise regarding C++17.
This is only natural. Java always seems to be having updates to the language. But one thing I don't seem to hear much about is advances in the C# programming language. Yeah there might be some new ideas for .NET technologies. But the C# bandwagon may be abandoned.
The TestApi
TestApi is a library of tools to assist with testing software. One of the tools that comes with it are Fault Injection routines. Fault injection is the process of deliberately putting errors in an app to see if they are handled gracefully.You can use fault injection to test those hard to reproduce situation. You know the kind. They are the exceptions that only happen once your app has shipped to production.
The two key pieces to TestApi are the "TestApiCore.dll" file, and the FaultInjectionEngine folder. One last note is that fault injection is different than mutation testing. In mutation testing you put an error in you app to see if your unit tests pick it up.
Good luck with your testing. I am currently in the design phase of the software development life cycle. So I don't have a lot of hands on testing just yet.
Entity Framework Tricks
The Entity Framework allows the developer to create a model against which the programmers do queries. The Entity Framework then translates these model queries to SQL against the actual data store.In the end, the Entity Framework is generating your typical database commands such as insert, update, and delete. But hey. You want to lock down such real database objects to ensure they remain consistent.
The tried and true method to lock down your database is to require all access to go through stored procedures and views. The good news is that you can train the Entity Framework to do just that.
The Entity Framework does not need to go against base tables. It can run against views. In fact, you could even create some views that are identical to the base tables. Good stuff.
Running Zork on .NET
Remember the Infocom games from the good old days? I am talking about games like Zork. Well there is an Infocom game interpreter called Frotz out there. It allows you to play Infocom games on modern day PCs. Frotz is written in the C programming language.Well guess what? Frotz has been ported to C#. It now has a WPF front end as well. This thing needs the .NET 4.0 runtime to work. I just read a blog post that some guy tried this newly ported interpreter, and had Zork I up and running fine. This sounds like good stuff.
Silverlight Media Framework
Microsoft has an open source framework called the Silverlight Media Framework, or SMF for short. It is a framework for video. This allows you to create your own media player. Cool stuff.SMF makes use of the Smooth Streaming Player Development Kit. This additional kit is not open source. You create your own Silverlight project. Then you use SMF and this kit within it.
The technique is to inherit from the SMF player. Then you extend the capabilities as you see fit. Settings are downloaded from a server via an XML file. Check it out.
Complaints Against Microsoft
Let us all admit Microsoft’s goals for the .NET framework. They want to go for the enterprise market. They target high end systems. This is the same market that Java is going after. Some people are not happy with how Microsoft has been proceeding with expanding the .NET framework.
On a positive note, .NET provides you with great plumbing. But it seems as if Microsoft is not collecting feedback from users and developers when deciding the new things they are adding to the framework. There are also complaints that .NET is becoming very bloated.
Take the ADO.NET Entity Framework for example. This is an object relational mapping. It is now Microsoft’s recommended data access solution. People think the database layer is big, maybe too big. What happened to support for LINQ to SQL? Developers want to spend time learning and using technologies that will stick around. Microsoft needs to keep an ear on the developer community.
MEF
I want to talk about this new Managed Extensibility Framework (MEF) idea. It is a library that ships with the .NET Framework 4, as well as Silverlight 4. It allows third parties to extend systems after they are deployed.
There are other technologies which implement the same thing. These include Enterprise Java Beans, Corba, Spring, and the Component Object Model. However some of these competing or legacy technologies are heavyweight. The competitors may also require a lot of developer work.
Let us discuss some of the MEF terminology. A part provides services to other parts. An export is another name for a service. An import is the service that you part uses. And a contract is an identifier.
MEF comes with an attribute programming model. You can achieve the import using constructors. That is called constructor injection. All part instances are currently implemented as singletons. Finally there is a “lazy” framework where instantiation is delayed until the value of the object Is accessed.
.NET 4

Silverlight 4 is set to come out towards the end of 2010. It will get access to the Component Object Model in the next release. This technology is Microsoft's weapon to combat Adobe.
Last time .NET was upgrade to include Windows Presentation Foundation and Windows Communications Foundations. Then a minor update added Language Integrated Query (LINQ). All the good new technologies coming out of Microsoft are part of .NET.
Microsoft is getting into the component market. Silverlight 3 contained over 100 new controls with it. This has given consultants something to sell to their customers. Such consultants have custom tool sets to sell. Third party control manufacturers are hurting though.
F-Sharp
Microsoft continues to offer the F# programming language in Visual Studio. This relatively new language incorporates functional programming with the existing object oriented language features. The language supports multiprocessor machines. It also supports preemptive multitasking.F# is a strongly typed language. It has a number of features that have not made it into other .NET languages like C#. However developers have not flocked to the new language in great numbers. If you do specialized parallel programming projects, F# might be for you. Otherwise there may not be a strong reason to try out this new language.
ASP.NET MVC 2.0
ASP.NET is starting to get old. It seems that just the other day it was taking over where classic ASP left off. Well now there is another twist on an old technology. It is ASP.NET MVC 2.0.The MVC stands for model view controller. It is a web framework that is compatible with both Visual Studio 2008 and 2010. This technology is an alternative to using web forms.
Don't fret if you are a web forms programmer. That technology is not dead. But ASP.NET is getting a face lift. Leave it to Microsoft to keep the technology pace moving quickly.
Mono Tools
Mono is an implementation of Microsoft .NET for Linux. To be exact it implements C# and the Common Language Runtime (CLR). These implementations are compatible with .NET. A new add-on to Visual Studio 2008 called Mono Tools has now been released. It allows a developer to target Mono apps for the SUSE Linux distribution. It falls into the broad category of cross platform development tools.Mono Tools are available at different price points. An individual license costs $99. It is good for a single person. The enterprise license costs $245. It allows one person in your organization to use the product. However the license can be transferred between developers in your organization. Finally there is a five seat developer license goes for $2499.
There are plans to enhance Mono Tools to target other Linux distributions. Here is a tip if you decide to buy a copy of Mono Tools: You need to close Visual Studio before you start the Mono Tools install. Enjoy all you Linux .NET folks.
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.
ASP.NET
I read an article by Rick Strahl called “ASP.NET Gets No Respect”. Rick stated that ASP.NET offers great flexibility. He said it can be done easily. And although the framework is big, the model is clean. Usually a single machine can handle the load. You don’t need to do load balancing. People call ASP.NET both slow and insecure.The competing technologies for ASP.NET are PHP, Python running on Apache, and LAMP. A downside to ASP.NET is that it is not free. You have to pay for Microsoft Windows. Most big sites do not use it. However some popular sites like MySpace, Dell, and CareerBuilder do.
Rick did say that you need to make a large up front investment in learning to do ASP.NET well. There was a lot of excitement when ASP.NET first came out. However it has been stagnating ever since .NET 2.0. Other areas in .NET such as WCF, WPF, and LINQ are hot now. But ASP.NET is just not a hip technology. You normally do not see startups using it. Microsoft is, however, very popular in the enterprise.
There were a lot of comments to Rick’s article. Some commented that Microsoft does provide support. But PHP is much simpler. A few people argued that they had to reboot their servers when they ran ASP.NET applications. Others complained that Visual Studio is just plain slow. There were a whole lot of other complaints, mostly about Microsoft.
Some web developers on my team use classic ASP for the web sites they run on the side. They seem pretty content. However I do see these guys having to reboot their servers sometimes when things go awry. They also get their customers to pay for the Windows Server operating system and hardware. So perhaps this is not a fair comparison. I can say that I have neither any experience with classic ASP or ASP.NET. I am really not a web developer. And for work I suspect I may have to go the Java route based on the client’s decision. I still wanted to talk about ASP.NET a little bit today though.
