Just where has this language gone wrong?

Era Scarecrow rtcvb32 at yahoo.com
Tue Jul 24 15:38:06 PDT 2012


On Tuesday, 24 July 2012 at 06:40:14 UTC, Chris NS wrote:
> On Tuesday, 24 July 2012 at 02:51:44 UTC, H. S. Teoh wrote:
>>
>> Reminds of a certain individual who shall remain unnamed, with 
>> whom I argued about why he should *not* implement IPv6 prefix 
>> checking by converting the address and prefixes to strings and 
>> then using strncmp()... Truly boggles the mind.
>>
>
> I'm reminded of a close friend of mine... once he was asked to 
> review some code, after the sole author had spent a few weeks 
> on it.  I was lucky (?) enough to be in the room to hear him 
> actually say: "That's... cute.  Not *wise* but cute.  Do you 
> remember what functions are?"  I don't recall there being a 
> response.

  I remember seeing some stupid production code that was used at a 
company I worked at for a while. They were developing jsp pages 
as part of their training until they got sections hired out 
(sorta lowest bidder thing, where you would go to them rather 
than export work over seas).

  The code in question was to convert the input 16byte input from 
a database into it's GUID id as a text string in java. I don't 
remember it exactly, but it went something like...

[code]
//remember, java
String toGuid(byte input[16]) {
   String ID = "{";
   if (Integer.toHexString(input[5]).length < 2)
     ID = ID + "0";
   ID = ID + Integer.toHexString(input[5]);
   if (Integer.toHexString(input[6]).length < 2)
     ID = ID + "0";
   ID = ID + Integer.toHexString(input[6]);

//repeat for other 14 bytes, plus adding dashes and ending brace

   return ID;
}
[/code]

  It didn't help the company's Java class that they taught didn't 
go into low level operations like And and Or and bit shifting. I 
ended up rewriting it, then they wanted it 'super documented' 
because they couldn't understand what > were for. (I think there 
was more documentation commenting low level explanations of what 
it was doing than actual code).


More information about the Digitalmars-d mailing list