U4-3025 - Replace ShortStringHelper

Created by Stephan 02 Oct 2013, 14:07:53 Updated by Edward Bishop 28 Oct 2014, 13:12:13

Is duplicated by: U4-3021

Relates to: U4-5699

Most of the StringExtensions actual code has been moved into an IShortStringHelper, LegacyShortStringHelper, which has some issues. The code is not optimized, and it does stange things, when converting to CamelCase, PascalCase, etc. A new IShortStringHelper, DefaultShortStringHelper, has been created to solve these issues. We should start using it as the default IShortStringHelper.

Amongst other things: -proper Camel/Pascal/whatever casing -possible to configure per culture, per role ie url, alias -built-in utf8-to-ascii filter supporting almost all western-language characters -cleaner code

Risk: we ''can'' expect some users complaining that their aliases are not 100% the same but that should be edge cases...

Edit: marked as '''non backward compatible''' just in case of issues.

Comments

Stephan 02 Oct 2013, 15:06:30

Have moved in v6 with commit f64b8d6.


Stephan 02 Oct 2013, 20:20:25

Has been merged in v7 now.


Shannon Deminick 04 Oct 2013, 02:23:45

NOTE: Don't make things Feature(planned) or they show up on the agile board as 'swim lanes' (categories) that should have sub categories.


Emil Rasmussen 25 Oct 2013, 11:29:24

@Stephan Could you give some examples of the alias edge cases?


Stephan 25 Oct 2013, 12:25:55

@Emil:

  • "brô dëk" became "brdk" and now becomes "brodek"
  • "-foo-" became "-foo-" and now becomes "foo"
  • "Foo" camel-cased to "Foo" and now becomes "foo" And various little things like that. There are two classes, LegacyShortStringHelperTest and DefaultShortStringHelperTest, that try to illustate & test all those cases. Can find out more cases if you need (later, busy right now).


Emil Rasmussen 29 Oct 2013, 08:07:45

@Stephan Thanks!


Dirk 09 Jul 2014, 12:53:30

@Stephan I just realised that url segments have a different behaviour. For example Agosto in città becomes agosto-in-città. And I think this not what we want for urls as not all browsers handle utf8 chars properly. Is their a work around or setting?


Edward Bishop 28 Oct 2014, 08:31:32

How the hell is a hyphen an edge case! I have seen a many Umbraco installations with hyphens in template aliases. 12 of our own templates take the form BasicPage-1Column, BasicPage-2Column etc. These are referenced in various places throughout the site and this change has broken a large number of features and pages.

When you make a change like this it should be a lot more obvious. A breaking change that says "U4-3025 Replace ShortStringHelper" is completely useless.

It also doesn't alert the user when this happens in the UI so it appears to have saved as it still displays the hypen in the alias until the user manually reloads the template.


Edward Bishop 28 Oct 2014, 09:04:01

How the hell is a hyphen an edge case! I have seen a many Umbraco installations with hyphens in template aliases. 12 of our own templates take the form BasicPage-1Column, BasicPage-2Column etc. These are referenced in various places throughout the site and this change has broken a large number of features and pages.

When you make a change like this it should be a lot more obvious. A breaking change that says "U4-3025 Replace ShortStringHelper" is completely useless.


Stephan 28 Oct 2014, 09:22:12

@Edward: sorry to hear it's been a painful change - some sites I work on have been impacted too. Point is, the new helper differs from the old in so many very subtle ways that it was hard to document them all. Granted, that one could have been better documented.

About the UI: this clearly is a bug => http://issues.umbraco.org/issue/U4-5699


Edward Bishop 28 Oct 2014, 09:48:29

Removal of hyphens was clearly identified as a breaking/non backward compatible change here so what was the reason for removing them because as far as I can tell there isn't one?


Stephan 28 Oct 2014, 11:06:14

The drive behind that change was, align all aliases (in the past each thing that was an "alias" had its own aliasing method, each of them being subtly different) so they all follow one pattern, and make sure aliases can be used as tokens in all the languages we use (C#, JavaScript, XSLT...) without having to be "purified". And so a (somewhat arbitrary) decision was made to remove chars such as slashes, dots or hyphens from aliases. Yes, also slashes, that allowed ppl to use aliases such as "foo/bar" and have the template magically store itself in directory "foo". Not everybody likes that decision (and yes, it has broken some sites I maintain).


Edward Bishop 28 Oct 2014, 13:12:13

Fair enough. I'll read a little more carefully when I do the next update for potential breaking changes. Sorry for ranting, I had a few too many coffees this morning :)


Priority: Normal

Type: Task

State: Fixed

Assignee:

Difficulty: Normal

Category: Architecture

Backwards Compatible: False

Fix Submitted:

Affected versions:

Due in version: 7.0.0, 6.2.0

Sprint:

Story Points:

Cycle: