- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
nullptr=>nullptr.Address!=null;
Admin
real wth they have chosen c# over cobol
Admin
Also, why the fuck do they all the copying manually?! Automapper exits for a reason.
Admin
The code sample at the beginning contains another subtlety...
It fetches (or not) the information into a
long?
calledacctId
(note small "d") and passes a something calledacctID
(note big "D") to a function expecting anint?
.It would be interesting to see where
acctId
ends up being used.Admin
Nice observation.
If you are right and those two variable names are two different things, than there is about no connection of the 2 snippets. wtf.
If this was just a typo and it was meant to be the same variable, than this would result in a compile error beccause long? cannot be passed into an int? parameter. WTF!!!
Admin
I see the whole "don't do anything just log an error and reload the page" approach at work constantly. like I get not showing an error page, but give some indicator that something failed. Otherwise what happens is the page (often some Ajaxy thing) just "finishes" but nothing changes. No indication there was an error because the error got logged in the stored procedure which takes/gives output variables to indicate it's status but the page doesn't do anything if the output variable indicates an error.
Admin
I have never likes case sensitve languages. Case preservation is a good thing. You can not per accident create two different variables with a small lexical distance like acctId and acctID
Would amsterdam or Amsterdam be two different places?
Admin
Looks like this concept of a parent account was retrofitted to existing code ... in a really cack-handed way. Someone being lazy about rewriting stuff properly and making more work for themselves (and everyone else).
Admin
Remember, none of this would've happened had Bill Gates' parents not met.
Admin
"Would amsterdam or Amsterdam be two different places?" - There are at least 512 different ones :)
Admin
I get the sneaky suspicion that
acctID
is actually a global int variable, used somewhere else entirely, for a completely different purpose, but still visible here. When the compiler gets to the typo, it links to the global variable instead of the local variableacctId
and then some developer is left wondering why the wrong value is being passed to the function as they walk through the execution one step at a time in the debugger.Admin
there's actually two account IDs:
acctId
(lowercase D), which is the name of the variable in the calling code, andacctID
(uppercase D), which is the name of the parameter to the called function, both of which live in entirely separate scopes. There's still the issue of the value sometimes being anint?
and sometimes being along?
though.Addendum 2020-02-13 09:21: With the former only being used in the first block of code (the caller), and the latter only being used in the second block of code (the callee).
Admin
Is ß the same as SS? Lexical equivalency is weird enough that I'd rather my compiler simply treat my variable names as a series of characters to be compared literally than have it do "fuzzy matching".
It's not the compiler's job to fix our sloppiness. However, I'm all for editors that identify these problems and help fix them. Visual Studio is pretty good at doing this.
Admin
I'm not a developer, but I've heard at my place of business that Automapper is "usually more trouble than it's worth."
Admin
I've used Automapper in the past - the primary struggle we encountered with it was that it defaults to mapping properties based on exact name match. Which works great until you need to rename your properties for some reason and forget that you need to rename both.
There are mapper validations meant to be used especially in unit tests but that doesn't solve the problem outright, just moves it closer to compile time so you're failing your build instead of failing at QA time.
We ended up still using Automapper for the API but manually specifying every property mapping even if the property names were identical.
Admin
Case-insensitivity is language-specific. For example, there's the "Turkic I" problem: when Turkey switched to using the Latin alphabet for Turkish, it split I/i into dotless I/ı and dotted İ/i, so that while most languages that used the Latin alphabet would say that 'I'=='i', Turkish (and Azerbaijani), would say that 'I'=='ı' and 'İ'=='i', and 'I'!='i'.
Admin
Oh the fun that only a few of us have had with that one!
Just for emphasis as that's where the pain is! Good explanation though, I always (naively) though it was an encoding error that had become embedded to deep to fix, I see what has happened now.
Admin
The are all spelled with a uppercase A. One of those is a garbage dump in Sweden :-)
Admin
mmmm, yummy... Manual hydration from EF to view models... What I wouldn't give to look at thousands of such lines of mindless code...
Admin
There's no problem here, as right now the code wouldn't compile. We pass a long? into a method that expects an int?. This doesn't work. Unless of course the method is overloaded and both methods are equally fucked up. The apparent typo mentioned in the previous comments seems to have been fixed, though.
Admin
I feel like I know this guy. He quit recently.
Admin
"It's not the compiler's job to fix our sloppiness"
Real programmers use
copy con >pgm.exe
Admin
Personally I like the concept of "case consistency": A compiler should not accept Foo and Foo to be the same, but ALSO shouldn't allow them to be different things. Helps to avoid typo bugs in CamelCase contexts.
Admin
The first part about getting the accountid since you already display it in the grid is actually pretty normal - this is clearly a web app and you don't send everything back to the server when you click - and you should send the minimal stuff back because you should not just try the client to send the correct data - especially about auth and security. So send back the row id and get the correct info from the db - pretty standard and far more secure.
Admin
Location NewYork = new AmsterDam(StringCompareOptions.IgnoreCase | StringCompareOptions.IgnoreCulture);