| « Prev | Page 1 | Page 2 | Page 3 | Next » |
Whereas your mispelling, pal? Or orange you in on the joke? |
|
you could submit a WTF clearly identifying your boss/company. |
If the coder associated Null with False it could explain the comment and the lack of assignment? |
|
"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! |
|
For me TRWTF is the fact there are no statuses to indicate development and testing. Is this a developmestuction environment?
|
|
TRWTF is that the code contains two lines.
|
No you Anon. There is only one line of "code". The other line is a comment. |
|
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. |
Sadly, I can infer only that the troll was more interesting than the article. |
Do OR mappers work on fields? I thought they tend to map to properties so that the getters and setters can be called.... |
False dichotomy. We're all trolls, and we all find ourselves more interesting than the artikle. |
|
So when is someone going to go off on "their's"?
|
I'd wretch at the ugliness of it all. Also, maintenance of the project would stop until it could be re-written. I don't refactor utter shit; bad code usually indicates bad architecture that will haunt the project even after a full refactoring. |
|
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. |
The Lord has very little to do with this enterprise. |
Enter a table with a column full of values where false might look like any of the following: "false", "FALSE", "FLSE", "0", "0.0", "no", "-1". Good luck running reports on such "data". Who the fsck writes XSDs or DTDs by hand if it's too hard for them? There's plenty of tools, heck, what about a good craftsman making his/her own tool when in need? |
Just like a nice girl in underwear. |
Never/always? Those are pretty strong terms... While there is a convention of using properties in favour of direct field access, it's not an absolute... Normal standards vary from person to person, and from project to project. Assuming anything more than is established from the project actively being worked on is setting yourself up for confusion and trouble... |
That's the most cunning ling for us to use. Thank you. |
Never/Always without a good reason. Yes, there are exception cases- but you know that is the convention right? So rather than interpreting my post as being about absolute standards maybe you ought to give me a little credit and assume that I was commenting on the code in question, which we have every reason to believe had no good reason to defy standard conventions. 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. |
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. |
No factory? |
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. |
|
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.
|
How easy is it to know that you *need* to hit dicotnary.com? |
That's "impugning" btw. |
|
Same here. (Although, i would disagree on how harmless it is if it turns out they use strings for almost everything.)
|
|
public bool status; //default status is 3
|
What's a dicotnary? |
It's where the dicotomies are stored. |
Will no one mention Boog's mis-use of "their?" |
I think you just did. |
I thought XML was self-documenting... |
Feck - not again! Let's just cut this dead right now and replace "your" and "you're" with "yor" just for WTF comments... |
Can we replace them with "yarr" instead? |
A fish? - does thios go with the Unicorns and Rainbows? |
Muphry's law - too true!! |
if yarr must |
|
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. |
|
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? |
Re: grammar warrior
2010-12-23 11:41
•
by
frits
(unregistered)
|
I here ya, man. |
So I must be no one. |
Re: Status
2010-12-23 11:59
•
by
Egyptian Slave
(unregistered)
|
|
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. |
|
It's one comment and one data definition. Good "code" is sometimes commented. Not that you would know.
|
Re: Status
2010-12-23 12:04
•
by
Egyptian Slave's Master
(unregistered)
|
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. |
Only on September 19. |
| « Prev | Page 1 | Page 2 | Page 3 | Next » |