|
When I started at my current company I was given a c# / oracle project and asked to rewrite it from scratch. I was told the guy who wrote it had been fired and everyone who had attempted to maintain the code had given up. I reakon I could have provided six months of content for the WTF web site from this single project. By far my favorite part was how he returned values from oracle stored procs to the application.
Every stored proc returned a var of type VARCHAR2_32_ARRAY, and looked something like this
CURSOR CUR_PARAMETERS IS
SELECT
CAST (
MULTISET (
SELECT
COLUMN_NAME_1 || ':' || COLUMN_NAME_2 || ':' || COLUMN_NAME_3
FROM
SOME_TABLE_NAME
WHERE
SOME_FIELD = SOME_VAL
) AS VARCHAR2_32_ARRAY
)
FROM
DUAL;
RESULT_VAR VARCHAR2_32_ARRAY;
BEGIN
OPEN CUR_PARAMETERS;
FETCH CUR_PARAMETERS INTO RESULT_VAR;
CLOSE CUR_PARAMETERS;
RETURN RESULT_VAR;
END;
then in the c# code we had things like this
private void ParseResults ( IDataReader p_reader)
{
while ( p_reader.Read () )
{
string _encoded_record = ( string ) p_reader [ 0 ];
string[] _fields = _encoded_record.Split ( new char[] {':' } );
double var1 = Double.Parse( _fields [ 0 ] );
etc etc etc
}
}
Interesting way of doing things to say the least
System.IO.Path.IsPathRooted() does not behave as I would expect
|
|
|
|
|
Old habits die hard.
It reminds me of:
At a job I had ten years ago, we were just switching from Oracle using PRO*C to Sql Server (6 I think) using ODBC. No one in the company knew anything about ODBC so a "consultant" was brought in and, as the story went, given two days to write us a library of functions we could use.
What he did, as the story continued, was copy examples from the floppy that came with an ODBC book. The functions returned the values as CSV strings! Management thought this was a perfectly usable solution.
When I started using it after others had been for six months or so I said something that can't be repeated in the Lounge. There was absolutely no way I was going to stand for it, but I didn't have much time to fix it, so I made it only marginally better... my versions of the functions returned the values as arrays of strings.
I left the company soon after, but had I stayed I was to be tasked with completely rewriting the library, I wish I had.
--| "Every tool is a hammer." |--
|
|
|
|
|
Just got a message box after the USER ID and password validation module took my inputs.
"You cannot have this password because USER ID 34C has chosen this password"
While porting a very old VB app to C++
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
If that was a real error message then that is one of the funniest things I've seen in software.
Brad
Australian
- Christian Graus on "Best books for VBscript"
A big thick one, so you can whack yourself on the head with it.
|
|
|
|
|
It is real and this VB app was written by a group of three college students some 2 years back. The company now wants our team to port it to C++. The app has an interface to manipulate database that stores information related to point of sale products. This list has to be frequently updated and so was the app designed. Various levels of users will have access to various functionalities in it.
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Be sure you keep the original message when upgrading, it is a very useful .
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Fantastic. Like the system I'm now working on, where the User table holds Password in plain text.
Only worse.
Superb.
|
|
|
|
|
You mean they forgot to include the user's full name, date of birth and CC number(s) in the message?
That's just sloppy.
|
|
|
|
|
Yes. How mean of them! LOL.
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
In their defense, you deserve to know who has been using your password all this time.;P
|
|
|
|
|
That is very dumb! Unless they use the password as PK, but then again, that would be dumb as well.
|
|
|
|
|
In a control system that relies upon inter-process communication it is important to log the messages that are sent for debugging purposes. In the code that sends the message I found that the message that was to be sent was logged, then sent. This causes the problem of indicating that the message was sent despite the status of the connection.
The testers who tested this system and reported the problem were told that this was not an important issue and that the problem could not be found by the developers who created the code. Being present during that discussion, I had to walk away.
Phil
-- modified at 9:22 Thursday 8th March, 2007
|
|
|
|
|
It's not clear what problem you're talking about.
--| "Every tool is a hammer." |--
|
|
|
|
|
I think he meant that whatever the result of the actual message sending, the log indicated that the message was successfully sent! This is huge and I can only imagine his reaction when the original dev couldn't fix it!
LOL!
|
|
|
|
|
I always loved seeing something like that. Makes me think the people who wrote it had Attention Deficit Disorder. "OK, we have an important message to send, log that we sent it, now ... Oh!, Look! A spider on the wall!"
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Ah, the infamous spider excuse :P
|
|
|
|
|
Dave Kreskowiak wrote: Makes me think the people who wrote it had Attention Deficit Disorder.
I know exactly what you mean, but please note that there are also people with ADD who CAN program. I know even people who make such mistakes and don't have ADD or a simmilair thing. It's all about to keep your brains under control when you write some serious code.
By the way, most time the people with ADD are comming with the greatest solutions for serious problems. This because they do think more widely and see the problem from perspectives where 'normal' people even don't think about.
So let's respect each other and stay on topic.
|
|
|
|
|
Yeah, and I one of them. If you can't laugh at yourself, who can you laugh at?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Ok, thats making the things different.
For clearness, me 2. Now we can laugh together .
|
|
|
|
|
If only ADD was a factor in the implementation. There was a long winded "explanation" of why the code was implemented that way that contained "and, besides that situation will never happen."
As all good programmers know, if there is even a remotely possible path to a problem, it will occur. Its only a matter of time.
Phil
|
|
|
|
|
This is so minor it probably is a non issue but it bugs me.
If blnFlag = False Then
'Good
Else
Continue
End If This happens alot but I believe it is better to say
If blnFlag = True Then
Continue
End If
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
The bottom one is definitely better. Anyone who writes code like the first example you posted is confused and either needs a vacation or a book thrown at his face.
█▒▒▒▒▒██▒█▒██
█▒█████▒▒▒▒▒█
█▒██████▒█▒██
█▒█████▒▒▒▒▒█
█▒▒▒▒▒██▒█▒██
|
|
|
|
|
Uhm yeah, I think most developers are guilty of doing something like this at one time or another. It certainly isn't the end of the world. I've seen far worse than this in production code that is currently running around the world.
Phil
|
|
|
|
|
Both examples make me shudder. Why would you compare a boolean to True or False? It IS true or false.
|
|
|
|
|
Absolutely. Along the same lines, my pet peeve is
bool b;
if (condition)
{
b = true;
}
else
{
b = false;
}
what on earth is wrong with
bool b = condition;
Regards
- Roger
|
|
|
|