Free Microsoft Press E-Books !


Microsoft Press is handing out 3 books:

– Introducing Microsoft LINQ by Paolo Pialorsi and Marco Russo

– Introducing ASP.NET Ajax by Dino Esposito

– Introducing Microsoft Silverlight 1.0 by Laurence Moroney

Silverlinght 1.0 is probably a bit outdated (with 1.1/2.0 close), but the others should be good, judging by the authors. Dino Esposito wrote couple of very good books on ASP.NET and .NET.

See this blog for more details and download links.

Microsoft will ship MVC for ASP.NET ?


From Scott Guthrie’s interview on .NET futures

SG: We’ve seen demand for an MVC framework on two fronts. One is for even more testability, having the ability to completely mock-up a request. We’ve also always seen with ASP.NET that some people like having the server control, postback model; some people say, “I just want absolute control.”

The MVC framework we’re coming up with is a fairly simple MVC model, it’s very clean, it’s a front controller model, and it integrates very well into ASP.NET so you can use ASP.NET forms authentication, session state, security, personalisation, caching, all the standard features, but with an alternative to the postback model where you have a more traditional controller-view separation and have complete control over your HTML.

The other thing is that for the view, you can use .aspx templates, master pages and all the Visual Studio tool features. It integrates nicely into ASP.NET and preserves everyone’s investment. You can have a single app that has both pages built with MVC and pages built with postback. People can choose.


Finally – if that happens, maybe next time when I will be crossing the platform boundaries going back from Java and Spring to ASP.NET on the next project, I will not have that old feeling as in 2005: yes, this ASP.NET thing works, one can build pretty decent application in it and is not really so bad after you get used to it – but is still sooo inflexible and limiting compared to the beauty and simplicity of Spring MVC, or Webmacro.

Looking forward 🙂

MSDN Documentation – the worst in class ?


Did it ever happened to you that you were using some tool day after day – and never realized it’s pretty big deficiencies ? Until somebody, coming from different background pointed out what everything is wrong with the tool ? Before that moment of revelation, the issues were just inconvenience, but right after that they became real annoyance ?

Exactly this happened to me last week and the credit for pointing out what is wrong with MSDN documentation (and the “standard” .NET documentation format in general) goes to Joel 🙂

For developer using object oriented language such as C#, Java or Ruby, what you need on daily basis is to find information about a class, see its public interface,members, constructors, method signatures. Ideally, on single page, with possibility of drilling down to the details of a method and to a code example. You also very often need to see all implemented interfaces, have easy access to parent class and (in case of e.g. an interface inside a framework) to access the implementing classes or derived classes within this context.

Unfortunately, the Microsoft .NET documentation makes this simple task not exactly easy, pleasant or fast. As an example, lets take something really simple e.g. DateTime struct. In the documentation, information about this simple class are separated to 6 pages: datetime structure itself, Members, Fields, Constructor, Methods and Properties. If you would expect that with this devotion of low level categorization the particular page for e.g. Methods will give you all details about all DateTime methods, you are wrong. What Methods page gives you is just list of names, not even a method signatures – parameter types and return values are missing. To get this information, you must click through into the page dedicated to that method. If the method is overloaded (take e.g. omnipresent ToString), the Methods page contains only one name and only the next page gives you the signatures, linked to another page with details. See for yourself


In addition to bad information structuring, almost every link causes full page reload.

Compare with how much more usable is the Java documentation: it is very easy to see all interfaces, methods, constants, parent classes, implemented interfaces in single page. The dated frames-based UI actually makes lots of sense and is (except AJAX based dynamic site) much better way how navigate the documentation.

With all that said, I am not surprised that the tools such as Reflector are so extremely popular in .NET world. It not only provides very useful debugging/inspection tool, but thanks to excellent and compact presentation of information about the class retrieved from reflection, they are the fastest way how to get meaningful information on core classes API. Other than Reflector, the other fast way how to get information on .NET core library details is Google search.

Try for example how fast you can access a documentation for particular class starting with Google search – let’s take e.g. WebConfigurationManager. Google search returns blazingly fast (as always) – with the MSDN page as first hit. Now compare how fast you will get the same information starting from MSDN home page, (which is btw, advertising ‘new and improved search and navigation‘). Your mileage may vary, but I usually see 3-8 seconds delay in search response (compare to <0.5 sec for Google). Few seconds seems like no problem, but when you do it all the time, it easily becomes pretty annoying. Even more so when you realize that Google is searching WHOLE WEB, with content they do not own or control, only index and rank, whereas MSDN search is searching MSDN data repository, which is – however you measure it – by many orders of magnitudes smaller and Microsoft fully controls most of it’s content.

Why cannot the largest and most powerful software company create documentation that is useful and usable ? Even the documentation for the OpenSource Mono project (port of .NET to Linux and other platforms) is *much* better than the original. See the class DateTime there for comparison: the menu is dynamic and does not reload page every time you click on a link, the methods have full signatures and everything is on single page with local links and only details are on second level page.

Code in Ruby under ASP.NET: coming soon ?


The support for using dynamic languages such as Ruby or Python to code ASP.NET pages was announced for future versions of ASP.NET in the ASP.NET futures.

Unless I am mistaken, it means that we eventually will be able to write control event handlers in Python or even Ruby – which is certainly more fun than in VB.NET or even in C#, but is it really so important ?

What would be *really* cool if the whole ASP.NET become more agile and more “rail-ish”. To make overall architecture more flexible – such as departure from not very flexible page-centric architecture towards MVC and routing. Maybe some version of ActiveRecord ? Or even multiple (and pluggable) template languages ? That would be really something.

Rails’ ideas everywhere


Since I got through “Rails immersion”, I keep seeing the implementations of the same idea everywhere. Latest find is Subsonic, which implements Active Records in .NET space. Rather than writing more, see this screencast.

Fixing broken ASP.NET development environment


I had again the not-so infrequent pleasure of setting up fresh copy of Windows development stack. We were moving few machines between projects and to make sure that no forgotten source files are left on the harddisk, we reformatted and reinstalled Windows from scratch. It is usually good idea anyway, because developers like to install strange tools and utilities and generally customize machines to their own taste, which tend to be unique and is seldom shared.

We needed to set up usual development tools: Framework 2.0, Visual Studio, SQL Server 2005 with AS, as we will be doing few OLAP related modules. Plus Subversion client, some 3rd party tools (such as Notepad++, TotalCommander, Putty, Firefox with developers plugins) and so on. Not a rocket science, obviously – just needs to be done in proper order and not forget to include all needed components. If you install on Windows XP Pro, the usual catch is to forgot installing IIS first. Without IIS, the ASP.NET does not get configured out of the box and you have to register it manually by running aspnet_regiis.exe -i command, well hidden inside the Framework directory. Which is exactly what happened – on two machines, because both were imaged from same image, lacking the IIS component.

So we did the above step and afterwards one of the machines worked just fine, whereas the other kept throwing weird error on every attempt to debug an ASP.NET application with VS 2005. Now the fun began. The error message was a bit misleading – indicating that the problem is in running/attaching debugger on ASP.NET process. But even the access to ASP.NET application was broken, giving back 500 Server error and recommending to check event log. Which we did – and found absolutely nothing useful in there. After some digging, fruitless googling, checking the user membership in various groups and accounts under which the ASP.NET process was running … the solution to the problem were directory permissions. On the machine which worked, the directory hosting Web app was writable by group Users. On the other it was not. Setting permissions that allowed ASPNET account read and write the directory fixed it all.

So what is my point and why am I documenting this fairly uninteresting issue ? Few points and observations actually. First, it would be very helpful if with such huge and complex tools as Visual Studio Microsoft would provide some checks and diagnostics that would indicate which parts of tools work and which do not work. The error messages should be much more detailed and provide some context about what went wrong. In Java world, having the stack trace in Tomcat log file would immediately clarify what can and what cannot be the cause. Using plain old text files for logging is probably better that stuffing everything into event log. Event logs may be great for system admins and remote access, but for developers, text file with meaningful content is more than adequate.

Second, the approaches that some people use when troubleshooting installation problem are unbelievable. Relying on Google results will often lead you in completely wrong direction. I was amazed how many crazy things were people trying to get rid of the error message as ours: “What worked for me was to install framework 1.1, switch ASP.NET from 2.0 to 1.1 and then back”. One cannot exclude that this may have impact – and even fix the problem – but obviously, the fix is caused by some side effect which may or may not work on your machine. What is actually happening is people are trying to fix something they do not really understand, by attempting random actions and observing the impact. The problem may be in low experience level of the users – but also in bloated, messy environment of Windows system files components and their complex inter-dependencies. These two together create strange culture of frustrated users trying to catch black cat in dark room – and in half of the cases, the cat is even not there.

Last but not least – without deep understanding what exactly gets installed where and how it depends on other components, you can be 100% sure what is the root cause of the problem – and where to look for solution. It would take us much less time to fix the issue if we were not try to fix assumably broken ASP.NET installation – because we knew we did skip one step, this was first thing to look at.

This is one thing where Java got it right – or at least much better than Windows. All you need to have is correct path settings (to include the version of JRE you want) plus JAVA_HOME variable pointing to it and rest is just making sure you have correct classpath that contains all jars. Adding components or plugins is matter of copying files to proper place, no installers and registry is involved. You can (and I do) have six different configurations and versions of Eclipse on your harddisk: one barebone, to test the new plugins, one with MyEclipse IDE, one with Web Tool Project, one with Ruby Development tools and RadRails (all 3.2 based), plus old 3.0 version to support older projects. I also do have three different installation of Apache Webservers – version 1.x, version 2.x and the “portable” version inside XAMP without any issues at all. Not speaking about approximately 5 versions of Tomcats and few other J2EE servers coexisting peacefully …

Now just try to install and run side by side just two installations of VS2005 with different set of plugins – and compare the experience. Your best bet is run two full Windows installations inside VM or using two workstations …

New great podcast


Running out of Security Now! and TWIT episodes, I have subscribed and started listening to few newly discovered podcasts.

I have started to listen to the .NET specific one from Scott Hanselman named Hanselminutes. There are couple of factors that makes it better that other geeky blogs out there. First reason is the content quality. There is very high signal-to-noise ratio, pretty much all content counts and both guys in addition to being smart are quite good at achieving right balance between keeping on topic and spontaneity.

Second reason – it is not technology-religious and quite pragmatic. Scott obviously likes .NET and is passionate about Microsoft technologies – but there is no sucking-up, Scott is very open minded – just listen to the Dynamic languages where they talk about Ruby on Rails. He even owns a Mac and tests multiplatform software on multiple platforms 🙂

Third reason: there is PDF transcript available with lots of good links which would be otherwise lost (unless you listen with pen in your hand and in front of computer, and not driving or walking as myself.)

And last but not least – very good audio quality, professionally recorded and processed. After listening to this episode about professional audio processing, it was clear why. Episodes are reasonably short – 20 to 40 minutes

I have learned quite a lot from the about variety of interesting things – e.g that WPF/E (recently named Silverlight) may be actually something I really want to look at :-). It almost sounded too good to be true.

So if .NET is part of your world – or you want it to become part of your world – go for HanselMinutes.