|
Eddy Vluggen wrote: Throwing ex;
As I understand it there's no difference between throw and throw ex in Java, but there is in C#. I suppose that will catch out anyone moving from Java to C#.
Kevin
|
|
|
|
|
Well, my whole system does nothing but Throw (not Throw Ex, or Throw New Ex).
At the top there is an unhandled exception handler, which:
- Shows the error in a message box
- On OK it closes the current program down
- Waits several seconds, then
- restarts the program and puts the user back to (roughly) where they were.
The users prefer that, and there have been very few cases where they got stuck in a loop.
When it did happen, I soon heard about it.
Almost every time they got what they call a "restart", was due to some kind of service fail, LAN, DB, internet, etc.
Most of which self righted fairly quickly.
|
|
|
|
|
D) Use GOTO.
E) Systems Hungarian
But I'd like to add, that you also need to know when to break the rules.
|
|
|
|
|
So, when do you use Systems Hungarian?
Or worse, Apps Hungarian?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
Shouldn't you ask Nagy?
|
|
|
|
|
I'm not going to ask Nagy anything, he might still be upset about the goulasj
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
That is Joels' take.
I rather not see prefixes at all. I can imagine the type, if you're reading from a printout and taking a ... walk, but not "Apps", where different abs got different meanings for each product.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: where different abs got different meanings for each product.
That's the whole point.
|
|
|
|
|
GOTO can be useful and there are moments where it is needed. Misusing it can result in spagetti code I know but...
I would like to see you coding in LAP (PLC) or assembly without JMP instructions...
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
That's why I added the second sentence.
|
|
|
|
|
mmmm... ok. I forgive you
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
There's an example in Code Complete (first edition at least) where they provide a code example using Goto. Apparently almost no-one was able to rewrite the code correctly without using Goto.
Kevin
|
|
|
|
|
Jörgen Andersson wrote: D) Use GOTO. so break and return are not to be used?
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
They all become jumps in the end.
Breaks, returns and exits have a quite lower probability of becoming pasta.
|
|
|
|
|
Those are not goto s.
Aside: While simplifying some code this week I removed a switch (that was inside a while ) ... and later realized that I hadn't removed a break that was left over.
I really dislike that break operates on switch -- I hope DMR's harp gives him blisters.
|
|
|
|
|
True - back when I was at university in the late 80's we were taught 'structured programming' and anything that threw you out of an iteration was forbidden, until year two when we were told that there were circumstances where there was not other option.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
GuyThiebaut wrote: anything that threw you out of an iteration was forbidden
But break goes only to the end, not somewhere completely different, it's structured (still prefer to avoid it though).
|
|
|
|
|
I've used GOTO in driver development when it made sense. Generally speaking I don't use it but when it's needed there's nothing wrong with it.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music."
-- Marcus Brigstocke, British Comedian
|
|
|
|
|
More to the point: I have not seen a GoTo in the wild since VB6 - and even then only for err handling (On Err Goto).
I would seriously doubt that GoTo is a real problem in any .Net shop.
|
|
|
|
|
D) Storing numbers and datetimes as string in database / counfounding a value with its string representation.
E) Not reading the documentation of the objets used in the application.
F) Not checking/validating user inputs.
G) Copy-pasting a code from anywhere on Internet and expecting it to work without having to think about the requirement ; asking someone else to solve the problem when copied code does not behave the exact desired way (without defining the correct behaviour whatsoever).
I never finish anyth
|
|
|
|
|
D.1) Storing "numbers" as integers just because they're called numbers.
(Telephone numbers, social security numbers, etc.)
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
So true
I never finish anyth
|
|
|
|
|