|
FWIW while bool is "sort of a struct", like all primitive types instances of it are "created" (without any ctors being called) by MSIL instructions, eg true is created by
ldc.i4.1
And new bool() literally is (not just sort of metaphysically/hypothetically according to an AS-IF rule but the literal compiler output)
ldc.i4.0
I guess the moral of this story is that bool is int
|
|
|
|
|
Interesting. Looking at the CLI Specification[^] I.8.2.2 on page 46 that makes sense. Under all the abstraction it's an integer type.
|
|
|
|
|
Well, look: a variable must be initialized before it can be used. Now just imagine: somehow a third possibility comes into existence which is not covered by that if ... else - now you'll run into an error when you access isOffset because it was not initialized.
|
|
|
|
|
So you want
if (...)
...
else
...
maybe
...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Reminds me of the fuzzy logic that was so popular in the beginning of the nineties.
|
|
|
|
|
Do you have a keyboard?
Hit CTRL+A/Del and save us!
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
bool IsOffSet = new bool { improved };
New version: WinHeist Version 2.2.2 Beta I told my psychiatrist that I was hearing voices in my head. He said you don't have a psychiatrist!
|
|
|
|
|
Disclaimer: maybe your outsourcing experience is better, but I've never personally seen it. It also speaks volumes of the lack of code reviews by a major company before this stuff went into product. Is the expression "well, it works" sufficient justification?
For example (reduced to the essential):
public string getRecordToBeProceed()
{
if previuosXML()
{
RecordToBeProceed = "1";
}
}
Typos and outright errors: "RecordToBeProceed" should be "RecordToBeProcessed"
if (getRecordToBeProceed()) ...
And you just gotta love (or not) the string "0" and "1" used to represent a boolean.
Marc
|
|
|
|
|
On the bright side, they're (mostly) English words
Ah, I see you have the machine that goes ping. This is my favorite. You see we lease it back from the company we sold it to and that way it comes under the monthly current budget and not the capital account.
modified 31-Aug-21 21:01pm.
|
|
|
|
|
|
We dream of code that good in our team
Ah, I see you have the machine that goes ping. This is my favorite. You see we lease it back from the company we sold it to and that way it comes under the monthly current budget and not the capital account.
modified 31-Aug-21 21:01pm.
|
|
|
|
|
Quote: Is the expression "well, it works" sufficient justification?
A friend and co-worker of mine refers to this type of thinking as, "passive mediocrity".
"...JavaScript could teach Dyson how to suck." -- Nagy Vilmos
|
|
|
|
|
Z.C.M. wrote: A friend and co-worker of mine refers to this type of thinking as, "passive mediocrity". I shall shamelessly steal that.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Ouch. My eyes are bleeding and begging for mercy after looking at that "code".
|
|
|
|
|
Marc Clifton wrote: I've never personally seen it Yes you have!
|
|
|
|
|
Sander Rossel wrote: Yes you have!
Ha! Nothing personal, and I was trying to be politically, if not correct, at least sensitive, to how I really wanted to title the post "The joys of outsourcing to India", which is where this code comes from. I think I assumed people would assume I was talking about India.
Marc
|
|
|
|
|
If you thought India was bad try Romania!
I still get mad thinking about it
Actually, I still have a t-shirt with the face of their lead dev and the words he said to me in an email (after I completely burned the garbage they delivered to the ground) "You prefer to wait and hit after, thanks we'll remember!" (seriously, no joke)
I got that t-shirt when I left that company (and the outsourcing was one of the reasons I left)
|
|
|
|
|
Sander Rossel wrote: You prefer to wait and hit after
That's a good one.
Marc
|
|
|
|
|
I don't need outsourcing for that...
|
|
|
|
|
Comment of the day, probably from the same guy whom I've written about before.
And while we're at it.
while (completedTheadIds.Count == 0) { }
Marc
|
|
|
|
|
Programmers fear code because they don't understand it.
That's why so few people can, and will do, a successful refactor.
It's sad that so many people in our industry don't know their trade while so much can depend on it
As for that second part, who needs CPU anyway?
|
|
|
|
|
Well-written and properly documented code can be refactored a little at a time without endangering reliability.
Poorly written code really needs to be refactored, but really can't be because that same code probably doesn't have any comments, supporting technical documentation, and/or documented requirements.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
In the '80s, a friend of mine was doing a Summer co-op rotation at a company that used COBOL for their inventory control system. The application created a report that showed 'x' count of fully assembled units, 'y' count of subassemblies, etc...
The printout of the code was about 2 feet high; he was tasked with finding the errors and fixing them.
As he went through the code, he found variables had been reused for various purposes.
When he brought that to the managers attention, they decided they'd been running the plant with the existing code and had managed, so... it didn't need to be modified.
|
|
|
|
|
I once worked on an application that just had a class Globals with public variables like ProductName, and whenever anything somewhere needed a ProductName it would use Globals.ProductName.
Imagine my initial surprise when I made a change to some form (WinForm) and a completely other, unrelated form broke
How the hell do people even come up with such sh*t?
|
|
|
|
|
John Simmons / outlaw programmer wrote: Poorly written code really needs to be refactored, but really can't be because that same code probably doesn't have any comments, supporting technical documentation, and/or documented requirements. Indeed, yet that's most of the code I've come across.
Now are you too afraid to touch code like that even when it's necessary? Because I know people who are.
I've met a developer who was afraid to throw away some code that was never reached, something like if (false) { ... } (maybe some test code once?) because "what if that code DOES do something?" What the hell, that code never did, never does and never will do anything so just friggin delete it already!
And here's a real gem, "I'm not sure if this code, that is in source control, is used so I'm going to comment out this block instead of deleting it completely (and I mean committing it like that)." What the hell do you even know how code works!?
I agree that some code SHOULD not be touched because the chances of it breaking are far to big.
However, ultimately not being able to find out what some code does or even not daring to change it after you've found out is just an indication of not knowing what the hell you're doing.
|
|
|
|