Heading to VSLive

Next week, I’ll be heading to VSLive.  The pre-conference workshops actually begin Sunday, March 30, but I will be arriving a few days early for a short vacation with the family for Spring Break.

If you are going to be there and want to meet up, reply to this post or send me an email.

Also, if you are interested, I can give you a demo of the product I have been working on.  It is called Reference Assistant and is a Visual Studio Add-In that helps resolve issues around project references and type information expressed in configuration files.  Reference Assistant allows you to specify multiple sets of reference directories and dynamically switch between them, make sure that particular reference directories are always present for certain projects, add a reference directory to multiple projects at the same time, and helps resolve conflicts with different versions of assembly references.  It also parses app.config section handler types and configuration files for the major Dependency Injection containers and helps to resolve those references.  Reference Assistant supports its own method of extensibility allowing developers to add functionality that is not supported out of box.  For instance, developers could add parsing for their own custom configuration file formats or support for a custom written plug-in discovery framework. 

This is a brief description of the major features but there are many other smaller nice things as well.  Reference Assistant is in closed beta currently but the public beta is coming very soon along with the launch of the website and much more information.

Even if you aren’t interested in a demo, we can get together and talk about .Net, Visual Studio, the sinking value of the US dollar, or whatever.

Hope to see you there!

Tags: ,

Mono 2.0 (.Net 2.0 compatible) is coming soon

According to Redmond Developer News, the beta of Mono 2.0 will be available for download Friday March 14.  Mono is an open source implementation of the .Net CLR and libraries and runs on many platforms, including OSX, Windows, and Linux.

I am a little mystified as to why a developer would target Mono if they need to run on Windows, but then I have always been a little puzzled with certain aspects of the Open Source movement.  If the CLR is free for me to use in terms of costs to me or my customers, and available on pretty much every windows installation out there, then that is free enough for me.

Now targeting other operating systems with Mono is a different matter all together and is where I see Mono as a useful and quite interesting tool.

I will be honest.  I have not following the progress of Mono very closely at all.  When I saw the announcement of the pending beta availability I went to the Mono site and read through their blog.  I was shocked at how much they have working on other operating systems.  I have listened to podcasts with Miguel de Icaza when he talked about the relatively small size of the core Mono dev team so this makes their accomplishments nothing short of astonishing in my view.  Here is a short list of stuff they have working for mac developers:

  • They already have Mono running on the iPhone.
  • ObjC# bindings to provide access to Objective-C APIs from Mono
  • Cocoa# has been developed to provide cocoa bindings.

I would imagine that Silverlight will help out some with Mono adoption since the team is also making that available on Linux via the Moonlight project.

Tags: ,

Visual Studio Links Moving to VisualStudioHacks.com

I will be moving my Visual Studio Links series to Visual Studio Hacks.  James Avery, author of the book by the same name, is revamping the site and will be adding a lot of content.

In addition to Visual Studio Links, I will also write articles on Visual Studio periodically so make sure to subscribe to the rss feed.

For those who subscribe to this site, or visit often, I will still post entries here that are more general .Net programming topics.

Tags: , ,

Visual Studio Links #8

My latest in a series of the weekly, or more often, summary of interesting links I come across related to Visual Studio.

Vishal Joshi posted an overview of the VS tooling integration that shipped with ASP.NET MVC last week.

Marlon Grech discusses how to add Input Prompt support in Vista with WPF using Avalon Controls Library.

Via Steve Pietrek: Letz Roeder has released version 5.1 of .NET Reflector.

Via Jason Haley:  Creating a Debugger Visualizer for Graphics instances on Code Project.  Source included, of coarse.

Via email from Ted Heuer:  ILog has released an open source java to C# translater that can handle generic types.  According to ILog, this is used internally to help port their java rules engine product to .Net.  It is also available as an Eclipse plug-in that can take an Eclipse project and generate a VS project.

Alessandro Del Sole has written an article on Code Project explaining how to Use WPF Controls in VSTO Solutions with Visual Basic 2008.

Keyvan Nayyeri has released Visual Studio Extensibility.  The book covers VS 2008.  As of when I am writing this post, a quick search revealed that Amazon has the book for $2 cheaper than B&N, even with a B&N membership.  Both are still showing the book as pre-release but Keyvan says that should be corrected very soon and Wrox should have it for purchase immediately.  From the posted table of contents, information that I have not seen covered in other books on VS Extensions include: 

  • Debugging and Testing Add-Ins
  • Creating a Windows Installer for your Add-In (where was this when I needed it?)
  • Localization
  • VS Shell, which is new to 2008 so it could not have appeared in previous books
  • DSL Tools, also new
  • Extending the debugger
  • VSPackages
  • MSBuild

Sara Ford explains how to turn off the prompting to rename your classes when you rename the files in Visual Studio.  With this option turned off, the renaming happens automatically without the prompt.

Carlos Quintero pointed out an excellent set of posts dedicated to learning the VS SDK.

Tags: , ,

Visual Studio Links #7

My latest in a series of the weekly, or more often, summary of interesting links I come across related to Visual Studio.

Carlos Quintero posted an excellent summary of resolving Type instances and information from within VS.

This is a nice post on how to incorporate the Subersion revision number in to the assemblyinfo version number when building.

Alexander Brutt posted a VS 2005 project template for creating Sharepoint 2007 Timer Jobs (scheduled tasks that run under Sharepoint).  The post also includes a link that explains how to create the actual timer jobs.

The WPF Controls library, Avalon Controls Library on Codeplex, has been updated to v2.

Via DotNetKicks, Windows Vista Controls for .Net version 1.3 released.  This is a .Net control library for VS 2008 and windows vista, hosted on CodePlex.

Sara Ford posted a tip on how to stop the toolbox from auto-populating items in your solution.  She suggests that this could speed up load time for solutions containing large projects.

The sessions from the recent Mix conference have been posted here.  Sessions on ASP.NET MVC and Silverlight 2.0 are included along with many other topics.

Haibo Luo has updated his ILVisualizer debugger visualizer for 2008.  This visualizer will show the IL for methods you are debugging.  Source code included.

Good stuff from Channel9:

Tags: , ,

Reasons to like NHibernate and ORM

Ayende Rahien, a contributor to NHibernate along with many other open source projects, has written up a post listing the features he likes about the ORM tool.

I am a fan of ORM and have used NHibernate extensively on a large project over the last few years.  Prior to that, I had used TopLink and Hibernate on java projects.

Ayende’s listing pretty much summarizes why I like NHibernate and also has points that apply to many other ORM products as well:

  • Caching.  NHibernate is specifically flexible in this area but many ORM products excel in this area over sql based DAL implementations.
  • Multi-database support.  Using an ORM insulates your code from the differences in database dialects.  This might sound insignificant, but if you have ever had to migrate any application from Oracle to SQLServer, for instance, you will know what a chore it can be.
  • A dramatic reduction in plumbing code for your application.  Although he does not directly say this in his list, he does mention writing applications with no sql in them.  What I’ve noticed is that there is a ton of code that gets written in your application just to put data in your domain model and pull it back out.  Using an ORM removes this code from your application and puts in the domain of the ORM, which is code someone else writes and tests.

Using an ORM seems to encounter a great deal of resistance from some enterprise developers.  Below are a few of the reasons that are usually given against using an ORM product on a project:

  • Even though you are not writing sql, you still have to perform the mapping.
  • The sql generated by the ORM cannot be optimized for specific cases and will be slower.
  • Using reflection is slow.
  • Using an ORM makes the data access problems more difficult to debug.
  • Everyone knows sql and nobody knows <ORM product>.

Even though are not writing sql, you still have to perform the mapping

This is a good point.  It is true that the work of mapping data to columns in a database is moved from sql to the mapping layer of the ORM.  In the case of NHibernate, this would be XML files.  So in that instance, no work or time is saved.  Where the time savings comes in to the picture is when the actual mappings are used.  NHibernate takes those mapping files and performs the domain object instantiation and population for you. 

Detractors of the ORM approach might counter with the argument that the usage of the ADO.net data constructs, for instance the typed dataset, also removes the need to write object population code.  Although this might be true, I believe that passing ADO.net data types around your application leads to poor application architecture, not to mention performance problems.  Typed datasets are notoriously slow when it comes to serialization.

The sql generated by the ORM cannot be optimized for specific cases and will be slower

This might be true for certain ORM products, but has not been my experience with NHibernate.  The generated sql is quite good.  However, I have encountered situations where the sql has been unacceptably slow and in those cases I can almost always place the blame on a poorly designed database model.

NHibernate has the ability to pass sql to the database, if needed.  SQL optimizations can also be placed in the mapping files to help in situations where NHibernate could not generate the optimal queries.  Named Query support, added to NHibernate 1.2, has helped as well for specific query situations that might not be the normal path for searching for a given object type.

Using reflection is slow

This is always an interesting discussion to have with a stubborn developer.  Yes, it is true that a method invocation via reflection would be slower than a method invocation compiled into the IL directly.  The tradeoff you are making is flexibility for a little speed.  The reality of the situation is that the slowdown for reflection will be dwarfed by the IO wait for the database and you will not notice it. 

NHibernate also has functionality called the reflection optimizer which will dynamically generate classes for populating your domain objects at startup time.  This a tradeoff in startup time to remove the cost of reflection for each domain object population.  Early versions of the reflection optimizer were noticeably slower at startup for larger numbers of mapped classes, but this has been corrected in the newer versions of NHibernate.

Performance problems in enterprise applications are caused by poor database design or poor approaches to data retrieval in 99% of cases.  I should also lump screens that have too much data on them in with this category as well.  The other 1% of the time the performance problems are caused by poorly written threaded code, poor algorithms, and poor integration choices with 3rd party applications.  I have never encountered an enterprise application that was too slow because of reflection usage.

Using an ORM makes the data access problems more difficult to debug

I hear this complaint a lot at the beginning of projects specifically from developers that have never used ORM before.  I would say that the real statement that should be made about the subject is:

Using an ORM makes the data access problems different to debug.

Most of time, a developer simply needs to familiarize themselves with the debugging facilities available in the ORM tool they are using.  There is cost to learning what is available, just as there is a cost up front for learning any new tool or concept, but the productivity that ORM gives a project overall will make up for the learning curve.

Everyone knows sql and nobody knows <ORM product>

I also hear this complaint a lot at the beginning of project where I propose using ORM.  It is difficult to convince someone that ORM will payoff after the learning curve is overcome when they have never used an ORM product.  There are many blog posts on the web complaining that ORM does not pay off in the long run but this simply has not been my experience.

The response I usually give is to try the product for a pilot or proof of concept to test the pluses and minuses.  Most clients are won over when they see the benefits  of caching in the ORM and the ability to migrate databases with just minor mapping file changes (or maybe none).  Also, when they actually try using NHibernate or another ORM product, they find that the product is not quite as unapproachable from a technical standpoint as they thought when they first heard of the concept.

Tags: , ,

Visual Studio Links #6

My latest in a series of the weekly, or more often, summary of interesting links I come across related to Visual Studio.

The February 29 episode of This Week on Channel 9 discusses a few interesting Visual Studio items:  Extensibility videos are discussed.  The upcoming release of XNA Studio will support game development on the Zune device – debugging, performance tools, and all the normal goodness will be fully supported.  VSTO Power Toys released.

Script# was one of the pick of the week items for Channel 9 for the Feb 22 episode.  Script# compiles C# to javascript. 

Sara Ford shows how to jump to the Visual Studio command line in one of her tip of the day posts.

Terry Clancy posted new links to the VSIP site that give listings of partner products for Requirements Management, Secure Application Development, and Cross-Platform Development.

Via Jason Haley:  David Vidmar shows how to select a string, including surrounding quotes, from within a VS add-in.  This code could pretty easily be put in a macro.

Roberto Alexis Farah posted some WinDbg goodness – Using ~, the Thread Identifier.

As previously discussed, Microsoft released Preview 2 of ASP.NET MVC and Silverlight 2 Beta 1 at Mix.  Busy day for ScottGu’s group.

Scott Hanselman posted 4 screencasts demonstrating the usage of ASP.NET MVC Preview 2.

Carlos Quintero posted an article explaining how to programmatically add an event handler to a WinForm control from within a VS Add-in.

Tags: , ,

ASP.NET MVC Preview 2 is available

Preview 2 of ASP.NET MVC has been posted to Microsoft Downloads. 

One of the nice features that will be available this time around is full source code and permission to compile it if you need to fix a bug.

Release Notes are available here.  I was pleased to see a few of the items that I had complained about corrected in this release.

  • IControllerFactory.CreateController() now takes a string for the controller name instead of a Type instance.  This helps a lot for IOC containers because most people seem to prefer names instead of types.
  • Added Dispose method to IControllerFactory to support IOC recycling semantics
  • and most important:  ControllerBuilder.SetDefaultControllerFactory has been renamed to SetControllerFactory and now has an override that takes and instance of IControllerFactory.

The last one is nice because I had to write some ugly code before in SpringControllerFactory (MVCContrib) because SetDefaultControllerFactory had previously taken a Type parameter for the IControllerFactory.  If you wanted to share a spring.net context between the controller factory instance and another part of your app you had to resort to the ugly code method because you had no control over when and how often the controller factory was created.

Thanks should go to the ASP.NET MVC development team for obviously taking feedback from the community seriously.  Check the release notes for other improvements to the api.

Tags: , ,

Silverlight 2 Beta 1 Released

Microsoft Silverlight Tools Beta 1 for Visual Studio 2008 has been posted to the Microsoft Download Center.

This download will install the VS integration (new project templates, debugging, etc..) as well as Silverlight 2 Beta 1 and the Silverlight 2 SDK Beta 1.

Tags: , , ,

Visual Studio Links #5

My latest in a series of the weekly, or more often, summary of interesting links I come across related to Visual Studio.

Jason Kresowaty has done a lot of work putting together a good overview of writing your own custom FxCop rules.  His tutorial covers the current 1.36 beta.

Carlos Quintero has added two good posts to his blog on VS Extensibility.  The first is an explanation of how to tell that a project is in debug or release configuration.   Carlos explains the differences between C# and VB.Net projects in this respect as well.   The second is how to execute a build for all projects in a solution from within a macro or add-in.

The VS Code Analysis Team explained how to turn off FxCop checking for generated code.  This is specific to the new 1.36 version.

This is not really related to VS, but cool nonetheless.  The Sysinternals team has updated Process Explorer.  Process Explorer is like windows task manager on steroids. Via Steve Pietrek.

Scott Guthrie shows the new support in Expression Blend for Silverlight 2.0.  Tutorial goodness.

The Windows SDK Team Blog has a discussion of how to integrate the SDK with Visual Studio 2008 using the new SDK Configuration Tool.

The VS Extensibility Team has released PowerCommands for Visual Studio 2008.  The tool adds new menu items in various places in Visual Studio.  The Visual Studio Gallery video on Channel 9 has a brief demo of this tool at the end.

Via Jason Haley, here is an interesting post about Authenticode signing assemblies and what the framework does with those assemblies.  Speaking of Authenticode, I recently had to go through the process of buying my own certificate and Andy Brice recently posted about certificate authorities and the cost of certificates.  His post hit home in a lot of areas and was humorous in others.  For full disclosure purposes, I went with Comodo for my cert.

VS Knowledge Base stuff:

Tags: , ,