Wednesday, August 23, 2006

Thinking Outside The Box (More JavaScript Security Risks)

Periodically someone gets creative with JavaScript and manages to do something that its creators did not anticipate. The latest one that I found uses inline CSS styles and JavaScript to determine which sites on a pre-defined list you have visited. You can certainly see the potential for some nefarious uses. Here's a link to the original article and a version that works on IE.

Monday, August 21, 2006

IoC Bliss

I chose Spring.NET to manage my dependencies. It was a hard choice because I didn't see a whole lot of traction in any of the .NET IoC containers so there were few differentiating factors between the options. During my investigation I did determine that StrucutreMap was the first .NET container (and I awakened a painful memory about a lost opportunity with Jeremy in the process). Ultimately I chose Spring.NET because I know how to use it already, it has multiple commiters and because of the strengths of the Java version (if the .NET edition ever catches up then I would be very happy indeed).

With IoC in place and Rhino Mocks providing the ability to dynamically mock dependent objects development is proceeding at a breakneck pace. Life is good!

Wednesday, August 16, 2006

Which IoC Container?

I've used Spring successfully in Java projects. It is hard for me to understate how wonderful it is. I have always felt that the real benefit of IoC containers is that they promote good programming practices, in particular programming to interfaces which enables TDD. Of course ultimately you use the container to manage your dependencies but this is nothing that can't be achieved using the Service Locator pattern. The additional win of IoC is that there is no dependency on the Service Locator itself.

As I hinted in my previous posting it is time to consider an IoC container for .NET. My initial thoughts were to turn to Spring but the .NET version is very immature compared to its Java compatriot, especially outside of the core DI features (Hibernate integration, JDBC templates and declarative transactions spring to mind...if you pardon the pun). Jeremy Miller's Structure map and the Castle project are alternatives.

So it's time to do some research and determine which option best suits my needs.

Friday, August 11, 2006

ORM: The Second Coming

I used Hibernate on a Java project last year. The endeavor was successful but the learning curve was steep and I recall some painful moments. By the time that we were done I had concluded that ORMs definitely could like up to their potential but it was going to be the third or fourth implementation before I really became comfortable with them. Since then I've spent my time in the .NET wilderness but always on existing projects that already had a Data Access Layer.

This recently changed when a brand spanking new .NET 2.0 project came my way. I decided to use NHibernate for no hassle data access. I like to understand the basics first so initially I implemented something simple using nothing more than the documentation on the website and some vague recollections from last year. However very quickly I had a functional and transactional parent-child relationship.

Next I started to look for an optimal approach. Once again I found an excellent article by Billy McCafferty. A lot of reasonably advanced concepts are tackled but the result is sweet. And there's a gold-mine of things to learn for anyone who wants to sharpen their skills.

With an entire (and ostly reusable) Data Access Layer completed in only a few days I'm next going to tackle Dependency Injection...