- 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
What kind of name is "Jonathon"?
Admin
So much rage in this article.
Admin
The useless comments don’t surprise me. At work, we use a code checker which insists on having at least a comment for each function. So every
int get_something_count(void)
gets a redundant comment.Admin
This isn't the frist time I've seen such redundant code.
Admin
According to urban dictionary:
Admin
A mis-spelt one. Should be Jonathan.
Admin
This is enterprise code already. Encapsulated and defensive at its best. The
Guid.NewGuid()
method could be deprecated/removed in the future and all of our code would break!Bonus points on adding an interface so we can decouple it for mocking.
Admin
It makes sense to create that damn GUID service. This way you can mock it in tests. Have fun mocking static methods :)
Admin
The value of XML comments is not in the context of the code, but in the help files what are generated from them. Since these files can have multiple content sources (e.g. Examples) that are processed into pages [just like MSDN] the only way to evaluate the usefulness is by being presented with the final processed page and analysis performed from the context of someone who has that documentation along with the compiled code (i.e. DLL)
Even the act of wrapping a Guid may not be a WTF... There are many different types of Guids and algorithms for generating them. The .NET provided method is only one of many, and there are definitely cases where it is not the most appropriate type.
Admin
"The GuidService implements the IGuidService contract, and contains a method NewGuid which returns a Guid generated by the static NewGuid method on the Guid class" - Reminds me of THHGTTG: When I press this black switch that's labelled in black on a black background a black light lights up black to let me know I've done it.
Admin
// This is a comment on the article.
Admin
not enough entterprise.
ther eneeds to be at least 4 more levels of indirection in there, and the result should be returned in XML unless an optional parameter is passed in which case it should be returned in malformed JSON
Admin
You have to take that up with the submitter- I spelled the name like it was in their submission.
Admin
They're not just comments, they're documentation comments, which is completely different. It's not uncommon for documentation comments to state the obvious (although in this case the author could probably have put a little more effort in them).
It may seem useless (because the code that uses it could call
Guid.NewGuid()
directly), but it's actually useful for unit tests. You can replace theIGuidService
with a mock that will return a specific GUID for testing purposes (similarly, you might want abstract the current time behind an interface to test a scenario at a given fixed time).So, on the whole, this snippet is probably a bit over-engineered, but it's not really a WTF.
Admin
That's not a bug. It's a feature.
Admin
I agree that the XML Documentation Comments (simply referred as "comments" in the article) are useless, but not really a WTF since it is how the XML Documentation Comments should be used for. Just like most Javadoc comments.
Like what?
Admin
Not necessarily, my partner's brother is a 'Jonathon'. I'm a 'Jonathan' and I agree that's the only proper spelling ;)
Admin
It's a fairly common alternate spelling. After a while, you just stop caring about such things other than to get them right according to the owner of the name…
Admin
I don't understand the submitter's problem with the namespace "Business.Common". Seeing the full namespace Business.Common.Services, my first thought would be a library supplying business logic, available in both client and server code, and that the classes in here are services. Where's the WTF? In fact, looking at my current work project, I see:
For large projects, it makes sense to properly organize the code into sane namespaces.
Admin
A class named "GuidService" does not benefit from the description "Guid service", regardless of the output context. The other comments, by the way, are copy-and-paste from MSDN's Guid.NewGuid page, highlighting the utter pointlessness of this "service".
If we want a new type of Guid other than the .NET-provided one, then why have we baked into the signature a return type of... um... the .NET-provided one (System.Guid)?
Admin
Probably a first name. Goodluck.
Admin
Good point, at the end you're testing .Net GUID. Would made sense with a custom GUID class which extends/wraps the platform one.
But we have to agree it's not such a big WTF.
Admin
dkf deceived me in believing that Remy doesn't put cornify in CodeSOD articles, but I see it here. I'm disappointed by the small amount of hidden commentary by him in the recent articles though.
Admin
YHBT. YHL. HAND.
(Apparently acronyms are a barrier to reading.)
Admin
He didn't used to. (I still want a cornify plugin for DC for randomness value. It's a good way to make a drab article much more interesting.)
Admin
The big WTF is having an actual service for this (as opposed to a mockable class, which makes a little sense). Because only one system in the whole enterprise has any chance of knowing how to issue actual GUIDs and the others all have to delegate to it to avoid duplicates…
Admin
A boy I liked in 8th grade named Jonathon jumped off a balcony and missed school for 3 months while they rebuilt his shattered ankle. When I asked why he did it just got this weird smile and “felt like I was flying...”
Admin
This function was meant to return a comment, but no comment was generated.
Admin
It does make sense to organise code into namespaces, but it helps to engage brain when selecting the names. Using complete generics could lead to future namespace clashes. Hence the sensible Java convention.
(My favourite still remains the bouncycastle cryptography libraries).
Admin
Seen in code: // This is the comment
Admin
Isn't that auto-inserted by one version of Netbeans?
Admin
Admin
Does Jonathon write unit tests using a mocking library? Does Jonathon use Stylecop? Perhaps not?
Admin
The real WTF here is not knowing the difference between Java and Javascript.
Admin
Well, duh, anyone can see it's the last 6 letters.
Admin
Who stole this code from my company?
Admin
It generally leads to the anti-pattern of just throwing everything business-related into
Business.Common
and creating a God object.Admin
߯ªJava?
Admin
OP does no unit tests nor are there any documentation files for his code. OP, come work in a dev shop that has continuous integration implemented with teams across multiple contents and lets see how your tune changes. :smiley:
Admin
Whenever I see anything names common or generic I know that the code that lies within is a load of crap. Both those namespaces are telling me that the code it is a dumping ground for poorly thought out code.
Admin
You're just the kind of person who would put Unicode characters into a variable name just because you can, aren't you?
Admin
Obligatory: http://what.thedailywtf.com/t/apple-swift/579/55?u=aliceif
Admin
Perfect truncation in that one-box.
Admin
Sniff
Admin
Since when can Java be called from JavaScript?
Admin
Except there's just about no value whatsoever in mocking out the GUID for testing.
Admin
That's C#, not Java, and it's very common to call WCF services (which look basically like this) from JavaScript.
Admin
Except that's not what people will think "common" means. They'll start throwing anything and everything in there, when in reality there is usually a much better place for it. And for organization sake, why would anyone care that the same class is used on the server and the client? That communicates very little, if anything, about what the actual classes do or how they're used.
Admin
I would swear that back in the day Java applets in a web page were scriptable.
Admin
I was simulating the process of "get the last 6 letters of "Java"". Although I admit that's seven letters, it didn't look right without all three of the random unicode symbols.