I just got greeted by this
-
private bool ContainsFilename(string reportfilename, string rdlcfilename) { return ((reportfilename.Contains(rdlcfilename)) ? true : false); }
:doh: Today is gonna be a long day...
xacc.ide
IronScheme - 1.0 RC 1 - out now!
((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition -
private bool ContainsFilename(string reportfilename, string rdlcfilename) { return ((reportfilename.Contains(rdlcfilename)) ? true : false); }
:doh: Today is gonna be a long day...
xacc.ide
IronScheme - 1.0 RC 1 - out now!
((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition -
Jeroen De Dauw wrote:
Just returning the value without casting it to boolean first! Definitely a horror!
That's the minor part :( The person should just be calling
string.Contains()
. Now I have to fix this crap and 100's of similar crap pieces of code just to understand it.xacc.ide
IronScheme - 1.0 RC 1 - out now!
((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition -
Jeroen De Dauw wrote:
Just returning the value without casting it to boolean first! Definitely a horror!
That's the minor part :( The person should just be calling
string.Contains()
. Now I have to fix this crap and 100's of similar crap pieces of code just to understand it.xacc.ide
IronScheme - 1.0 RC 1 - out now!
((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Editionleppie wrote:
Now I have to fix this crap and 100's of similar crap pieces of code just to understand it.
Yeah, I hate working with superior programmers who write stuff like this that they can understand, but I can't. I still remember with awe the greatest programmer I ever worked with. Functions were hundreds of lines long, at his best he could write functions that were thousands of lines long. I would just gaze at it like a dog that's just seen a card trick, but he would roll up his sleeves and fix problems all day long. Not a try or a catch to be seen. Why would he need them? Only losers hit exceptions. Yeah, he was a fricken genius. -Rd
Hit any user to continue.
-
leppie wrote:
Now I have to fix this crap and 100's of similar crap pieces of code just to understand it.
Yeah, I hate working with superior programmers who write stuff like this that they can understand, but I can't. I still remember with awe the greatest programmer I ever worked with. Functions were hundreds of lines long, at his best he could write functions that were thousands of lines long. I would just gaze at it like a dog that's just seen a card trick, but he would roll up his sleeves and fix problems all day long. Not a try or a catch to be seen. Why would he need them? Only losers hit exceptions. Yeah, he was a fricken genius. -Rd
Hit any user to continue.
Yeah, I have worked with several programmers like that. They usually impress management because they are so "productive". They create very large amounts of code. Code that is not robust, very difficult to maintain and contains hard to find bugs, but those things are not important after all. :sigh:
Just because the code works, it doesn't mean that it is good code.
-
private bool ContainsFilename(string reportfilename, string rdlcfilename) { return ((reportfilename.Contains(rdlcfilename)) ? true : false); }
:doh: Today is gonna be a long day...
xacc.ide
IronScheme - 1.0 RC 1 - out now!
((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth EditionI can't see the problem, logically it works: if the reportfilename Contains rdlcfilename is true, return true, otherwise return false :Laugh: Truly awful. If I'm honest, I've written a few functions like this, but only in the middle of a protracted refactoring session in the middle of the night. Next morning such functions do tend to "disappear" before other people see them :-).
-
Jeroen De Dauw wrote:
Just returning the value without casting it to boolean first! Definitely a horror!
That's the minor part :( The person should just be calling
string.Contains()
. Now I have to fix this crap and 100's of similar crap pieces of code just to understand it.xacc.ide
IronScheme - 1.0 RC 1 - out now!
((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition -
private bool ContainsFilename(string reportfilename, string rdlcfilename) { return ((reportfilename.Contains(rdlcfilename)) ? true : false); }
:doh: Today is gonna be a long day...
xacc.ide
IronScheme - 1.0 RC 1 - out now!
((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth EditionIf you are going to make a method that simply calls a method and then returns its result (well a new instance) you should go all out and add more lines of code for "Efficiency"! Make it a if check and check each case seperately cause it may change somehow ;)
private bool ContainsFilename(string reportfilename, string rdlcfilename)
{
bool result;
if(reportfilename.Contains(rdlcfilename))
result = true;if(!reportfilename.Contains(rdlcfilename)) result = false; return result;
}
Using this method I can get my 60,000 lines of code up to atleast 500K lines! Now I look smart :-\
Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.
-
If you are going to make a method that simply calls a method and then returns its result (well a new instance) you should go all out and add more lines of code for "Efficiency"! Make it a if check and check each case seperately cause it may change somehow ;)
private bool ContainsFilename(string reportfilename, string rdlcfilename)
{
bool result;
if(reportfilename.Contains(rdlcfilename))
result = true;if(!reportfilename.Contains(rdlcfilename)) result = false; return result;
}
Using this method I can get my 60,000 lines of code up to atleast 500K lines! Now I look smart :-\
Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.
But only to management.
I wasn't, now I am, then I won't be anymore.
-
If you are going to make a method that simply calls a method and then returns its result (well a new instance) you should go all out and add more lines of code for "Efficiency"! Make it a if check and check each case seperately cause it may change somehow ;)
private bool ContainsFilename(string reportfilename, string rdlcfilename)
{
bool result;
if(reportfilename.Contains(rdlcfilename))
result = true;if(!reportfilename.Contains(rdlcfilename)) result = false; return result;
}
Using this method I can get my 60,000 lines of code up to atleast 500K lines! Now I look smart :-\
Computers have been intelligent for a long time now. It just so happens that the program writers are about as effective as a room full of monkeys trying to crank out a copy of Hamlet.
You clearly forgot to litter the methods with Debug.Assert statements. Eg:
result = true;
Debug.Assert(result == true);You have to remember being very wary of the compiler, it has a mind of its own.
xacc.ide
IronScheme - 1.0 RC 1 - out now!
((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition