| « Prev | Page 1 | Page 2 | Next » |
|
Man. If only they had decided to put a Visible property at the
base level for all server controls. Life would be sweet then. We could call the base class "Control", and it could have several properties, such as Visible, Enabled and even Width and Height! I'm going to write Microsoft now to let them know of my great idea! |
|
I don't want to turn into AmmoQ, but aren't the
semantics of a not-visible element different from those of a commented-out element? The former is still in the DOM's collections, no? |
|
Well this person obviously knows that the Visible attribute exists, so
this has got to be one of the most assanine things I have ever seen. Even if you needed to have more than just text to be dynamically hidden, why not just set the TD to runat server and show/hide that. This is just ridiculous. I really did say "what the f***" when I saw that. The Insanity is taking hold. |
|
I would take a guess and say this is someone who still thinks he works in asp. Needs a wake-up call. A slap in the head would do nicely.
|
In addition, is an element with visible=false invisible on or non-existent on the client? If it's the former, a commented element could create a state problem, since comment it would yield different behavior. If the latter then, functionally, they behave the same. |
It would be a huge WTF in ASP also. I vote for two slaps in the head, a chop to the kidneys, and a swift knee to the groin area. Somebody needs to tell this guy that the CORRECT way of hiding text in an ASP.NET page is to put in in a and setting the div's
display = 'none' in javascript. Duh.... |
|
Not as bad as some ASP.NET stuff I have seen. I place I used to
work would build the entire page as a concatenate string in the code behind. Really makes you say WTF and pound you head on a monitor when you see such abuse of OOP like this one. |
I stay far, far away from Microsoft technologies, but my guess
Perhaps the programmer had some good reason for wanting to see the thing being commented out in a comment. |
I stay far, far away from Microsoft technologies, but my guess here is that 'visible' attribute determines whether or not a particular thing is emitted into the block of HTML that goes back to the browser. So, I suspect a comment is actually more 'visible' to the client than a !visible ASP.NET element. That is correct. When Visible is set to false, the control is not rendered to the browser at all. |
I verified this. Visible = False is not the same as a CSS style such as display: none; This is well and truly a big, fat steaming WTF. |
|
This IS amusing, but not necessarily a huge WTF assuming they had some reason during debugging where they wanted to see the commented out code by viewing the source. But they shouldn't have kept this SHITE in production. They are making the page fatter by sending out more HTML than is necessary.
|
It wouldn't be a WTF if there were not something called a debugger available for debugging. |
Man, if only the base post of this WTF mentioned the Visibly property being available for every control! |
We can only take it at face value so you can't make that assumption. If it causes one developer to raise an eyebrow and look at it for an extra second, without a real purpose (besides our entertainment), then it costs someone something. I submit to you that it remains a WTF. |
[:$][:$]*Whistles innocently*
In my defense I had to teach myself .asp programming from asp pages written by a guy who taught himself .asp programming from scratch in a department made up of 3 30+ years of experience guys programming FORTRAN and 1 guy around 4 years in the business who knew about as much about asp pages as I did. |
I figured out what was wrong with this code... He depends on the value of "true" being true!What if it was false?.....If quoteRequest.PreferenceCode <> "P" Then End IfThere, I think that's much better. (Who wants to pat me on the back?) |
But what if it was really looking for true or false (instead of using magic numbers, which you have resorted to) Oh, and I think you may have misspelled cantaloupe. |
The Visual Studio integrated debugger is great for that. This is a WTF. |
Your defense? Is this your code?! |
Ok, the joke was lost, as the whole point was trying to poke fun at magic numbers. And to be pendantic, I didn't use magic numbers, I used magic formulas ;) |
Mmmh, you're right. Actually, your magic formulas use magic numbers, so that's, like, double the magic! |
|
Yeah this is a pretty big WTF... I think the guy was trying to save
view state. Thinking by commenting out the code with labels instead of using the .visible will decrease view state and thus increase response time... Not logical but a possiblity... Which would make this someone who has read/experinced basics of asp.net and very little on actual implemtation... |
No no no. I was referring specifically to the comment someone made about concatenating all the HTML into one string in the code then writing that one string all at once. |
|
Wow...I've been lurking on this site for a few weeks now, but I just have to comment on this one.
I'm staggered...I'm not an ASP or ASP.NET programmer in any way shape or form, but I'm CERTAIN there are MANY better ways of doing this. |
Good save. You don't want Smallberries on your a$$. He's a viper. |
|
The funniest thing is, he/she might get paid more than most of the developers nowadays... [:(] |
Yeah, smallberries on the ass sounds like a bad condition. |
|
Brillant...
|
*phew* that's good to hear. Actually, in classic ASP, building an HTML string is more performant than you might think. If most of the page's content is dynamic, building am HTML string then Response.Write'ing that is better. Interleaving server side tags with the static HTML is slow since the parser much switch contexts. That said, do not simply concatenate a string to build the HTML. That is the worst way to do it. I wrote a class that added strings to an array, then joined them at the end (a poor man's StringBuilder). It increased string concat performance 100x. |
Oh, and your the essence of understanding and forgiveness? [;)] |
Just kidding but, in truth, we all have our moments. |
If you have Response.Buffer off (default in IIS 4 ASP) the server actually sends the bits to the client at every context switch. This can help the browser render while receiving... creating the illusion of good performance... but if you have LOTS of tags like I do it gets silly. Better to put Response.Buffer = False and have a few well-placed Response.Flush's. |
Not just silly but maddening. Eventually you will have "& _" burned into your cornea from overexposure. |
The parser "switching contexts" is a trival time drain. Basically if you write <% Response.Write ("STUFF") %> The parser just renders that as: Response.Write ("STUFF") The actual time difference comes from the fact the (usually) concatenating two strings and the writing one long string is faster that writing two short strings. Of course, if the strings get very long, concatenation takes longer, to the point where two writes are faster. |
This can be made more efficient by writing it like this: lblIEnd4.Visible = ( 1 = 1 ) AndAlso ( 1 <> 0 ) Then it will short-circuit the logic if 1 really equals 1. In fact, since there is no performance penalty involved, you might as well append all your conditional statements with basic checks for race logical conditions (like checking that True doesn't equal False): If (checkFor = True AndAlso 1 = 1 AndAlso 1 <> 0 AndAlso Black <> White...) Then |
|
It's also a WTF because it's mixing logic with layout in a real bad
way. HTML comments should NOT appear in a code-behind file. What if someone happens to modify the template by adding this: <asp:Label id="lblIStart5" visible="False" runat="server">asp:Label>Bingo - nested comment! --Daniel T p.s. Like a lot of WTF's, this is pretty darn creative :-) |
|
I've seen this antipattern before; it was an early web-application
built upon a poorly made template engine that could only replace place holders with actual values, but had no conditional construct. |
Tell me VB.net doesn't have 'AndAlso' just to provide short circuiting. Why couldn't they change that behaviour when they were changing everything else in the transition to VB.net? Every other language short-circuits by default. This is worthy of a WTF all of its own. |
|
Hmm... Those programmers that write "WTF-code" are really innovative...
|
As someone once said: "It's pointless to try making something idiot-proof, because nature keeps making better idiots". |
It does.
They tried in pre-release versions of VB.Net 1.0 -- VB developers rose up in unison and demanded they put it back to the way they were used to.
Yup.
Yup. |
This can't be all ammoQ - I've enjoyed the banter the past couple of days. I want more, more, more! |
I'm too busy working on new oxymorons, like tightly seperated |
|
*twichs*
This goes right up there with that ASP prasing system we saw a few months back, expect this one isn't justifyable. |
Not to be funny or anything but to settle this once and for all visable=false will still include the control on the page (as in a hidden asp textbox) whereas enabled=false will actually stop the control being included in the page. Oh and by the way W.T.F mate? This code is Brillant!!!! |
It's the other way round: enabled=false will still include the control on the page whereas visible=false will not render the control on the page any more. |
Many companies ported their VB6 code to VB.NET. Do you think it's more of a WTF to add a short-circuiting operator or to silently break existing code? |
Existing code had to be reworked anyway; I don't know vb.net but in C#, you need short-curcuiting all the day for cases like that: if (something != null && something.WTF) { ... } Since vb.net has similar semantics and works on the same class libs, I guess you need it in vb.net just as often. |
|
I think I actually got a slight bit dizzy when reading this WTF.
|
| « Prev | Page 1 | Page 2 | Next » |