Ayende @ Rahien

Refunds available at head office

Design Question: The Ubiquitous Property

I'm currently refactoring SchemaEditor (NHibernate Query Analyzer Hbm.Xml Editor, if you prefer ;-) ), and I encounter a strange case in designing the API. I want to be able to set a field without caring what is the backing store, whatever it is an array or a regular field. The problem is that sometimes when you are assigning an array to a field which is an array, the whole array should be replaced.

It should look like the following;

public object Value
   get { return val; }
            val = value;
       else if (valType.IsArray && valType.GetElementType()==value.GetType())
           throw new InvalidTypeException();

This just strike me as ugly, no matter the reasons for this (trasperant data manupulation without caring for the backing store).

Any suggestions?

Amazon Links

[fair disclousure]Just so you would know, any links on the site to amazon were changed to include my affiliate id, so I would make a cent or two if you buy a book that I recommend here.[/fair disclousure]


Published at

When Tests Tell You To Look Deeper

Well, I've been able to find the reason that my tests were failing outside VS.Net, they were running on the Framework 1.0, and not Framework 1.1, as in VS.Net. Very simple, but it had me stumped for quite a while. Oh, and the current directory thing, it's true as well, there is a bug is there, which, to my shame, was in the tests themselfs :-{.

I added a test fixture called DeploymentTests, and added a test for the framework version. I think it's a good idea to cover all the basic stuff that can go wrong, for that reason, I currently have three tests in the deplotment tests, one for the framework version, one to ensure that all the required assemblies does indeed exist and the last one to make sure that files required for the testing exist.

Right now I'm green again :-D

I also got to a 35% test coverage, which is pretty good from 0% :-),

       happy joy happy joy

Trivial Properties and Syntactic Sugar

I just read this article "Write Faster Code with the Modern Language Features of Visual C++ 2005", and one thing that caught my eyes, other than the far nicer C++.Net syntax was trivial properties:

See here for an example:

// trivial property
// compiler can generate accessors and backing store
property String^ Name;

Is there any reason that we can't get that in C#? It's a really conveniant feature that would save quite a bit of needless typing.


MSNSearch Wish

Here are more stuff about MSN Search and IE abilities, but I don't want more tricks, I just want to be able to do a simple file name search, however, something as simple as "calc.exeor "filename:calc.exe" is not working. And MSNSearch is configure to index all my Hard Drives.

I sometime knows what the name of the file is, but can't find it. Why should I use the old ways? Isn't this a viable scenario?

When is that going to be fixed?

When Tests Lie

I'm in VS.Net, writing tests, crunching code; all tests pass, I'm in the green zone, ready to Refactor. Then I decide to drop to Nant and see how my test coverage is. And the tests doesn't work. I've a couple of tests (the ones exersizing the most complex part of the code, naturally) that pass in VS.Net, but fail in NAnt, or when I use them with the console / gui test tool.

Only in Visual Studio.Net + TestDriven.Net they are working. I can't really figure out the reason for this, as far as I can tell, it's has something to do with the currently directory. I'm going to write some tests to change the current directory in VS.Net and see if this makes any difference.


Published at

Refactoring NHibernateQueryAnalyzer to glory

When I created NHibernateQueryAnalyzer I was well aware of TDD design principles and core idea, but I created NQA mainly as a way to familiarize myself with NHiberate's plumbing. Because of that, I didn't bother to write any tests, and did the least amount of work that was required to get the point across.

Shortly after I released it, I found out that people were actually making use of this tool in the wild. I decided that I want to turn that into a real application, and not just demo code. This meant that I need to turn a prototype into an application, without falling into the usual pitfalls. To me, that meant writing tests, and refactoring toward a testable design. NQA is not a large application by any means, but I was not willing to write it from scratch, in this I share Joel's opinion in the matter. There are quite a bit of knowledge there that I would loose if I would write it from scratch.

So I refactored, and keep on doing this. The application currently compile but does not work, and I sort of doing open heart surgery in order to fix some of the bigger Crimes Against Good Design that were commited there.

You can check the wiki page for all of the gory details.


I'm created a Wiki for NHibernate Query Analyzer, which can be reached at http://www.ayende.com/NHibernateWiki/

The main idea is that I'll finally have some place to write documentation when I'm stuck with writing code. As well a place where I can just pour out technical details that are too spesific for the blog.

Currently the most interesting pages will probably be: 


Best Firefox Extention for Web Developers

, it's not the Web Developer Toolbar, although that is very useful by itself. I'm talking about ColorZilla. This is an extention that does quite a bit, but the most important thing that it does to me is that it allows me to point at a part of the page and get it's color (but that is not the reason I like it) and it's class / id identity. Why is this so important, you might ask? In a world of CSS design, this mean that you know what that element is, instead of having to search for it.

complex pages, with complex CSS, porting a site's design is very hard. Take for example my own site, I've a very spesific color scheme that I use, which dictate the use of the following colors: #FDF6E9;#993300; #FFEAAA; #FFEAC0; #FF9933 , etc. When I want to use a web application on my site, I need to convert that to this color scheme. ColorZilla make this porting trivial even in the most complex cases. I'm using it to change FlexWiki's color scheme, and that is a >1000 lines of CSS that I can just jump in and modify thanks to ColorZilla.

Dicology*: The Study Of Names

I've been reading  Corporate Blogging Guidelines, Draft #2 when I realized that I violate rule #2, I'm using a pseudonym1 for so long that I often forget that I do. :-)

The name originated in my Wheel of Time days, it was in 1997/8 that I started to use this pseudonym2. In the Old Tongue that is used in the Wheel Of Time, The meaning of the name is:

Ayende - Freedom, Rahien - Dawn

So my name is actually "Dawn of Freedom", or "Freedom's Dawn", it was funny at the time. Right now I got so used to that name that whenever I'm on a computer, I am using this name everywhere.

I just did a search my computer, I've 50 items (mostly from purchases I made) under my name in Hebrew, and 30 under my name in English. Searching for 'Ayende', on the other hand, result in 5,536 items3. The last time I installed an OS on my main machine was 2 years and 9 months ago, btw.

And on completely other venue: Only 0 years, 4 months, and 18 days to go.

1A much better word than a nick, and probably the reason that I'm writing this post, so I can remeber it the next time I want to talk about my pseudonym.

2Before I was Barid Bel Medar and published several stories under this name. I can't recall now why I changed the pseudonym, probably I grew tired of it.

3The searches were conducted using MSN Desktop Search.

#Dicology Defination: A made up word consisting of dico - name in Latin and logy - study of.

[Listening to: When You Walk in the Room - Agnetha Faltskog - My Colouring Book(03:36)]

AppDomains troubles fixed

For now, at least. I'm not so sure that I can really pronounce them fully fixed, but I can get it to work properly now.

I load NHibernate from a  seperate AppDomain and can run queries there. The issue was about AssemblyResolve. I had a problem with one of my string argh!!! that caused all that trouble.

More AppDomain and Reflection Goo

Well, I found out exactly how useful the AssemblyResolve approach is.

I can load the assemblies that I need (although I didn't test it for assemblies that references more assemblies, where I think it will fail).

But NHibernate will not load it. The reasoning being that NHibernate load types using the Type.GetType() method, and assemblies that has been loaded with Assembly.LoadFrom() don't get to participate in this. WTF! Can anyone explain why?

Currently I don't have a solution.

Argh! Dynamic AppDomains and ApplicationPath headache.

I've been battling with the way the CLR handle AppDomains and loading assemblies for the last two days, and no success seems immanent. I need to load assemblies from two locations, my own ApplicationBase, and another directory, but I keep getting only one of them.

The issue is complicated because I'm trying to make NQA a multi AppDomain application, the reasoning is very simple, you can't unload a single assembly, only AppDomains, and the whole point of NQA is that you can load and unload assemblies and test them.

What I want to achieve is to load my own assembly and NHibernate to the dynamic AppDomain, and then load the user's assemblies. Then I can just call from the UI to the AppDomain and back. When the user recompile his assemblies, I can re-load the assemblies easily.

But I can't make it work!

I can either get the AppDomain to load my assembly and Nhibernate, or I can get it to load the user's assemblies (at least I think that I can, I can't test this until I can get the code to run!)

I've tried toying with ApplicationBase, PrivateBinPath, PrivateBinPathProbe, etc, with no success.

The scenario is really simple, I've the following directory structure:

C:\Directory One\main.exe, C:\Directory One\loader.dll, C:\Directory One\NHibernate.dll
C:\Directory Two\library.dll

What I want to do is, from main.exe, to create a new AppDomain, load loader.dll to it (which references NHibernate.dll) and then load library.dll from Directory Two.

I can't find a way to do this! If I set the ApplicationBase property of the AppDomain to Directory One, then the library.dll fails to load, if otherwise, then the loader.dll fails to load. If I try to use LoadFrom(), it fails because it can't find the referenced assemblies.

I can't assume that I've write access to either of those two directories, so just copying them there wouldn't work.

I'm going to experiment with AssemblyResolver and see if that can help me, but I'm not very optimistic.

Blog Update

I've updated the blog software from dasBlog's CVS Repository, so now I've a blog statistics on the page. I'm very impressed by this work. It was my own request that caused this to happen, and I'm very glad of that.

So, 249 (including this one) in 1 years, 3 months, and 6 days that I've been blogging.

I also reduced the size of the Google ads, they were too intrusive.


Published at

More On VS Team System Prices

I read the next couple of books, and they are really good:

Product image for ASIN: 0321228103 Open Source .NET Development : Programming with NAnt, NUnit, NDoc, and More
Product image for ASIN: 1590591046 In Search of Stupidity: Over 20 Years of High-Tech Marketing Disasters

Those two I didn't read yet, but they become more relavant after the recent events.

Product image for ASIN: 1590593308 Cross-Platform .NET Development: Using Mono, Portable.NET,and Microsoft .NET
Product image for ASIN: 0596007922 Mono : A Developer's Notebook (Developer's Notebook) 


Published at

Visual HStudio 2005 Team System vs JetBrain dotNet IDE

The issue has been debated by people far more experienced than I am (see here, here, here and here for good arguments both pro and against).

My own thoughts? JetBrains (the creators of ReSharper, which I've been poetic about before :-D) intend (bottom of the page) to create an IDE for .Net, and that most probably mean that I will be leaving VS.Net behind. I've spoken before about moving to VS 2005, but as long as that means leaving ReSharper behind, that ain't gonna happen. I'd recently had been forced to work on VC# Express 2005, which doesn't have ReSharper, but has refactoring tools that does much the same. The experience has been so far beneath what I can do today with VS 2003 + ReShaprer that I came to a near complete halt. (Somewhat aided by some bugs in VC# Express, but that wasn't the main thing.) The amount of manual work that I had to do which ReSharper handled for me was astounding. About the only thing that ReSharper can't do is to reference a dll.

What do you mean I've to compile to see the errors1? And the refactoring support that ReSharper has is far more mature than what VC# Express Beta 1 shows. And code browsing, and variable name suggestions, etc. All of those makes working with VS.Net 2003 a pleasure, and working with VS.Net 2005 a chore.

How does this relate to Team System? Well, Frans was the first to catch on, but when JetBrains release their IDE, it's going to have:

  • Support for Subversion as a Source Control Management System is already promised,
  • Support for unit testing via NUnit (with options to add others, so I can still use MbUnit :-D).
  • Support refactoring all the way to the source control (which mean that I no longer have to remember to svn move files when I rename them.
  • An API to add new languages - So I can get Boo, and maybe even get some JetBrain Magic SauceTM to go along with it.
  • Will use build.xml files as it's native solution/project format - replacing the need of NAnt and still allowing all the goodies.
  • Probably allow me to target different versions of the CLR.

With all of those features, I can't really see much attraction for VS Team System for the ISV or consultant. The only thing that is missing there is a bug tracking that is built in the IDE, and that can be solved as a plug-in or enhancement.

Assuming that the price tag would be similar to IntelliJ IDEA, that would be 499$, compare that to the multi thousands of dollars that you would get the same functionality from VS Team System. On the other hand, VS usually ship with a multitude of helper wizards that make common tasks much easier (database work is one such example). Personally, I don't use this functionality in VS, and don't ever intend to. That is a personal opinion of mine and probably many other developers disagree.

I intended to register to the Empower program, based on Joel's advise, which meant that I could quite a heck of a deal on this. I'll still probably go this route, to save money for the OS and servers. But I'm considering more and more to avoid all this complications and use an IDE that is willing to help me be lazy, and the tools that I'm already familiar with and use daily. And if I get the same tool set that I can get today, with a tighter integration, than it's really no brainer.

Alex Lowe seems to think that most developers don't know JetBrain. He is probably right, but they would search for alternatives when they would find out that they need to pay so much more for everything that Microsoft sell2. And the other ISVs that are familiar with this would make sure that they do know about it. The blogging community isn't that big, if you compare it to the size of the developers community, but they are well connected, usually.

I can't conceive developers moving from tried-and-true tools that they know and love (price tag: $0, limitations: none, source-code: included) to a far more complex beast that may or may not be available in version 2. And I think that this would be a big lose for Microsoft. This is not meant to convince Microsoft to change it's opinion, by the way. As a matter of fact, I don't care much personally. I don't foresee a change in circumstances that make me want to use Team System features.  They want to target the Enterprise market, but they are very weak in this regard right now. And I think that a company with thousands of developers (just the kind that Microsoft is targeting) would want to use something that come from Microsoft and holds their entire future in its innards. Not without solid proof and developers clamouring to get it.. And I can't see people getting excited about it when the price is so high that they can't use it at home or for their own projects.

1Yes VB-ers, you can laugh now, you'd it circa 1995 or so, I know.

2As a matter of fact, I agree with Erik here, most people buy MSDN Universal to get exactly that feeling.


Published at

Happy Purim

Today is Taanit Ester, (Ester's Fast is the literal translation) and tomorrow is Purim.

Purim is a Jewish holiday which is like Halloween in which everyone wear customs, but there are no tricks except on the Evil Haman.

Roadblock: Or where has vs.net has gone.

I'm going crazy, I lost VS.Net 2003, and I reverted to using VS.Net 2005 (yes, I reverted. VS.Net 2005 doesn't have ReSharper, and that is a big minus in itself.).

Then I started getting problems With TestDriven on VS.Net 2005, and couldn't debug or test with debugging. That totally take me down because I refuse to do all the hard work myself. There are tools for that, and I've found out that I'm not nearly as productive as I can be without two of my favorite tools.

I don't have access to the DVDs that I need in order to fix that, and it has been driving me crazy! I'm writing documentation now, so at least something good may happen because of this.

[Update, I just got an email from JetBrains, and they say that there should be an Early Access Program for ReSharper on VS.Net 2005 starting in may! Final release is scheduled to one month after VS.Net 2005 hit the shelves.]

An ASP.Net framework

I've wanted for quite some time to write several web applications, and one of the things that stopped me was the lack of knowledge in the area. What I want is simply a common way to handle theming in an application, in a way that transcend IIS Application's boundries.

This mean that if I have a gallery application and a bug tracking application (two projects that I want to work) I can define the graphical setting once, and be done with it. I want a common look & feel on my site, no matter which application I'm using. Today, it's a pain in the ass to define all the 101 details to make an application look as I want it to.

Another thing that I want is deployment flexibility, I don't want to have a set of pages that has fixed format, in this regard, dasBlog is the most flexible application that I have worked with.

I'm just toying with ideas here, I've not started searching, mind you. So I may be shooting my mouth off.


Published at

Lost Vs.Net 2003 today

After my previous problems, I tried to do a repair installation, but it complained about missing the DVD, and refused to run, so I'm out of my favoraite IDE. Luckily, I've VC# Express, so I'm not completely hosed.

I can report that NHibernate Query Analyzer seems to work as expected with .Net 2.0

Vs.Net Errors

Just uninstalled SynapticPop's Templates, and I started getting strange errors trying to create new items, the only thing that seems to work is the new code file option.

I keep getting the following error: Could not run the 'c:\Program Files\Microsoft Visual Studio .NET 2003 VC#\CSharpProjectItems\LocalProjectItems\..\ClassWiz.vsz' wizard.

Re-installing SynapticPop doesn't seem to help. I'm no re-installing Vs.Net. :-(


Published at

Outlook Syncronization

I just set myself up with networking (limited) from my laptop (using my cellular phone as a modem, which is the nicest use that I've ever put it to.) and now I'm facing a synchronization problem, I've two computers, my laptop, which is what I'm using during the week, and the main computer at home.

All my emails and RSS feeds and at home, but I would like a way to synchronize between the two computers. Rss Bandit comes with synchronizations features built in, so I don't have to worry about that (and for a change, I'll discover what it is about off line reading that seems so attractive) but I have no idea how to synchronize Outlook between two computers.

I don't use Exchange, so that seems to be quite a problem. I checked Outlook's help, and there doesn't seem to be anything there about synchronizing without Exchange. Any idea about it? I'm going to check if there are some tools that allow it. I want a complete synchronizations, meaning emails, callender, contant list, etc. There are such things for synchronizing with hand-helds. There has got to be some tools to synchronize between two computers.

[Update: Here are something interesting: Synchronizing Microsoft Outlook on two machines, but everything that seems relevanting to me is a shareware tool. Isn't there some free tool to do this?]

[More Updates: Seems to me that this may be it, Outlook Sharing Add-in and Synchronizer, but I'll have to check the capabilities of the Lite version.]

Who is reading my stories?

I just got a google search about my stories.

They are quite old (5+ years), and I would like to know who is reading them. So, if you did, please drop me a line, Ayende@ayende.com


Published at