|
try it!
you will improve you C# knowledge!
or maybe read better... it's a double nested loop
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.
|
|
|
|
|
That code was written simply to make a point, it's not "real" code, so it doesn't qualify as a Coding Horror.
|
|
|
|
|
Maybe someone was just trying to test something and forgot to yank out the code?
One can dream right....
|
|
|
|
|
(You need to follow the link.)
|
|
|
|
|
|
"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
|
|
|
|
|
I've programmed for over 10 years. The old BASIC, like GW-Basic or BasicA, yes I can honestly say that goto came in handy. However, I never once used it in C,C++, VB.NET or C#. Never. Since all modern languages have a Continue statement and a Break statement (for loops), I never needed a use for a goto.
The reason, I'm guessing, that its not being removed in modern languages is to keep it compatible with old code. Very rarely does a language "lose" a command. They keep them so old code is compatible.
|
|
|
|
|
It's an understatement to say that "goto came in handy" in the old style BASIC. You had to use GOTO because the language was severely lacking in control flow. DO ...LOOP didn't exist, so you had to make those loops with GOTO . SELECT CASE didn't exist, so you had to use ON ...GOTO . Multi-line IF statements didn't exist, so you either had to cram everything on one line or use GOTO . And exceptions didn't exist, so you used ON ERROR GOTO .
So you ended up with code like this, filled with GOTO . And furthermore, line numbers were mandatory on every line, so it was very difficult to tell which lines were GOTO targets and which weren't.
And this is what caused all the animosity towards the GOTO statement.
|
|
|
|
|
LMAO!!!!
Didn't release it even existed in c#!! Love it!
That will show those annoying OO purest with their fancy classes and methods and thingies!!
Go the GOTO!
|
|
|
|
|
for... do... while... return... switch... if... else... are all glorified GOTO statements. They all translate to assembler JMP by compiler.
|
|
|
|
|
We ran into the following nice bit of code.
public static bool UniqueAssetNo(int assetId, string assetNo)
{
try
{
string sql = @"Select Count(*) " +
@"From (Select AssetId, LoanNum " +
@" From Asset (NOLOCK) " +
@" Where ({0} = 0 Or AssetId <> {0}) " +
@" And (LoanNum Not Like '%[A-Z]%') And LTrim(RTrim(LoanNum)) <> '') qry " +
@"Where Cast('{1}' As bigint) = Case When qry.LoanNum = '' Then 0 else Cast(qry.LoanNum as bigint) end";
...
...
What do you think? :P
|
|
|
|
|
Glad I haven't eaten yet.
|
|
|
|
|
Aside from the obvious, you might also want to do some reviews for SQL injection vulnerabilities.
|
|
|
|
|
pretty much sums it up, here too.
Andrew Rissing wrote: do some reviews for SQL injection vulnerabilities
Yes, they should. They ought to do a search on this site for Colin Mackay's article on such topic
"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
|
|
|
|
|
http://xacc.files.wordpress.com/2008/10/helpme.png[^]
I think I need to give the office a crash course in R E F A C T O R I N G.
Note: The #2 version is simply a copy/paste of the first with a bit of extra functionality. Honestly, I would not let anyone even see the code inside.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Nice. Anyway I strongly doubt the developer who created such brilliant method names will agree about the need of refactoring.
Well, I forgot you're the boss!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: Well, I forgot you're the boss!
The author of the code is my boss (the IT Director) ...
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
leppie wrote: The author of the code is my boss (the IT Director) ...
Oh, don't worry, I think his/her skills are well above the average ones of the IT directors I ever had.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
As a former boss of mine once told me: "People will be promoted to their levels of incompetence"
And as I've seen firsthand, if management likes someone who is a dumb as a stump, they will be moved into a position where they can do the least damage.
I don't claim to be a know it all, for I know that I am not...
I usually have an answer though.
|
|
|
|
|
..and there you have the recruitmentprocedure for management-positions in the banking-world
|
|
|
|
|
lol, have fun
|
|
|
|
|
Are you his boss?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Verb/Noun pair -- check! So what's the problem?
|
|
|
|
|
PIEBALDconsult wrote: Verb/Noun pair -- check! So what's the problem?
And the copy paste is just good re-use of code, right?
Bill W
Just because code works, it doesn't mean that it is good code.
|
|
|
|
|
And orthogonal too.
|
|
|
|