|
UWP APPS = evil
There's a very good reason why folks download Win7 CALC & Spider Solitaire.
Download the CALC & install on Win10, then run both side-by-side
|
|
|
|
|
Any UI code or references inside a viewmodel stinks, is ugly, and is totally unnecessary with good MVVM design, especially in WPF.
|
|
|
|
|
Then there is "business logic" and there is "plumping".
Is it necessary to note there is a difference?
I find it amusing that someone will spend "days" trying to avoid writing a single line of "code-behind" when confronted with a pattern that may deviate from your typical "view binding"; even if it has nothing to do with "business rules".
The "user" doesn't care that your idea of MVVM is "purer" than someone's else's; they're concerned you're spending all your time on "fringe" cases instead of solving their "business" problems.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Have you ever used the decorator pattern? I use to love MVVM - but IMO decorator pattern kills it every time for ease of use and clarity and most importantly making changes and upgrades for future features.
|
|
|
|
|
So apparently:
UWP = evil
WPF = half-baked and too steep of a learning curve.
WinForms = too old and obsolete
Now what?
|
|
|
|
|
Dennis_E wrote: Now what? 42
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.
|
|
|
|
|
|
bool isOffset = new bool();
if (reader["foo"].ToString().ToUpper().Trim() == "BAR")
isOffset = true;
else
isOffset = false;
I'll stop now.
Marc
|
|
|
|
|
Please, for the love of bacon, STOP POSTING THIS CRAP!
|
|
|
|
|
Dave Kreskowiak wrote: Please, for the love of bacon, STOP POSTING THIS CRAP!
It's about the only way that I can stay sane. Thank goodness I have TW&TW as an outlet for my pain.
Marc
|
|
|
|
|
Marc Clifton wrote: It's about the only way that I can stay sane.
Cheech and Chong may have something to help with that.
Wait a minute. For some reason I can hear Tommy Chong's voice when I read that code. Sounds about right.
|
|
|
|
|
Too bad he/she(it?) didn't have "bar" in the initial quotes. Then you could have replaced the construct with
bool isProgrammerCompleteFnIdiot(true);
Sudden Sun Death Syndrome (SSDS) is a very real concern which we should be raising awareness of. 156 billion suns die every year before they're just 1 billion years old.
While the military are doing their part, it simply isn't enough to make the amount of nukes needed to save those poor stars. - TWI2T3D (Reddit)
|
|
|
|
|
David O'Neil wrote: bool isProgrammerCompleteFnIdiot(true) || isProgrammerNew() FTFY
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Syntax error: expecting '{' after ')'
#SupportHeForShe
Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson
You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
|
|
|
|
|
Please post your question in Quick Answers.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Just in case your bools give you a NullReferenceException.
And your BaR s have trailing spaces and lower cases.
And you really need those if else statements...
Just out of curiosity, are you sure Trim() also trims uppercased spaces?
|
|
|
|
|
You joke, but I've seen code that "uppercased" spaces to \0
|
|
|
|
|
That is legitimately frightening
|
|
|
|
|
A little pointless but not too crazy. bool is just an alias for System.Boolean . The else was the silly part.
Boolean isOffset = new Boolean();
if (reader["foo"].ToString().ToUpper().Trim() == "BAR")
isOffset = Boolean.Parse(Boolean.TrueString);
Though I suspect unlike above that true and false are probably aliases for pre-defined constants. Couldn't find documentation on how they're created; above was just a guess using public Boolean members. Also true and false are operators that can be overloaded to create nullable types prior to .NET 2.0 (Nullable<T> ).
Of course it's still silly to do it this way. bool is shorter to write and using true and false is both clearer and shorter.
modified 31-Jan-17 16:53pm.
|
|
|
|
|
This goes well with a comment such as
|
|
|
|
|
Well, the whole thing could be reduced to
bool isOffset = reader["foo"].ToString().ToUpper().Trim() == "BAR";
Why couldn't the programmer see that? Why didn't someone in the 2+ years that this code has been in production fix it?
Marc
|
|
|
|
|
Very true! I was just pointing out that new bool() isn't as crazy as it looks at first glance
|
|
|
|
|
Jon McKee wrote: I was just pointing out that new bool() isn't as crazy as it looks at first glance
Quite so. I don't usually even think about bool being shorthand for System.Boolean, and it's good to be reminded of the deeper nuances of the language.
Marc
|
|
|
|
|
Marc Clifton wrote: Well, the whole thing could be reduced to
I guess it can if reader["foo"] can never return null.
|
|
|
|
|
So, just for my own understanding then, something like this would be better then correct? ...
bool isOffset = (reader["foo"]?.ToString().ToUpper().Trim() == "BAR") ?? false;
Jeremy Falcon
|
|
|
|