|
Naerling wrote: but you don't see me using OnErrorResumeNext or GoTo
If you did and I found out, you's get a virtual slap through the monitor from me...
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
A truly talented programmer can mess things up in any language, not only VB
|
|
|
|
|
Any chance at getting to normalize the table? If met with resistance from the customer about normalizing, sell the idea of performance benefits.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Yeah, it's going to be okay. Luckily. I found another table like that today (it's all the same schema, so we know where it's wrong).
Seriously, no table in the schema has any FK's. A few tables are like the one I described. And this is a vital part of our system!
It's an OO world.
public class Naerling : Lazy<Person>{}
|
|
|
|
|
I have once worked with a customer database that had tables with 40 columns, no FK and PK of type varchar(50). Heck the Names column was primary key, when I asked the client what'll happen if another guy joins the Org with same name as his, he was shell shocked.
|
|
|
|
|
You're right, it's not how we do things here, following procedure would require at least 10 primary key column! :P
Remember, it's more important to follow procedure than being actually productive!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
I just read a function code like this :
function MightyFunction(paramA, paramB, paramC)
! Lots of code here.
! But this is the magic.
Return retA
Return retB
The code is written in Centura 1.5, and the compiler compiled it successfully.
It's easy to laugh, but, it's so hard to smile ...
|
|
|
|
|
That would compile in Visual Studio also. Just a warning about "unreachable code detected".
|
|
|
|
|
I just can't imagine, what the intention of "double return"
It's easy to laugh, but, it's so hard to smile ...
|
|
|
|
|
I sometimes use kick-out returns to temporarily 'comment out' code I suspect of breaking things. You can still do it in C# (might be an error in Java, I forget), and obviously in things like JavaScript or PHP. Leaving one in is pretty bad though.
|
|
|
|
|
Hmm, for some reason that reminds me of the custom scripting language used in the game "Space Empires V"... one of its unique quirks was that a "return" statement did not actually terminate function execution! So the function you describe would in SE5 script wind up returning retB, because it's the last return statement to execute...
|
|
|
|
|
Pascal also has a non terminating return semantics, but it's much clearer than that (as could be expected from Pascal )!
'As programmers go, I'm fairly social. Which still means I'm a borderline sociopath by normal standards.' Jeff Atwood
'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail
|
|
|
|
|
Hmm, that would actually explain the SE5 language, as it does look quite a bit like Pascal... the guy who wrote the game was apparently primarily a Delphi programmer!
|
|
|
|
|
... the horrors in this WinForms app I'm working on...
catch (Exception ex)
{
string errormsg = ex.InnerException.ToString();
}
Nice big NullReferenceException for you there mister.
Other horrors include :
Three separate layers of DB access code, one in VB, on in the Business Logic Layer, and one in a separate assembly (Written in VB!)
|
|
|
|
|
Hey, look on the bright side - throwing a NullReferenceException in a catch block is better than just swallowing the original exception without logging or throwing anything else! :P
|
|
|
|
|
ekolis wrote:
Hey, look on the bright side - throwing a
NullReferenceException in a catch block is better than just swallowing the
original exception without logging or throwing anything else! :P
yeah, that's what made "On Error Resume Next" my least favorite phrase ever in a previous time.
|
|
|
|
|
ekolis wrote: throwing anything else
try{
}
catch(Exception ex){
throw new Exception("My crazy message");
}
This is what you mean right? I've seen people do this, but I always wonder why ? Isn't it heavy doing this?
V.
|
|
|
|
|
That is one way to do it, though I was thinking more along the lines of a custom exception, and (if it makes sense in the situation) including the original exception:
[code]
try {
// code here
}
catch (Exception ex) {
throw new MyApplicationCustomException("Oh no! Something went wrong! For more details see the inner exception...", ex);
}
[/code]
|
|
|
|
|
My current work project (code base from another company) is full of these, though wrapping in custom exception types and preserving the inner exception.
It makes sense when you want to add extra semantic information to the exception because you know the context in which it was called. It doesn't the amount they've done it (and it makes tracking down the actual point of failure a pain).
It is 'heavy', yes, but of the order of milliseconds, and if you're using exceptions properly (i.e. they are only thrown in exceptional circumstances) that doesn't matter.
|
|
|
|
|
Mel Padden wrote: Three separate layers of DB access code, one in VB, on in the Business Logic Layer
Yes, that is a horror itself. Last I checked, that what the Business Logic Layer is for, to be the bridge between the application and the database.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
People write this sort of stuff while debugging and forget to remove it. "Ok so what exception is being thrown. I'll write a try catch and see. Problem solved" but you forget to remove the catch statement.
Does any one know of a nice solution so you can debug but ensure that this sort of rubbish doesn't end up going out the door.
"You get that on the big jobs."
|
|
|
|
|
#if DEBUG
#endif
Not very clean, but somewhat safer.
'As programmers go, I'm fairly social. Which still means I'm a borderline sociopath by normal standards.' Jeff Atwood
'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail
|
|
|
|
|
|
|
Does any one know of a nice solution so you can debug but ensure that this sort of rubbish doesn't end up going out the door.
Only by using pre-compilation tags like #Const and #if-then-else. Set your constant to one value (say True) while debugging, then set it to False as you wind down debugging. C has a similiar capability with a few more options, and I used to use this facility to allow trace statements to appear during development and disappear at time of release simply by changing the value of a constant.
|
|
|
|