LINQ-ify Anything

November 27, 2008 at 7:24 am | In Coding, Open Source | No Comments

When I set out to write my ORM, I had two guiding principles:

1.) Loose Coupling was key. I wanted the result of the ORM to be loosely coupled, and I wanted any dependencies the ORM had to be loosely coupled as well.

2.) I wanted 1 and only 1 query language – and that was LINQ.

Now, the ORM I started, I doubt, will see the light of day because of several reasons – but mostly because I don’t have the time to support another open source project. One is taxing enough for any mere mortal.

But in my quest to add LINQ, I had come acrosss Matt Warren’s IQueryable Provider series on his blog. Well, the beauty of that project has now been refactored and is now available on CodePlex as the IQToolkit. Matt’s refactorings are great and add a lot of flexibility to the product. So, if you need to add LINQ syntax to something, or wish to write a Linq2MyTechnologyHere implementation, then you’ll also be happy to know that the IQToolkit is licensed under MS-PL, which is pretty permissive.

How hard was it to get the pre-toolkit version of the IQToolkit to work with my ORM? It took me about 10 minutes of searching and then about 10 minutes of implementing the section of code that defined the properties to lookup. With the new toolkit version, there is an ability to add your own mapping implementation very easily (check ImplicitMapping for the stock implementation). Great work by Matt on this one!

Happy Thanksgiving!

music note While writing this, I was listening to "Northern Downpour" by Panic At the Disco

DotNetKicks Image

Programming Tip

November 22, 2008 at 1:46 pm | In Coding | No Comments

If you have made changes to files and have not committed them, but then find that you need to revert the file to a the previous state and you don’t want to lose those changes, simply create a patch for the file. Save the patch file to the same directory and now you have captured your changes since the last commit. Now, revert your changes, make the necessary changes to the project and then apply the patch to get your changes back into the file. If you have to make changes to the files you patched, then you may have some manual work to do there, but if not, you should be golden.

DotNetKicks Image

dashCommerce v.Next

November 22, 2008 at 1:42 pm | In Coding, Open Source, dashCommerce | 2 Comments

I’ve been fairly quiet over the last few months. Most of that is due to the new addition to my family (my new son, Harrison), but some of it is because I am in mad scientist mode. That entails a ton of reading and prototyping. I’ve been taking a close look at the available ORM’s in the market – and trying to understand a lot of the arguments / concerns around the ADO.NET Entity Framework – namely persistence ignorance and the like.

I’ve also started taking a good, close look at NHibernate again (thanks Yitzchok, for prodding me). Back in 2005 / 2006 time frame I had looked at NHibernate and I wasn’t diggin’ it. We were looking to use it as the base data access framework in our product and I was pretty well against it at the time. Things change. It has matured (as have I ;) ) and it looks to have a lot of upside. So I am strongly considering it for the direction we want to go in with dashCommerce. I am watching what the Entity Framework guys are doing, but their solutions to POCO usage and object state maintenance puts the burden back on the developer and I’m not digging that. We’ll see how it shakes out, but right now, I’d say NHibernate is the front runner. Thoughts?

I’ve also been looking at the Managed Extensibility Framework. dashCommerce is going to get bigger and bigger and I’m looking for ways to manage that growth and to allow developers to extend the base product fairly easily. The MEF is still pretty young, and I haven’t gotten into the weeds with it yet, but it does look promising so I’ll keep you posted on what I find. If anyone out there has some in the weeds experience with the MEF, I’d love to hear it.

One thing I would like to do is capture some of the refactoring work in some screencasts. It seems to me this might be pretty neat and valuable to people. Greenfield development is always pretty easy, but how do you take a system like dashCommerce and refine it to have a better separation of concerns, a better SOA architecture, etc.? Does that sound like something you might want to see? No promises, as those things take some time to prepare, but I’d like to hear if you think there would be value there?

Happy Holiday Season to Everyone!

music note While writing this, I was listening to "Northern Downpour" by Panic At the Disco

DotNetKicks Image

NullPaymentProvider added to dashCommerce

November 13, 2008 at 6:55 pm | In Coding, Open Source, dashCommerce | 6 Comments

A few days ago I added a NullPaymentProvider to dashCommerce. Many people have asked for something like this – either in order to test dashCommerce without a payment provider account set up or, in some cases, to use for situations where you want to record the order, but payment will be made later (i.e. in person, by check, by post, etc.).

If you want to check it out, pull the latest bits from out Subversion source control repo (check the FAQ for info on how to do this) and run the installer on a new database.

I hope this helps someone.

DotNetKicks Image

Is Persistence Ignorance Ignorant?

November 11, 2008 at 2:54 pm | In Coding | 2 Comments

I’ve been reading and analyzing a lot of what people are saying about the Entity Framework and persistence ignorance. And I understand the general argument, which is, “Don’t clutter my domain model with persistence gunk.” What does that mean? No Load() methods in your classes, no attributes in your classes that “inform” the ORM layer (think [Column] attributes on your properties), no deriving from a common interface or base class (IEntity, ActiveRecord), and other similar things.

I’ve also looked at different ways to get the required information into the ORM. The most common approaches I have seen are:

  • Attributes
  • Mapping Files
  • In Memory or Class based Data Dictionary

In the end, an ORM needs this data dictionary to perform operations against the data source. The argument, from what I see, is all about where the data dictionary resides and how it is generated. It also seems to me that the bulk of the argument is focused on the testability of the resultant classes. Which, if you are practicing TDD, makes sense. But not everyone practices TDD (or wants to). So, if you remove TDD from the equation, does Persistence Ignorance still hold water or is it just over-engineering?

I do like the idea of using POCO’s and having “the magic happen” for me, but from what I’ve seen from the EF team is that this would require you to add the POCO to an ObjectContext that does the manual labor of tracking changes and some other stuff (I watched a short video on this a week or two ago but I can’t seem to locate it). But that adds development overhead as I now have to remember to add my POCO’s to the ObjectContext (or whatever it was).

When using Attributes, you are forced to rely on a lot of Reflection work, which is what I did recently. But as I read more about the Persistence Ignorance debate, I am wondering if the In Memory or Class based Data Dictionary model wouldn’t be a better approach? It would remove the reflection requirements which for large domain models can be costly.

I guess the good news is that I have the one method build up already, but I think what I am going to do is branch it and do an experiment with the In Memory / Class based Data Dictionary.

If someone out there has done all of this before and has some experience to share, I’d love to hear it.

DotNetKicks Image

Mark your calendar - dashCommerce Conference Call

November 9, 2008 at 12:52 pm | In Coding, Open Source, dashCommerce | 2 Comments

I mentioned a while back the idea of having a conference call over Skype for dashCommerce. Well, the arrival of a new little one put that on hold for a while, but I am back on this and I would like to do something December 3, 2008 @ 6:30 PM EST. I’d was also thinking I would like to do it using Microsoft SharedView which will limit us to 14 additional people. So, if you want to be a part of this, let me know. Please leave a comment below. We may end up using Skype as well as I don’t believe SharedView has support for voice.

I anticipate we’ll go for about an hour – maybe a little longer.

DotNetKicks Image

dashCommerce and Continuous Integration

November 8, 2008 at 2:14 pm | In Coding, Open Source, dashCommerce | No Comments

For anyone out there wondering how hard it is to get a CI build up and running, you should know that it has become very frictionless. After reading through a great tutorial and firing it up I spent about 1 hour. From the time I actually forced a build till I had a successful build was 12 minutes as you can see from the emails:

CI_Time

Omar’s tutorial is great.

DotNetKicks Image

AutoCompleteExtender and numeric strings

November 7, 2008 at 1:26 pm | In Coding, Open Source, dashCommerce | No Comments

A feature I am adding to dashCommerce is an AutoComplete feature to the Order Search, which will allow you to type in the first few characters of an order number and the AutoComplete feature will bring up a list of possible order numbers.

The problem I ran into while prototyping the work is related to the fact that dashCommerce order numbers are numeric strings. For example: 0123-4567-8901-2345. We did this because for our international friends, order numbers such as 09UIY79T6R$NHG would not be too helpful. :)

I am using an AJAX-enabled WCF Service as the endpoint and so I had the following code in my FindOrder method:

      list.Add("0234-5678-901");
      list.Add("1123-4567-890");
      list.Add("1234-5678-901");

The interesting behavior that occurs when trying to get this to work is that the results are kinda funky:

AutoComplete_Hurumph

Not exactly the anticipated result. :) But, there is a way to get this to work as expected. For each item you add to the list, you need to add the item to the IList<T> as:

list.Add(AutoCompleteExtender.CreateAutoCompleteItem("0123-4567-890", "0123-4567-890"));

That’s ok, but not exactly great as now my service has some “UI junk” in it. I’m not entirely sure I care right now, as the service is exposed for a particular feature, but this seems to me to be – hmmm – less than good. But, once the change is made, the result is a bit better:

AutoComplete

I only changed the first one for the demo. I hope this helps someone else who encounters the problem.

DotNetKicks Image

What a Great couple weeks!

November 1, 2008 at 10:35 am | In Coding, Open Source, Personal, dashCommerce | 2 Comments

I’ve had a pretty good couple of weeks. I don’t feel as though I talk a whole lot about “me” on this blog – most of it is related to dashCommerce, which is ok, but occasionally I like to peel things back and throw some personal stuff out there.

The first thing that happened was a comment from someone I work with. We were talking about the architecture for a large project and I was struggling a bit with how to overcome some hurdles. I naturally questioned whether I needed to get more into the code – to help things along. His response was refreshing:

Just remember the guiding principle is that your value to the organization is not in key strokes – it’s in thought.

This was fantastic to hear and I think it goes a long way toward validating the idea that probably the most important thing that you can do for you is never stop looking for people or environments where you are valued.

Another thing that happened, which is dashCommerce related, is that Xerox has used dashCommerce for their new online store. They have done a great job at skinning the site and it looks great! I wish them the best – and I think it is important to note that the mouse / windows you are using to read this were originally created at Xerox PARC – a division of Xerox Corporation. This, in my opinion, is a pretty great validation of dashCommerce 3.0.

Finally, I have been spending a lot of time outside of Microsoft technologies and I am really grateful for the experience. That’s not to say there is anything wrong with Microsoft technologies – to the contrary – I still think they are great, but there is a huge amount of value in moving out of that space to see how others do things.

I don’t know about you, but I go through cycles of discovery and development. By this I mean, I usually go on a reading binge of new things to check out. This is usually coupled with small prototypes to get the feel for a technology and evaluate it. I’ve also spent a good amount of time writing a loosely coupled ORM that I wanted to use for dashCommerce development, but with the recent announcements from the ADO.NET team here and here, I wonder if there is a future for something like this? I was going to open source it with the MIT license. It’s pretty small at 82KB right now. It works, but there is some refinement that needs to go into it. Anyone interested? :)

And of course, the arrival of Harrison (our 2month old little boy!) has added a lot more to my overall gratefulness that I have a happy and healthy family!

Let the good times roll! :)

DotNetKicks Image

Software Development and Idea Generation

October 24, 2008 at 4:11 pm | In Coding | 2 Comments

From Steve McConnell’s blog:

"It’s like in software design when you’ve been considering numerous mediocre design solutions and carefully studying strengths and weaknesses and deciding which lesser evil you want to go with. And then finally somebody says, "What if we just do this?" And you slap your forehead and realize that it should have been obvious the whole time, except that you’ve spent hours thinking about it and it wasn’t obvious at all until someone else had the idea."

So, it looks like Linq, …

var configurationData = from ConfigurationData o in unitOfWork
                        where o.ConfigurationDataId == configurationDataId
                        select o;
return configurationData.Single();

… smells a little like SubSonic,  …

Order order = new Order();
order.OrderGuid = Guid.NewGuid();
order.OrderTypeId = 1;
order.OrderParentId = 1;
order.OrderStatusId = 9999;
order.ShippingAmount = 10;
order.HandlingAmount = 10;
order.IPAddress = "127.0.0.1";

… tastes a little like LightSpeed, …

using (var unitOfWork = context.CreateUnitOfWork()) {
  var configurationData = from ConfigurationData o in unitOfWork
                          where o.ConfigurationDataId == configurationDataId
                          select o;
  return configurationData.Single();
}

… and it weighs in at a lean, mean 92KB.

What is it?

DotNetKicks Image
Next Page »

Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.