| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Next » |
Transformer optimusPrime = new Transformer() WIN! |
|
Whoever wrote that article seems to be the one that's "in a rush", judging by all the copy/paste errors.
-- Note from Alex: Whoa. I swear, at like 3AM last nite it looked perfect! (Fixed) |
Re: In A Rush, Properly Handled, and More
2010-03-10 09:09
•
by
@Deprecated
(unregistered)
|
Hey give Alex a break, he's all wiped after having to implement some impossible features that were sold to a customer. As for the: public long getLength() { return 1000000; // no clue } I am afraid I have done something similar from time to time, when I am going through some inherited code where the original dev is long gone, and putting in something like // OMGWTF I can't believe this #$$@# Why do I put that in there? Venting or something, I guess... |
Re: In A Rush, Properly Handled, and More
2010-03-10 09:14
•
by
SR
(unregistered)
|
|
The comments for validation one is something I'd do while still learning to program effectively. Of course I'd go back and replace them with code before putting it into production.
As for optimusPrime = new Transformer() - that is teh awesome! :oD |
Re: In A Rush, Properly Handled, and More
2010-03-10 09:16
•
by
Richard T. Roll
(unregistered)
|
|
All of this is fine on embedded platforms which might not have a file system.
|
Re: In A Rush, Properly Handled, and More
2010-03-10 09:17
•
by
AndyC
(unregistered)
|
|
It's a bit unfair to just clip bits of code out of context. If you'd left in the public class PieceOfString bit the getLength method makes perfect sense!
|
Re: In A Rush, Properly Handled, and More
2010-03-10 09:17
•
by
Another PHP Guy
(unregistered)
|
function DeUnicode($_input){
Sure the PHP guy wasn't in a rush. He had simply could use strip_tags instead of his own function. facilisi -- facilis is latin for easy to do |
Re: In A Rush, Properly Handled, and More
2010-03-10 09:19
•
by
me_again
(unregistered)
|
|
Transformer optimusPrime = new Transformer();
is this a wtf because it's cool? captcha: vulputate - A vulture that likes tater tots. |
Re: In A Rush, Properly Handled, and More
2010-03-10 09:28
•
by
TheSpiesMustFlow
(unregistered)
|
Half because it's cool, half because jokes shouldn't go in production systems I guess. |
|
I find all this anti-Italic sentiment disturbing.
|
Re: In A Rush, Properly Handled, and More
2010-03-10 09:32
•
by
True that
(unregistered)
|
|
Transformer optimusPrime = new Transformer();
is only cool if you're working in a graphical environment and instantiating models for rendering where you can pass the constructor arguments, like 'TRUCK', or 'ROBOT', or 'GORILLA' (for the optimusPrimal version). |
Re: In A Rush, Properly Handled, and More
2010-03-10 09:32
•
by
Erasmus Darwin
|
In that case, it helps to have something greppable (such as FIXME) in the placeholder comments to make sure it doesn't get forgotten before deploying the code. |
|
class Transformer
class Transformers : Transformer, Collection Transformer optimusPrime = new Transformer(); Transformers autobots = new Transformers(); optimusPrime->Address(autobots); optimusPrime->IssueCommand("Transform!!!!"); AwesomeSoundEffectsFactory::GetSoundEffect("ch ch ch CH!")->Play(); |
Re: In A Rush, Properly Handled, and More
2010-03-10 09:39
•
by
Anonymous
(unregistered)
|
|
I'm pretty sure that the first function posted (the more I read into it) is a waste of space.
|
Re: In A Rush, Properly Handled, and More
2010-03-10 09:42
•
by
jrk
(unregistered)
|
|
I tried to put some italic tags around a bit of text today, but somehow, it doubled my text
I tried to put some italic tags around a bit of text today, but somehow, it doubled my text |
//Fixed for naming and precision |
|
Re: In A Rush, Properly Handled, and More
2010-03-10 09:55
•
by
Anon
(unregistered)
|
Indeed, and the Optimus Prime bit might have been from code for a Transformers game, in which case it's perfectly cromulent. |
Re: In A Rush, Properly Handled, and More
2010-03-10 09:56
•
by
SR
(unregistered)
|
That's exactly what I did. "FIXME" and "TODO write this code" are good, though I've still a soft spot for "banana" |
Re: In A Rush, Properly Handled, and More
2010-03-10 09:59
•
by
highphilosopher
(unregistered)
|
|
Wow, you poke at Alex just a little bit, and your comments get deleted? That's really, well, sad. I do understand that everyone makes mistakes, but on a Blog that's dedicated to pointing out mistakes, that's just kind of well hypocritical. Everyone here has made a WTF including you Alex.
-- Note from Alex: there were several comments pointing out typos/mistakes, but since the errors were fixed, the comments were no longer relavent; I did keep one, which was at the top and was a good balance of poking fun at me and explaining the original problem. On the same note, comments that respond to this will probably be deleted, too, since it's double-meta (I think?) discussion. |
Re: Robots in disgust
2010-03-10 10:02
•
by
Dave
(unregistered)
|
Too right. I have been guilty of similar naming conventions, like having a boolean flag to indicate if the current user is local or remote (in circumstances where "local" security has been requested to be lower for convenience on the assumption that other protections will mitigate the extra risk) called b_from_round_these_parts. Then you can check if not b_from_round_these_parts(needs to be read in either a west country accent or with a hick slur) |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:03
•
by
AndersI
(unregistered)
|
Actually, this should be a function of latitude - see http://en.wikipedia.org/wiki/Gravitational_acceleration. For us here in Sweden, 9.82 is the best approximation. |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:03
•
by
MP
(unregistered)
|
That would make it even more of a WTF since the article states: "I was going through some obscure code from the developers before me, and something caught my eye," Philippe wrote. "It was a class whose task was to transform data, and this is how it was instantiated." |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:04
•
by
frits
|
'Fixed for naming and precision |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:07
•
by
toshir0
|
'it's not good |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:08
•
by
toshir0
|
'it's good |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:10
•
by
Matt Westwood
(unregistered)
|
Amateur. Public Function Newton() Newton= kgf() End Function |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:12
•
by
Adrian
(unregistered)
|
As a mech engineer, I would say it is not too bad, it makes sure you always use the same value and a known accuracy for g trougout the program. Some people use 9,81, others just 9,8 and some others round it to 10, and the actual value depends on a lot of things ( where you are on the globe, position of the moon....) This allows get some accuracy of the result and eventualy improve it. |
|
RE the italics that become bold I would say that using italic tags is the real wtf. Though it feels strange to redefine this in css, html wasn't meant for defining presentation. That's why you have <Strong> and <Em>. It is unfortunate tags like <i> or <b> exist at all.
Since you can redefine everything in css it is a mistake to think those tags will do what you think. |
|
RE the italics that become bold I would say that using italic tags is the real wtf. Though it feels strange to redefine this in css, html wasn't meant for defining presentation. That's why you have <Strong> and <Em>. It is unfortunate tags like <i> or <b> exist at all.
Since you can redefine everything in css it is a mistake to think those tags will do what you think. |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:15
•
by
Anonymous
(unregistered)
|
ROFL, senior software consultant! We've been reading your crappy angst-ridden comments long enough to know you're still in high-school, frits! Now get the hell back to class! |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:17
•
by
grizz
(unregistered)
|
|
The Newton function probably is to avoid having a magic number in a calculation. Seems to me that's generally considered A Good Thing, not a WTF.
|
Re: In A Rush, Properly Handled, and More
2010-03-10 10:21
•
by
frits
|
Hey man, this is VB. Parentheses optional. |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:22
•
by
DaveK
|
I don't know about you, but <i<i>>I</</i>i> for one can see another problem with it. |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:23
•
by
Leo
(unregistered)
|
You're the one that does #define ONE 1 #define TWO 2 aren't you? Sometimes you really don't need it. |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:23
•
by
Matt Westwood
(unregistered)
|
Agreed - the only problem I might possibly have with it is its name - NewtonsPerKg would be better - but as a concept it's fine. No WTF. |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:25
•
by
Zachary
(unregistered)
|
The real WTF here is that he is using the i tag to begin with. Any real web developer/designer uses pure CSS. |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:25
•
by
DaveK
|
*relevant* |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:25
•
by
Nitpickers R. Lame
(unregistered)
|
In this case none of yours are. Get over yourselves. Now as to whether this comment about useless comments being useless is useful... Well that's a different question entirely.... |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:28
•
by
DaveK
|
And sometimes you do, because some scientific software has to give actually *correct* results, at any latitude, and even up a mountain, down a mineshaft, or in an orbiting spacecraft. It depends how much precision is required, which is something none of us can infer from a contextless snippet, but if it's even doing physics-based calculations at all, it's certainly possible they might want two or three significant digits of precision, which is the level at which it becomes worth considering variations in g. |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:29
•
by
frits
|
We? Is there a frog in your pocket? For the dense, "senior software consultant" is a callback to the article. |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:33
•
by
SR
(unregistered)
|
I agree that it's preferable to use EM and STRONG in place of I and B but redefining expected behaviour is definitely a WTF in my book. |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:35
•
by
Simon
(unregistered)
|
This was a deliberate feature to tell you to stop using <i> to italicise text. The correct XHTML-compliant tag is <em>. |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:35
•
by
DaveK
|
Perhaps you could explain how that works? |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:39
•
by
DaveK
|
Don't you mean "... tell you to stop using unicode to italicise text ..."? |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:40
•
by
SR
(unregistered)
|
That was referring to a copy and paste error that Alex has now fixed. Kudos on O'Rly, thuogh. It's ages since I've seen one. |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:43
•
by
Helix
|
Strangly by discussing about the spelling of relevant you have created a triple-meta comment. |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:45
•
by
ath
(unregistered)
|
Agree. If you hardcode the values you may screw up badly. For example, Alice calculates the force as F = 9.81 * m. Later Bob wants to do the inverse so he calculates m = F / 9.8128. Then the swedish guy comes along and calculates F again as F = 9.82 * m. You'd better wish they're programming a game and not the guidance system for an Ariane V rocket. Sure, I'd prefer a constant to a function but it's still better than hardcoded values... |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:47
•
by
Quirkafleeg
(unregistered)
|
That's pointless. You need something else to which to apply the CSS. |
Re: In A Rush, Properly Handled, and More
2010-03-10 10:57
•
by
Quirkafleeg
(unregistered)
|
‘Strangely’. But then you knew that… |
| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Next » |