|
aspdotnetdev wrote: The word "Order" appears 4 times
Was it in bold? Maybe it was a (re)tired Web Developer who wrote this. [^]
Greetings - Jacek
|
|
|
|
|
Oh that kind of size, I see
|
|
|
|
|
A table in the live production environment:
CREATE TABLE setPaymentPlans
(
[cppDivision1] [varchar](12) NOT NULL,
[cppDivision2] [varchar](12) NULL,
[cppDivision3] [varchar](12) NULL,
[cppDivision4] [varchar](12) NULL,
[cppDivision5] [varchar](12) NULL,
[cppDivision6] [varchar](12) NULL,
[cppDivision7] [varchar](12) NULL,
[cppDivision8] [varchar](12) NULL,
[cppDivision9] [varchar](12) NULL,
[cppDivision10] [varchar](12) NULL,
[cppDivision11] [varchar](12) NULL,
[cppDivision12] [varchar](12) NULL,
[cppDivision13] [varchar](12) NULL,
[cppDivision14] [varchar](12) NULL,
[cppDivision15] [varchar](12) NULL,
[cppDivision16] [varchar](12) NULL,
[cppDivision17] [varchar](12) NULL,
[cppDivision18] [varchar](1) NULL,
)
Perhaps they thought adding another table for a one to many relationship would be one too many tables.
Also, you'll note the prefix of "cpp". I guess they changed the name of the table at some point and didn't feel like changing the prefix. Some people really need to learn how to use table aliases.
And I have no idea why that last one is a varchar(1) rather than a varchar(12).
|
|
|
|
|
FTFY
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Here I came to a code, which looks like a Horror Movie of C#:
public bool IsMatched(string str)
{
if(str.ToString().Equals("Customer"))
{
return true;
}
return false;
}
What this means? Is it really require? Go to hell.
Don't forget to Click on [Vote] and [Good Answer] on the posts that helped you.
Regards - Kunal Chowdhury | Software Developer | Chennai | India | My Blog | My Tweets | Silverlight Tutorial
|
|
|
|
|
Does that compile? or should it be public bool IsMatched(string str) .
If it is a bool then this function does the same as if (str=="Customer") maybe they wanted to write
public bool IsCustomer(string str)
{
return (str=="Customer");
}
|
|
|
|
|
Yes, it's "public bool".
My point here is in this line: if(str.ToString().Equals("Customer"))
What is the significance of doing ToString() in a string? I am going mad... Ahh!!!
Why people does this ToString() in a string variable?
Don't forget to Click on [Vote] and [Good Answer] on the posts that helped you.
Regards - Kunal Chowdhury | Software Developer | Chennai | India | My Blog | My Tweets | Silverlight Tutorial
|
|
|
|
|
no point, but it doesn't do any harm other than making the code slightly less readable. Also no need to call Equals directly could call ==
|
|
|
|
|
ARopo wrote: it doesn't do any harm
Unless the string happens to be null.
|
|
|
|
|
Possible operator overload??
|
|
|
|
|
It's not very big thing as your subject suggested
Life's Like a mirror. Smile at it & it smiles back at you.- P Pilgrim
So Smile Please
|
|
|
|
|
I got one better. The other developer here wrote:
DataRow Dr;
if( ((string)Dr["Col"]).ToString() != "false")
return true;
else
return false;
The biggest problem is that the value was stored in the database as a non nullable boolean value. She also wrote a stored proc that was more than 265 pages or roughly 5 megs worth of code. She didn't know how to write a query to test for null parameter so she wrote one query for ever parameter combination for the procedure that had 10 parameters. So effectively 2^10 number of combinations. I hope someone dumps her sorry behind, she gives programmers a bad name.
nothing
|
|
|
|
|
icestatue wrote: a stored proc that was more than 265 pages or roughly 5 megs worth of code
Bah!!!! Please tell me that is a typo. If not, lie to me please, or my head may explode. And our cleaning people have asked that I not do that any more, as they hate cleaning brain out of my office.
I can't even deal with 256 *line* sprocs, much less 256 pages.
Before .NET 4.0,
object Universe = NULL;
|
|
|
|
|
Afraid not, those numbers are correct. ....I'll bring the mop!
nothing
|
|
|
|
|
static void lpf_Null(void)
{
}
Mark Brock
"We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen
|
|
|
|
|
Is that function used inside the application or it was created just for a better and larger number of lines?
I have no smart signature yet...
|
|
|
|
|
No its used as a handler function in a state machine.
The function is really just a bi-product of the design... but still... I thought it was funny .
Mark Brock
"We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen
|
|
|
|
|
Agreed. State machines often need a null action when only the state transition is wanted. I've written plenty of 'em over the years, particularly in comms protocol implementations.
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
Peter_in_2780 wrote: I've written plenty of 'em over the years
Has your implementation matured over the years? I bet it must be close to perfect by now!
|
|
|
|
|
MarkBrock wrote: No its used as a handler function in a state machine.
The function is really just a bi-product of the design... but still... I thought it was funny .
Actually, I frequently used the same technique when I was programming in C - empty functions made good initializers for function tables, and if I wanted to track function calls all I had to do was add a trace of some sort to the empty functions.
|
|
|
|
|
Doing nothing is considerably better then doing some of the things that show up on this board
|
|
|
|
|
I have to agree. The man that wrote it is clearly some sort of relative genius.
|
|
|
|
|
I've created a few of those myself - sometimes it is a much better way than providing a special case. Think delegate that doesn't need a null test, for example.
At least it had a sensible name!
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
lpf_NoOp might be a better name.
|
|
|
|
|
PIEBALDconsult wrote: lpf_NoOp might be a better name.
From a logical perspective, I think the meaning and intention of "ptr = lpf_Null;" may be a little clearer than lpf_NoOp;" especially if there are places where the pointer will be checked against lpf_Null, but there are also places where it would be desirable to call it without having to check for the null case.
|
|
|
|