KBD

Keith Devens .com

Tuesday, December 2, 2008 Flag waving
There are two ways of constructing a software design; one way is to make it so simple that there are... – C. A. R. Hoare
← More griping about ASP.NETJohn Batchelor: Prelude to War →

Daily link icon Thursday, August 10, 2006

Lazy programming

"Delete 1 message(s)"

← More griping about ASP.NETJohn Batchelor: Prelude to War →

Comments XML gif

Keith Gaughan (http://talideon.com/) wrote:

Lazy programming in a program that's hardwired for English, yes, but you just try and get that working in Polish or Russian: it's a whole lot harder...

∴ Keith Gaughan | 10-Aug-2006 3:25pm est | http://talideon.com/ | #9590

Revence 27 wrote:

Yeah. You're right, Keith (Devens). I friggin' hate to see that. I hate wrong grammar, but if you are going to type a line just once and it will run for 5 billion years, why don't you take the trouble to make things neat?
On the other not-just-appending languages, I'd still use a nifty high-order function.
Awful and lazy, that.

∴ Revence 27 | 13-Aug-2006 5:17am est | #9592

cyba wrote:

@revence,
make it better then, could you? would be nice to see that... greetings

∴ cyba | 13-Aug-2006 9:43pm est | #9593

Revence 27 wrote:

To Cyba:

printf("Delete %d message%s", msg_num, (msg_num == 1 ? "" : "s"));
If, with correct grammar, zero is a plural (and it is).

I'm writing this on phone, so I can't go any further than that.

∴ Revence 27 | 15-Aug-2006 5:48pm est | #9600

Keith Gaughan (http://talideon.com/) wrote:

Now, try doing that so it copes with both English and French. When you get that, try Bulgarian (dual numbers, yay!), Polish (bizarre agreement based on number and gender, woohoo!), and a bunch of other languages. And that's just the easy stuff.

Revence, you know more languages than English surely? At the very least I'd assume you're familiar with Swahili and Luganda, right? In Luganda alone, I know that different words are used for the various digits depending on the noun class they're used with. You should know better than assume it's that easy for all languages. Getting this sort of thing right for more than one langauge, and even just one language in some cases, is hard.

∴ Keith Gaughan | 16-Aug-2006 7:27pm est | http://talideon.com/ | #9603

Revence 27 wrote:

To Keith (Gaughan):

Yep. Hey, do you know everything? Now that's when a high-order func comes in. I'm the cafe, and I can't test the code, and I'm running out of minutes, but see this:

char * translater(char * from, char * to, char * (* translater) (char *, char *));

Yes, func pointers. Something like that. And then that func pointer can have a switch to deal with individual strings to translate (gets dirty, even with more decentralisation), or a formula, in the case of easier languages.
I never expect things to stay neat when I am dealing with many languages. It must get dirty. Must. If you want correct grammar, anyway. And I'm a shivering freak for correct grammar.

Or:

printf("Messages to delete: %d\n", msg_num);

That's usually cleaner, and it works in many langauges. (Yes, I have had to code for Luganda, English, French and Swahili, usually scripts for local websites -- you are a friggin' prophet! From the Isle of Saints and Scholars, after all! Matter of fact, it's on my agenda to write the first language based on an African tongue.)

∴ Revence 27 | 17-Aug-2006 11:55am est | #9606

Keith Gaughan (http://talideon.com/) wrote:

Yep. Hey, do you know everything?

I thought my omniscience would be well-established at this point. Smiley

Now that's when a high-order func comes in.

Or maybe you should use something like GNU gettext?

That's usually cleaner, and it works in many langauges.

...but rather unnatural, and even that kind of thing doesn't work with all languages.

∴ Keith Gaughan | 17-Aug-2006 4:00pm est | http://talideon.com/ | #9607

Revence 27 wrote:

I thought my omniscience would be well-established at this point.

It certainly is. The worst part of this is that I actually mean it.

Or maybe you should use something like GNU gettext?

Never used GNU gettext, but the reasons I didn't want to use it are:

  • I don't want to have to move a DLL around with my multi-lingual helloworld[.exe].
  • I look at such things as the least common denominator. They won't hack Luganda well, for example. I'm better off writing the mess myself. That seems, to me, like a losing battle. In the same way that you end up have to write ASM by hand in an optimised optimising compiler, you will end up having to tweak some things yourself. I'm one of a small handful of Swahili coders. Makes life hard.
  • (And this is the most important) I'm not in the mood to learn a tool so I can write a program in the language I speak to my Mum!
∴ Revence 27 | 20-Aug-2006 12:34pm est | #9614

Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

December 2008
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
28293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 6 posts

Recent comments XML

new⇒Perl 6 1.0 in March?

Doh, my mistake. I'm aware of the​relation between Parrot and Rakudo​but I'...

Keith: Dec 2, 1:03am

Free image hosting sites

Well, TinyPic has this in its​FAQ:

> Images and videos is in​your accoun...

Keith: Dec 1, 1:13am

Join a NameValueCollection into a querystring in C#

Well with a lamba expression, this​is what I came up​with:

?!code:csharp...

Gustaf Lindqvist: Nov 30, 4:38pm

Why no generic OrderedDictionary?

Check​http://www.codeproject.com/KB/recip​es/GenericOrderedDictionary.aspx?d...

Gabrielk: Nov 27, 6:57am

WhatIsMyIP.com

http://www.thesysteminfo.com is​another good alternate to​whatismp.com... I...

Kripz: Nov 26, 8:51pm

Girls, please don't get breast implants

Actually I think it's sweet when a​man loves a woman whether she's big​or n...

218.186.12.228: Nov 26, 9:40am

Generated in about 0.185s.

(Used 8 db queries)

mobile phone