- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Admin
Recently someone I worked with wrote an API, then wrote some sample code to use the API. The sample code should have been fairly straight foward and simple and a dozen or two lines. Instead I get this behomoth of a file (ok so it wasn't that big, just huge relative to what it should have been) because this person believed you had to abstract everything and have a data layer and a model layer. So he create his data layer which abstracted away IDictionary. With one exception he had a 1 to 1 relationship between his methods and those in IDictionary (although he didn't surface all of the IDictionary methods) Good thing we used a dictionary concept to abstract away IDictionary.
Admin
His name isn't Mike XD
Admin
So, let's see. You've got a largish distributed application with an unusual choice of technologies and, deep enough in the stack, you are able to find the bug in it? Oh, yeah, that's a WTF.
Admin
Admin
Nah. Most likely it took less than a minute to search it. The 20 minutes would have been mostly to look at the screen in astonishment as it didn't find what was clearly in there -- and then to build the perfect magic-bullet regexp to match all variations and fiddling with nesting escapes to make sure it'd actually work.
Installing cygwin could easily have taken longer. Learning to use grep takes brainwashing and living for a year in a cave (and letting the Unix beard grow).Admin
Perhaps, but using Windows tools requires full on brain removal. So you'd still come out ahead.
Admin
Hmm, don't all these enterprisy frameworks and what not have an analogue of good ol' gnu's gettext?
Admin
It often takes me 20 minutes to run a search on some code. The reason? It's on a remote server in another office, connected via a crappy VPN.
As for the real WTF - it's that he is writing VB and SQL code and didn't know you could use COM objects from within SQL Server.
Admin
Also, have fun with the angry foreign customers whose application becomes more English with every release because messages get changed in the code but not in the translation file and thus don't get replaced anymore.
Admin
16756, 0, "Aktualizujem...%d" 16757, 0, "Vkladám...%d" 16758, 0, "Vymazávam...%d" 16762, 0, "#%d z %d"
(extracted from obe60sk.msg). I expect these put through a C 'printf' before the user sees them.
I find these rather cute: "I am updating...", "I am inserting...", "I am deleting...". "z" means "from" (or in this context "out of").
Admin
Admin
printf, see the following example.
That's a problem with any translated software, although you do have a point there. It's not perfect, but it's arguably a better way to do things than in TFA. It should be fairly trivial to also enable a debugging mode in the library/class/module/gizmo that handles translation to, for instance, log any messages that aren't translated. See example below.
Admin
That is exactly why I do NOT like functions, inheritance, classes, and all this shit. When you have to debug it takes ages to unfiddle all this stuff.
Admin
I agree! Functions are for chumps with short memories... viva la assembler!
Admin
I'm not saying it's the perfect solution. I'm just saying that it's one of many practical solutions. Certainly beats cryptic three-character codes buried in an infinite stack of COM-to-middleware conversion ... I think. Of course, you can always take the OP's original solution instead. If you prefer.
BTW, we had so much fun with the angry foreign customers that we co-opted them for translation. I believe this is what, in XP terms, is called "Siting The Customer" (one of twelve really brain-dead requirements, none of which make any sense, either together or separately).
C'mon, ya wanna keep the French up-to-date yourself, or ya wanna havve a free weekend in Paris?
Think outside the box, man. Or maybe, just maybe, improve QA on your release mechanism. Personally, I'd shoot the cunts.
Bottom line: it worked. Not perfectly, but not a shambles. You want perfection: either design it from scratch for I18N, or talk to God, and be a little less needy.
That's all I'm saying.
Admin
What happens when you need to add a new language and you need to get a translator (almost certainly not a coder) to trawl through potentially hundreds of source files to find the relevant text and add their own language version?
And won't source files end up getting swamped with hundreds of lines of "if" statements if you start supporting several different languages?
Also, have you ever tried to edit code with (right to left) Arabic text embedded in the middle?
The scheme in the article isn't the best implementation, but error codes and language resource files exist for a very good reason.
Admin
Sure you don't want text hard coded, but 3 digit codes? No way. How about a constant that actually means something?
Admin
Not to worry! There's certainly a second line of defense (and a third...) like all the tables having names like TableVarcharL3113 for orders and so one. The hacker would not be able to figure out how to do anything harmful except for maybe a drop table. And that would only make the developers happy.
Admin
I can't make the sentence make any sense to me.
Admin
It must have been a real "Master" who decided that "Betrayal of Master" led to a lower level of hell than anything else.
Admin
reminds me of an article in a game magazine: a company was working on a Baseball game, the program had a complicated mathematical formula for the movement of the baseball, one day someone made a small typo when editing the formula, a "-" instead of a "+"...and this REVERSED the entire curve-ball subroutine! that is, trying to make the ball curve left would make it curve right. an interesting example for how easy it is for bugs to slip into games.