Template talk:Length conversion

From Wikipedia, the free encyclopedia

I suggest not to use monstrous code like this one here. Also beware of Wikipedia:template limits and read [1]. --Ligulem 23:07, 3 November 2006 (UTC)

With Mets501's help we have trimmed it down considerably (about 20Kb now), I don't it will run into the 1Mb limit just yet, though it is something to keep in mind and not thrown every obscure unit ever used in there... --Sherool (talk) 01:23, 4 November 2006 (UTC)
This is still very bad. 20kB for a template like this one here is not good. I would strongly recommend to not use this template here on articles. Idea for a compromise: could you try to create a set of templates instead of a switch matrix monster? For example: {{furlongs to meters}}, etc. Or if you disagree with that consider at least eliminating one level of the switches by doing {{to meters|from=furlongs|...}} or something. --Ligulem 00:03, 5 November 2006 (UTC)
Hmm, is the way {{flagicon}} works "better" than one big switch based template? It users 3 layers of meta templates, wich I understand is also a bit "naughty" since it forces multiple database lookups (though I see WP:AMT is marked as "rejected" now), but it works. If you for example call it with the parameter NOR it calls {{country flagicon}} with NOR as it's parameter wich in turn calls upon {{country flag alias NOR}} wich is a redirect to {{Country flag alias Norway}} wich contain the actual filename of the flag. Something simmilar could be done here to keep the expanded template size down (if I understand things corectly) to just the "branch" containing the relevant code for any given parameter combo. Allowing unlimited growth without much worry about the template limit. Personaly I'd hate to have to break it up into multiple "from foo to bar" type templates, a single multi purpose template is much better from a usability point of view. I know what you mean though, the the template limit become a very real problem if you try using this template in for example the List of mountains "article", by my calculations you can only use the template about 80 times on any one page before you hit the limit... --Sherool (talk) 01:40, 5 November 2006 (UTC)
As a software engineer, I can tell you that switches are not extensible (in OO programming languages they are generally replaced with virtual functions). As such the flagicon way is better. But you will get in trouble with people like Netoholic and friends, which are pushing WP:AUM. flagicon has the problem that it is complicated and thus difficult to understand. If you really want to encapsulate conversion ratios then please do it using the "from foo to bar" approach. --Ligulem 12:38, 5 November 2006 (UTC)

While this template looks clever, I think it is enough the give a mediawiki dev a heart attack. To be honest there is no reason to use this rather than just simply typing out the lengths by hand. Apart from being far too big for what it does, it would be confusing to newby editors to see it text. Martin 11:49, 5 November 2006 (UTC)

Mediawiki dev's won't get a heart attack. But they might disable switch someday if they are fed-up with templates like this one here. --Ligulem 12:38, 5 November 2006 (UTC)

See also Tim Starling's comment on VPT [2] --Ligulem 23:50, 7 November 2006 (UTC)

[edit] Don't use notice

I've added a notice to the template, which requests not using this template in articles. There is no consensus to use this template on articles, for reasons explained on this talk. As such I request to keep that notice until there is consensus about the use of this template. Thanks. --Ligulem 13:02, 5 November 2006 (UTC)

[edit] North-Eastern Swiss Alps

On North-Eastern Swiss Alps there was a pile of calls in the form {{dist|m|ft|..}} which I have converted to {{dist m ft|..}}. Nearly the same thing to type, but needs only a very short simple template [3]. --Ligulem 14:24, 5 November 2006 (UTC)