|
What about the implementation in _presenter.Controller? Is it:
bool bMandatory = false;
bool CheckMandatory()
{
if (someCondition)
{
...;
bMandatory = _someMember.CheckMandatory(..., "Standard");
return bMandatory;
}
return false;
}
with only one other place that touches bMandatory :
bMandatory = CheckMandatory();
|
|
|
|
|
|
I don't know who their teacher was, but I have worked with several folk who must have and the same teacher!
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);
}
Today is gonna be a long day...
|
|
|
|
|
O_o! Just returning the value without casting it to boolean first! Definitely a horror!
|
|
|
|
|
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.
|
|
|
|
|
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.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
Apologies, apparently I forgot to include my sarcasm sign.
|
|
|
|
|
I can't see the problem, logically it works:
if the reportfilename Contains rdlcfilename is true, return true, otherwise return false
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 .
|
|
|
|
|
|
But only to management.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
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.
|
|
|
|
|
Or maybe Pascal.
class A
{
private:
public:
bool operator==(const A &rhs) const { return (this == &rhs); }
bool operator=(const A &rhs) const
{
}
bool operator!=(const A &rhs) const { return (!operator=(rhs)); }
};
|
|
|
|
|
Awesome! Just what I need to make my code work.
.....................
Life is too shor
|
|
|
|
|
Seriously, this should be outlawed. Why use redefine the == operator to compare the addresses, not the values, of the operands? Why redefine the assignment operator to perform a comparison? C++ might be thought to be a horrible language by some (sometimes including me), but why make it even worse by redefining operators to have inconsistent semantics?
I truly desire that the author of that code die a horrible death.
Eduardo León
|
|
|
|
|
Right. It's a kind of booby trap.
But I was surprised rather than being angry when I found it.
|
|
|
|
|
How embarrassing, I did not immediately notice the issue with "redefining ==" - you are rewarded with a free book tip, Jeff Johnson's latest "Designing with the Mind in Mind", might be alternately titled "Don't even TRY to make me think". This is a brief very-well-edited book, if you haven't got a lot of time the book-price for this slim volume is OK because you learn a lot in few pages, there's no "padding". Also on the same topic, somewhere in Gary Kasparov's "How Life Imitates Chess", he describes how he carefully designed his first try at a chess website, because after all who could be expected to think more than world-class-chess-player-wannabe's. But the usability cameras captured these folks just instinctively clicking without a conscious thought, the way we all do, sigh.
pg--az
|
|
|
|
|
pg--az wrote: How embarrassing, I did not immediately notice the issue with "redefining ==" - you are rewarded with a free book tip, Jeff Johnson's latest "Designing with the Mind in Mind", might be alternately titled "Don't even TRY to make me think". This is a brief very-well-edited book, if you haven't got a lot of time the book-price for this slim volume is OK because you learn a lot in few pages, there's no "padding".
Thanks. I am good at designing consumable classes/services/subsystems/frameworks that do not make programmers think more than they are supposed to, and sometimes make them think less. Perhaps because I am a fellow programmer, and I especially like systems programming. On the other hand, I am terrible at designing user interfaces that do not make users think more. Designing user interfaces is more of an art than a technical discipline, especially if your users are not engineers, accountants or finance guys.
pg--az wrote: Also on the same topic, somewhere in Gary Kasparov's "How Life Imitates Chess", he describes how he carefully designed his first try at a chess website, because after all who could be expected to think more than world-class-chess-player-wannabe's. But the usability cameras captured these folks just instinctively clicking without a conscious thought, the way we all do, sigh.
Help: First read without the parentheses. Then use the information in parentheses to add context/extra information/gratuitous pedantry.
Well, after having spent my whole childhood and adolescence believing I was inherently superior because I could do math and science (this is what gives you license to be pedant in first place, but, wait, there is more), learn languages with ease (by tackling grammar and syntax first, and only then vocabulary, unlike most people), play chess (I was second board of my first school's team (not because the guy on first board was stronger, but because he was more calm than I, and could handle losses better) and first board of my second school's team), understand music theory (which is nothing more than "applied" (for non-real world definitions of "applied") integer arithmetic modulo 12), tell a musical note right after I listened to it (aka absolute pitch, which I could have applied in real life to impress chicks by playing their favorite songs, but I had my own set of favorite songs, mainly Dream Theater "songs" back then, and I was like "I do not play the s*** you listen to"), and write computer programs (mostly programs that solved my physics homework assignments, hahaha, because I was too clever, see); I have finally come to realize that I make the same mistakes most people do on most situations, like clicking instinctively without a conscious thought (heh, this is why I use a Mac everyday and not, say, Linux); and even some mistakes most people simply do not do (like getting my girlfriend pregnant despite not having the means to support her?). Thus, why not take into consideration the fact people are just not clever, when designing things to be used by people?
Eduardo León
modified on Wednesday, October 20, 2010 10:45 AM
|
|
|
|
|
leonej_dt wrote: e believing I was inherently superior because I could do math and science
Yes, me too. But what might count even more is the "Visio-spatial tasks", like say picking up a pail of water with a "Cat 432 Backhoe-Loader". If you go to youtube and search for (( BBC Secret of the Sexes (part 2) )), you get the thumbnail of the woman in the cab with the yellow-hard-hat. This is a FASCINATING video, probably motivating you to go back and get the context from part 1, parts 3 and 4 are also great.
leonej_dt wrote: learn languages with ease
You're one-up on me there, but again if you goto youtube and search for (( tammet icelandic language )), the fourth hit mentions that Daniel Tammet learned icelandic in a week, to a sufficient conversational standard to pass muster on a TV Talk Show ! I forget exactly which of the videos shows snippets from his week-of-learning, and then the final TV appearance, but this is amazing. It motivated me to read his book "Embracing the Wide Sky" which contains great insight into how being multilingual really DOES have "spin-off" benefits in other areas, especially of course if you got thay way as a toddler.
Probably you should not dare to reply, these are the top tidbits on my personal armchair quest to get a meta-model of my own mind, but most likely we could continue WAY off-topic on this.
pg--az
|
|
|
|
|
|
The language doesn't, but maybe the author of this crapware does. What he should get instead is death by redefining his extremities as hamburger.
|
|
|
|
|
Proof of the old adage that you can write rubbish in any language. Just because you used a hammer to remove your own teeth, does not imply hammers are faulty.
|
|
|
|
|
A new low in obfuscation. Why use just the comparison operators when you can involve the rest in the task!! I'm curious what this person was thinking in doing this? Of course, there is the attendant fear of discovering what they were thinking.. I retract my question.
|
|
|
|
|
Just making some changes on my project, found this pearl on a catch block which was the subject, wrapper with the exception message and stack trace:
errormessages += "Fatal error. Please Restart. We are sorry." + sessionExp.Message + ";" + sessionExp.StackTrace;
|
|
|
|
|