- 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
Whereas your mispelling, pal? Or orange you in on the joke?
Admin
Admin
you could submit a WTF clearly identifying your boss/company.
Admin
Admin
"Status" probably refers to the status of the status. In other words, there's a variable called actualStatus somewhere else in the code that holds the actual status; Status holds the status of the actual status held in actualStatus. If Status is "none", then actualStatus is null or "". If Status is "active", then actualStatus does not have a final value in it. If Status is "finished" then you can safely use the value in actualStatus.
However, the default value of Status is "false"...which means that actualStatus is false. You can't trust its value. DON'T TRUST IT, MAN!
Admin
For me TRWTF is the fact there are no statuses to indicate development and testing. Is this a developmestuction environment?
Admin
TRWTF is that the code contains two lines.
Admin
No you Anon. There is only one line of "code". The other line is a comment.
Admin
their's, askimet
Admin
So if this is Java, is it standard to make fields public and lower case?
In C# we never make fields public- they are always acceesed through properties- I assumed best practice in Java was to use getters and setters. And lower casing a public field is a good way to confuse people used to normal standards.
As for the status value being a string and uninitialized, this is totally forgivable if you are using an OR mapper that is mapping a value from the database that is stores as text. Otherwise that is an additional WTF.
It might not seem like much on it's own, but code filled with direct access to public properties that do not use standard casing conventions and favors uninitialzed strings over enumerations would be pretty painful IMO.
Admin
Sadly, I can infer only that the troll was more interesting than the article.
Admin
Admin
Admin
So when is someone going to go off on "their's"?
Admin
Admin
Oops, I meant "Public Fields", but I guess my meaning was taken.
Regarding OR mapping on fields- you are right, at least as far as nHibernate goes. I didn't think about that since i don't generally have fields the OR mapper would be able to access. I just know we have several public status properties in our app that are strings due to OR mapping needs, but we provide enumeration conversion method that developers are encouraged to use in these cases.
Admin
Admin
Admin
Admin
Admin
That's the most cunning ling for us to use. Thank you.
Admin
+1
I'll even go get the gun.
Admin
And if you showed up using lower cased public fields in my project without good cause, we'd have words. Polite, instructive words because I'm a nice guy and not an internet tough guy, but I'd hope you'd be willing to come along and work with the team rather than against :)
I'm sure it's quite a safe assumption in this case being that we are told this is an example of code that does not adhere properly to standards.I would never presume to know the standards of a project unless I was working on it, and the first thing I do before I start coding is find out what the standards are. But as I said, when we are told that the coder in question had issues with standards and best practices I think we can assume that the shop in question isn't going with a "hey, let's used lowercase public strings for statuses!" standard. We might assume they have NO standards, in which case a good coder is going to fall back to something fairly prevalent in the industry.
Admin
Yes, of course.
Nobody would ever, you know, have multiple constructors which initialize the string before the field can even be accessed. If that ever happened, the JVM executing the code would automatically terminate the current threads, spawn a new thread that sends an email directly to James Gosling with appropriate geolocation information, who would then ride up in a chariot, with Duke as a passenger, and exclaim, "YOU! You are not worthy!!!" The developer(s) in question would then be forced to using Malbolge for the next 50 years.
Admin
Admin
I wasn't taking a swipe at Java. Given (I believe) the absence of property syntax in Java, I did not know if public fields were more accepted in the Java world.
As for initializing in the constructor- sure. It might be there, it might not be. I assume the worst from context given where this code was posted- but honestly, initialization is the least of the issues here.
Admin
The beauty of this WTF is that "status" could be completely unused and not even cause a compiler warning, which, of course, would simultaneously diminish and amplify the WTF-ness of this line of code.
Admin
How easy is it to know that you need to hit dicotnary.com?
Admin
That's "impugning" btw.
Admin
Same here. (Although, i would disagree on how harmless it is if it turns out they use strings for almost everything.)
Admin
public bool status; //default status is 3
Admin
Admin
It's where the dicotomies are stored.
Admin
Where's the beef?
Admin
Admin
Admin
I thought XML was self-documenting...
Admin
Feck - not again! Let's just cut this dead right now and replace "your" and "you're" with "yor" just for WTF comments...
Admin
Admin
A fish? - does thios go with the Unicorns and Rainbows?
Admin
Muphry's law - too true!!
Admin
if yarr must
Admin
The status field is used to report the status of the application. When it starts up the status is unset because the application is still initializing. When the application finishes initializing and starts processing then status gets set to active. When the application finishes then the status is set to finish. This way the developers know when they can terminate the application - they can just connect to it with a debugger and monitor the field while the application is running and when it gets set to finish then they kill the application.
The field is public (on a publicly-accessible singleton) so that any part of the application can read (and set) it so that they know if they need to be initializing, running or shutting down. Then if the developers find that something didn't finish initializing when the application started processing, they can just set status back to null and those parts will detect it and go back to initializing again; or if something didn't process when the application finished, they can set it to active and the application will go back and process what hadn't been processed yet. They could even set it to something like "init-K2" to tell the K2 subsystem to reinitialize itself. Can you feel the power? I can!
That's such an awesome solution. I need to put some of that in the applications we have here, just in case.
Admin
Where were you? We're here. You're in your room of yore. They're there in their room. It's better to have its own thing.
Is it so hard?
Admin
I here ya, man.
Admin
Admin
This is turning into quite the angry pyramid of trolling, bad spelling and soapboxing. Nothing could make it more angry.
Sarah Palin writes VB code on an embedded filesystem while on her mommy and daddy's modem, but has to have a happy holiday by printing her code out on placing it on a wooden table which fristly is where she wrote unicorns and rainbows by accident while trying to write a perl script using GOTOs for her inept boss named Bobby Tables that would cut Social Security Benifits from TSA screeners on welfare.
Admin
It's one comment and one data definition. Good "code" is sometimes commented. Not that you would know.
Admin
This is turning into quite the angry pyramid of trolling, bad spelling and soapboxing. Nothing could make it more angry.
Sarah Palin writes VB code on an embedded filesystem while on her mommy and daddy's modem, but has to have a happy holiday by printing her code out on placing it on a wooden table which fristly is where she wrote unicorns and rainbows by accident while trying to write a perl script using GOTOs for her inept boss named Bobby Tables that would cut Social Security Benifits from TSA screeners on welfare.
Silly slave, can't even quote correctly, he doesn't realize that this is a grown up place.
Admin
Only on September 19.