- 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
As Terry Pratchett wrote: Real stupidity beats artificial intelligence every time.
Admin
Or it was just a bad merge in VCS?
Admin
What wrong with the line containing
/*
?
Admin
I want to leave a comment but cannot decide which one of the contradicting messages I should address.
Admin
Lines 1, 3, 5, 6 and 8 are all fine. Only 2, 4 and 7 contain problems. By LoC, that's over 50% OK.....
Admin
Note that the only line containing actual logic is a contradiction by itself too.
Admin
So you think that it's reasonable / correct / agreeing for a variable called
_price
to contain a value of typeOrderValidator
???For shame, Remy, for shame.
Admin
I feel like you're doing a bit that I'm too dumb to get.
Admin
Aside from the fact that the original line was
/**
and not/*
, it's not lined up properly. The asterisks on the following lines should line up with the first*
from the/*``, not the
/`.Admin
Are leading * required in PHP comments? It wouldn't surprise me if that was the case given how bad the language is othervise. It'd make sense they'd have adopted that sort of formating stupidity as well.
Admin
I’ve seen this countless times. Developers were hammered with “comments are good” so they don’t care if they are useless and/or wrong. The worse is I always failed to make them realize.
Admin
I worked with someone once who always copy pasted code from somewhere else in the app. TO make it worse they generally copied more lines than necessary adding new functionality that did nothing but made things more confusing. I always wondered if the programmer was trying to evolve the code somehow.
Admin
I've known companies where the policy was never to remove comments - you could take out or change code, but anything that was a comment needed to stay.
Admin
And they copied the comments along with the code, then changed the code because they wanted the logic rather than the variables, and left the comments untouched.
Admin
Product Statuses, Warehouse Suppliers, Prices, Order Validators, .... you.... me..... all these things are connected in the Universe. Let us close our visual eyes and open our mind's eye as we focus on this code to achieve ultimate enlightenment...
Admin
[code] There was an old man from Tralee Who was stung on the neck by a wasp When asked if it hurt He replied, "Not a bit It can do it again if it likes." {/code]
Admin
Take 2:
Admin
That's not wrong. That's just style.
Admin
This might be the worst code ever posted on this site.
Admin
I especially like the placing of the curly brackets. The programmer has clearly studied McConnells "Code Complete 2".
Admin
No.
Admin
I've also seen 'comments are bad. They are always redundant with the code and don't add any value. It is just more work to maintain both the code and the comments.'
That type of thinking isn't any better. It just leads to coding by tribal knowledge that gets lost as fast as employee turnover happens.
Admin
Looks like they weren't confident with how to create the Warehouse Supplier class, or thought this was a good shortcut, and so copied over everything from the Product Status class. Or worse, they derived the Warehouse Supplier from Product Status.
The Warehouse Supplier needs an OrderValidator to determine if orders can be met, so they shoved one into the "price" variable, instead of creating its own variable. Probably means there's a bunch of junk variables in there left over from the copy-paste. They also updated the name for the type being returned, but not the rest of the comment.
And they probably thought this was a job well done.
Admin
I newer understood why people find proper commenting so difficult. I mean, it's just common sense that should be plainly obvious to anyone who has ever written a paper.
Your code is the text. It's the body of what you are writing. The comments are your footnotes. If the text can't adequately explain everything but the explanation does not belong in the body of your writing you add a footnote. Equally if the code can not explain it self you add a comment.
It's not difficult.
Admin
$this->_price = new OrderValidator();
doesn't contradict any of the other lines. It's perfectly feasible that a warehouse supplier or a product status might have a price attribute. It does, however, contradict itself, given that a price is probably an amount of money to be paid and an order validator is probably a thing for validating orders.Admin
People go into the career of computer program for the same reason mathematicians choose their own careers.
It's because they have absolutely no interest in communicating anything useful to the outside world.
It's the old "I did maths because I can't write essays." And indeed, "I write programs because I can't write comments."
Admin
I said paper, not essay. Essays are creative works, something that you may or may not be able to do. Papers are rigidly structured articles with footnotes and refrences and stuff. I can understand someone from our profession not being very communiciative but any educational institution worth the price of tuition is going to force you to write enough papers to at least acquaint you with the basics of how its done.
And even if not, as part of our job you should be reading papers in order to keep up with new standards, conventions and programming languages and other stuff that comes out and just general new developments in our field. So you should get a feel for that from those.
Hell, even most tutorials that aren't video are structured in a way that you can refrence them for how to do this.
Admin
Admin
Nonsense. I became a computer programmer because I loved what I could make my Speccy do and I wanted to share that with the outside world. Computers are one of the greatest communication tools we have.
Admin
Strong contender for making it to the best of.