A Breaking Change?

June 11, 2007 17:31

So, this morning I began laying down a DAL against a massive legacy database and came face-to-face with bug that I'd been in denial about for some time:

Inflector.ToPascalCase() doesn't work.

This really isn't a surprise, as Phil Haack had annotated it back in February with the following unambiguous comment:

//TODO: What is this supposed to do? It doesn't convert "This Is My Word" to "ThisIsMyWord" -P.H. 2007.02.16


Phil is absolutely correct. But this creates an ugly dilemma: It doesn't do what it's supposed to do currently, but making it work the way it should could break a lot of applications. Let's talk specifics:

This method is designed to perform name transformations for cases where a table or column name is comprised of multiple words, separated by underscores or spaces. By convention, all generated property and class names are passed through this transformation. While the space do ultimately get removed downstream by other methods, the fact that they aren't done within this method means that casing is never handled the way it should be. 

 A few examples:

Table Name Remove Underscores? The way it works now The way it should work
order history false Order history OrderHistory
order history true Order history OrderHistory
order_history false Order_history Order_History (?)
order_history true OrderHistory OrderHistory
Order_History false Order_History Order_History
Order_History true OrderHistory OrderHistory
ORDER_HISTORY false ORDER_HISTORY Order_History
ORDER_HISTORY true ORDERHISTORY OrderHistory
ORDERHISTORY false ORDERHISTORY Orderhistory
ORDERHISTORY true ORDERHISTORY Orderhistory
orderhistory false Orderhistory Orderhistory
orderhistory true Orderhistory Orderhistory

 

So you can see the problem. I'd love your feedback on this one. Can we all collectively bite the bullet on this one and make a one time correction? Or is the sinking feeling in my stomach that we're going need a configuration option to support "legacy behavior" well founded?


9 Comments
Actions: E-mail | Permalink | Comment RSSRSS comment feed

Related posts

Comments

June 11. 2007 19:09

Remmus

Personally I'd be ok with the change.

I think the product is still 'young' enough to make these, specially when it is working out a bug and not change for the sake of change.

There will only be a problem for those who decide to upgrade and I think people would be ok with a little extra work at this stage.

If are do decide to do it I would suggest this be the time you make any other breaking changes too, like with the Where clause talked about recently. Consecutive breaking changes would be much more of a pain than getting it all out of the way in one go.

Remmus

June 11. 2007 20:23

Ibleif

I vote for the change! When people upgrade versions they should expekt a little work. I also vote for the Where change on the same set (if you guys have made up your mind)

Ibleif

June 12. 2007 03:09

adminjew

I vote for the change.
I think it should do what it is supposed to do

adminjew

June 12. 2007 04:23

Jay Turpin

Let's do it. It's not going to get any easier.

Jay Turpin

June 12. 2007 04:27

Bob Baker

Based on my post the other day where I essentially ran smack dab into this, I think you know I'm all for this fix.
For those of you following at home, essentially, Orders_ShoppingCart was converted to ShoppingCart (which I didn't want) with the default RemoveUnderscores setting of true, and because there already was a table named ShoppingCart, I never got the desired table into SubSonic until I set RemoveUnderScores false. Now I have Orders_ShoppingCart, which is fine, but I think this fix would remove the issue I encountered as well.

Bob Baker

June 12. 2007 13:08

Eric Kemp

Bob, I think you may be dealing with a different problem there, which I'd like to get to the bottom of. Feel free to contact me directly. I'd be happy to take a looks at anything you'd like to send - SQL scripts preferred... Smile

Eric Kemp

June 12. 2007 14:36

Justin M. Keyes

i say bite the bullet

Justin M. Keyes

June 28. 2007 03:09

Zharfan Mazli

no problem for me

Zharfan Mazli

November 14. 2007 17:06

Frenk

Interesting site. Found it on Google. Thanks for sharing all this great information. Keep up good work!
http://inuyashahentai.cn/index.php?p=4">inuyashahentai
http://finalfantasymanga.cn/index.php?p=4">finalfantasymanga
http://sailormoonmanga.cn/index.php?p=4">sailormoonmanga

Frenk

Comments are closed