Move Inflector?

2 views
Skip to first unread message

Chris Missal

unread,
Sep 13, 2009, 11:23:38 PM9/13/09
to castle-pro...@googlegroups.com
I see a benefit to moving the Inflector class which resides in Castle.ActiveRecord.Framework.Internal to another namespace. I've seen times when I wanted to use, but I didn't want to reference Castle.ActiveRecord. Thoughts?

Gauthier Segay

unread,
Sep 14, 2009, 10:41:39 AM9/14/09
to Castle Project Development List
Where do you plan to move it?

Chris Missal

unread,
Sep 14, 2009, 12:03:30 PM9/14/09
to castle-pro...@googlegroups.com
I was thinking somewhere in Castle.Core

James Curran

unread,
Sep 14, 2009, 4:53:02 PM9/14/09
to castle-pro...@googlegroups.com
It should go the same place as PascalCaseToWord, which is presently in
Castle.MonoRail.Framework.Helpers.TextHelper, but that's not
necesarily the best place for either of them. (Other methods in
TextHelper may want to move to a more general place)
--
Truth,
James

Mauricio Scheffer

unread,
Sep 14, 2009, 5:03:34 PM9/14/09
to Castle Project Development List
Castle.Core.TextUtils namespace? or something like that?

On Sep 14, 5:53 pm, James Curran <james.cur...@gmail.com> wrote:
> It should go the same place as PascalCaseToWord, which is presently in
> Castle.MonoRail.Framework.Helpers.TextHelper, but that's not
> necesarily the best place for either of them.   (Other methods in
> TextHelper may want to move to a more general place)
>
>
>
>
>
> On Mon, Sep 14, 2009 at 12:03 PM, Chris Missal <chris.mis...@gmail.com> wrote:
> > I was thinking somewhere in Castle.Core
>
> > On Mon, Sep 14, 2009 at 9:41 AM, Gauthier Segay <gauthier.se...@gmail.com>

Chris Missal

unread,
Sep 15, 2009, 1:50:08 AM9/15/09
to castle-pro...@googlegroups.com
+1 on moving it to Castle.Core.TextUtils. This seems to make the most sense to me.

Krzysztof Koźmic

unread,
Sep 15, 2009, 2:05:39 AM9/15/09
to castle-pro...@googlegroups.com
I'm only waiting for Ayende's input on this, knowing his opininon on
all the 'common' and 'util' kinds of libraries ;)

2009/9/15 Chris Missal <chris....@gmail.com>:

Henry Conceição

unread,
Sep 15, 2009, 2:40:01 AM9/15/09
to castle-pro...@googlegroups.com
It don't sounds good for me either.

Cheers,
Henry Conceição



2009/9/15 Krzysztof Koźmic <krzyszto...@gmail.com>:

Brian DeMarzo

unread,
Sep 15, 2009, 9:24:16 AM9/15/09
to Castle Project Development List
Drop the "Utils" prefix and maybe no one will notice: Castle.Core.Text

:)

Thought -- can some of those methods in Inflector (which are useful)
simply be extension methods to string?


- b



On Sep 15, 2:40 am, Henry Conceição <henry.concei...@gmail.com> wrote:
> It don't sounds good for me either.
>
> Cheers,
> Henry Conceição
>
> 2009/9/15 Krzysztof Koźmic <krzysztof.koz...@gmail.com>:
>
>
>
> > I'm only waiting for Ayende's input on this, knowing his opininon on
> > all the 'common' and 'util' kinds of libraries ;)
>
> > 2009/9/15 Chris Missal <chris.mis...@gmail.com>:

James Curran

unread,
Sep 15, 2009, 10:24:57 AM9/15/09
to castle-pro...@googlegroups.com
Also, if we are going to do something with Inflector, the first thing
should be to , well... fix it. It looks a lot some sample code from
a Regex reference manual. It has separate enties to handle "Sheep",
"buffalo", and "octopus" as special cases (Giving the wrong plural in
the last case; "octopus" is Greek, not Latin) How often are you going
of have a database table with one of those names?
--
Truth,
James

Chris Missal

unread,
Sep 15, 2009, 10:41:30 AM9/15/09
to castle-pro...@googlegroups.com
I like Castle.Core.Text better.

Also, I think extension methods are nice with this type of usage:

stringValue.Captitalized();

Alex Henderson

unread,
Sep 15, 2009, 4:34:05 PM9/15/09
to castle-pro...@googlegroups.com
On a side note - I use inflector in quite a few projects, but normally the version published on Andrew Peter's blog (http://andrewpeters.net/inflectornet/) which has some additional methods... if this does end up in the core could we pull in those extra methods (happy to supply a patch) - just so I can avoid duplication between the core and my projects... 

Agree that the inflector could do with some tidying up - is it worth considering multi-lingual support as well in some way?

I saw this a while ago...


... so it seems like there might be ActiveRecord etc. users looking to pluralize in different languages.

Daniel Hölbling

unread,
Sep 16, 2009, 6:41:43 PM9/16/09
to castle-pro...@googlegroups.com
Doing that in a multi-lingual way sounds like a rather herculean task to me. 

Another thing to consider here is that I don't see the point in making it easy to name classes and databases tables in another language other than english.
That should be hard because there is something fundamentally wrong with doing that. I have learned the hard way on past projects that this leads to lots of problems down the road (and yes my native tongue is german).

greetings Daniel

Alex Henderson

unread,
Sep 16, 2009, 10:18:06 PM9/16/09
to castle-pro...@googlegroups.com
Totally agree with your points - more just an off the cuff remark, I hadn't really put a lot of thought into it :)

All I was really thinking thinking about was that perhaps it should be relatively easy for someone to substitute a different implementation of inflector for use with ActiveRecord (for the model builder)... rather then say providing overloaded methods in inflector to pass in a language/culture... i.e. break it out into an implementation + interface + static / singleton instance method (so people can still use it without having to new up an instance if they like.. or inject it into the container as a service if they so wish...)

Cheers,

 - Alex
Reply all
Reply to author
Forward
0 new messages