Let Me Write That For You
-
Continuing code snippets from my company's library:
http://what.thedailywtf.com/t/inner-platform-effect-sql-utilities-edition/982Here's something that I just found:
/// <summary> /// Writes a message to the Page.Response /// </summary> /// <param name="p">current Page</param> /// <param name="str">message to be written</param> static public void PutMessage(Page p, string str) { p.Response.Write("<br />"); p.Response.Write(str); }
So not only is it essentially just prepending an line break tag, but it's using the ASP Classic style of writing directly to the page's response.
I don't think they'll like the attribute that I want to add:
[Obsolete("WHY WOULD YOU DO THIS!?!?!?!?")]
-
[Obsolete("WHY WOULD YOU DO THIS!?!?!?!?")]
I need to put this in about 163 places in our codebase.
-
I need to put this in about 163 places in our codebase.
I've been adding it to our library, at least on my local version.
[code]
Compile complete -- 0 errors, 262 warnings
[/code]
-
-
-
-
[code]
Compile complete -- 0 errors, 310 warnings
[/code]That's only from calls inside the library. There are probably thousands in all of our apps.
-
[Obsolete("WHY WOULD YOU DO THIS!?!?!?!?")]
I need some way to add this to whole libraries in our codebase.
-
If only you could obsolete constructors...
-
-
If only you could obsolete constructors...
[code]
public MyClass()
{
throw new ConstructorObsoletedException("Quit using this code!");
}[/code]
-
I'm going to make the constructor private, since the class only has instance methods. This should be fun.
-
Compile complete -- 0 errors, 310 warnings
Bloody hell. I have one (and that's only because I need a class to call it's constructor, but still haven't connected all the signals to it so the variable is not used later on) and every time I see that warning I feel ashamed.
I admit that I can get a bit OCD about this at times (for example, I have errors set to E_ALL in my PHP bits and warnings will spill on the page so I have to remove them), but how can you/anyone even bare to compile this?
Filed under: not blaming you directly since I can't know how many are yours
-
Every single last one of those warnings is from the Obsolete attributes that I added to my local working copy on methods like the one in the first post of this thread.
The production version I think has about 5 warnings, which I've fixed locally, but aren't worth pushing to production. Mostly because this library is local to every single one of our dozens of apps.
-
Final tally:
[code]
Compile complete -- 0 errors, 387 warnings
[/code]
-
Warnings (100 of 586 items)
That's really low. I think I must have turned some off.
-
So not only is it essentially just prepending an line break tag, but it's using the ASP Classic style of writing directly to the page's response.
You haven't lived until you started using a framework only to work around every single mechanism it uses.
That reminds me of my Web Forms application, which instead of using Web Forms, used JSON-returning pages and a single master page with AJAX requests wired to every control. Good times, good times.
Filed under: i can be trwtf too
-
You haven't lived until you started using a framework only to work around every single mechanism it uses.
That reminds me of my Web Forms application, which instead of using Web Forms, used JSON-returning pages and a single master page with AJAX requests wired to every control. Good times, good times.
jQuery-generating framework written in Perl!