- 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
Simpson's mocking laugh: "HAA-ha!"
Admin
Admin
I had precisely this sort of discussion with a programmer who insisted on his nine, ten, eleven etc. parameter methods and constructors. His argument: "But that would mean writing yet another class just to pass these parameters around between these one, two, three .... goodness, six classes. Yet another class!" Putting on a patronising voice: "Don't you think this will make it just a tiny little bit overcomplicated?"
And don't try refactoring the code he wrote or he would complain to the manager you'd "changed his code".
Had one conversation "Did you change my code?!?!?" he screamed across the office. "Yes I did," I replied, "It had shitty nappies." ("nappies": UK English for "diapers".)
Admin
Because computers aren't at all procedural, right?
Admin
No, it's not Mort, I killed him and ate him ages ago. Most of him, his bones were all rubbery though so I left those.
Admin
Admin
I felt the need to pre-emptively defend my usage of Visual Basic .NET against the raving hordes of people who think anything with Visual Basic in the name (new or old) is the Worst Thing in the Entire Universe.
The sample program for the library is in CS. My program is in VB. The library (obviously) works with both languages, but some of the samples were only provided in one.
Admin
"A Trigger happy ex-girlfriend"...
..."Shall we shoot them?"
If it were only that simple!!
Admin
"In a strictly object oriented environment like C#/.NET," writes J.D., "there's really no such thing as 'global variables'. Sure, you can create global variables, but the folks looking to (ab)use global variables generally can't tell the difference."
No, wait:
"In a completely arbitrary object oriented environment like C#/.NET," writes J.D., "there's really no coherent notion of variables or values or types'. Sure, you can create classes and call methods and throw buzzwords around, but the folks looking to relate your steaming pile of illogic to anything remotely resembling math will have a hard time making that conceptual leap."
Admin
I seem to have experienced a case of complete and total markup failure.
Admin
This sounds like the next evolution of some of the people that I went to University with.
There was one person that was in my Introduction to Computer Science course who couldn't work out how to properly pass arguments (references/pointers) to functions. Instead, at the start of every function he would paste a snippet of code that he wrote to load all of his data from a file. Before he function call of course he would paste a similar snippet to save everything to a file.
At least this is one step better than that....
Admin
Well there was quite a bit of editing on this story so don't assume that it's my grammar that's at fault. Not that I mind the editing at all, my submission was very light on (sorry!) and this gives a pretty accurate description.
Fortunately the people responsible for this have left, which means I can rewrite the code without fear of retribution. Unfortunately it's all like this and I don't have time to rewrite it all. Don't even ask me about the static class with 2700 lines of public static methods and variables.
Admin
Admin
Admin
Admin
Maroochydore!
Admin
Admin
Admin
Admin
There's obvioulsy noone in the universe who could produce code that's even close to your standard.
Admin
Admin
One of the strangest things I saw was chunks of FORTRAN code in a .cs file (retained to give context) not commented out, but rather prevented from compiling with #if.
relevant xkcdAdmin
Actually, it was Jägermeister and a Slurpee machine. :-)
Admin
"Eeny, meeny, miney, mo Catch a redneck by his toe ..."
Admin
First find some code of mine that you consider substandard, then feel free to challenge its quality, pissbrain. Then FOAD.
Admin
You should write such code that other coders can understand it. Compiler will translate the code to a language that computer understands.
Admin
And indeed you have the Preview button to check your posts before you send them off, so there's really not much excuse (and if you're registered, you can edit your post if you notice an error after the fact).
Not that CS isn't a pile of WTF, but this is just laziness or carelessness on the part of the poster, not CS's fault.
Admin
Don't feed the troll, please!
Admin
That's what happens if you can't or don't use macros and templates!
Admin
Admin
Admin
Admin
Of course globals exist in oo world, Can you say Singleton pattern!!
Admin
Admin
Clearly exists a problem with mathematical operators being static and not instance methods.
int x = 1; int y = 2; int i = x + y;
If, by this logic, static is a bad thing that must be avoided like a plage. then the only correct way is:
int x = 1; int y = 2; int i = x.add(y);
But "int" is also a static type ( Static Languague, duh? ).
object x = (new TypesFactory()).CreateIntFactory().CreateInt(IntFactory.Int1); object y = (new TypesFactory()).CreateIntFactory().CreateInt(IntFactory.Int2); object i = x.add(y);
Much better now.
Admin
I made a mistake, used static constantes int1 and int2, a little bit of refactorization.
object tf = (new TypesFactory()).CreateIntFactory(); object x = tf.CreateInt(tf.Int1); object y = tf.CreateInt(tf.Int2); object i = x.add(y);
Admin
That's a bit shit. You can't have Int1 and Int2 and expect us to believe this is sensible. What about:
object tf = (new TypesFactory()).CreateIntFactory(); object x = tf.CreateInt(1); object y = tf.CreateInt(2); object i = x.add(y);
Now, as it stands, that's almost sane.
In java, that would be:
IntegerFactory f = IntegerFactory.getInstance(); Integer x = f.CreateInt(1); Integer y = f.CreateInt(2); Integer i = x.add(y);
You could go a step further and go:
Integer x = Integer.getInstance(1); Integer y = Integer.getInstance(2); Integer i = x.add(y);
Can't be bothered to look up the precise syntax for the above (it's probably not getInstance, but I'm not in front of an IDE at the moment and I can't be arsed to look it up), so the detail is probably wrong.
Fortunately java has plenty of syntactic sugar so the above is not necessary.
Anyone who suggests that static methods are wrong is full of shit.
Admin
But nobody said "static methods are wrong". What was said is "Static methods should be use sparingly". I said myself that I've used static methods, but I wouldn't make EVERYTHING static methods, and I wouldn't trust any developer clueless enough to think that it's okay to have classes that should be instances have nothing but static methods because they can't be arsed to instantiate something.
Admin
Putting method on Brillant class, using by:
Admin
We are already having a static Nagesh class, and it is being able to be called from any TDWTF poster. This is the problem, you see. I am thinking that a singleton is perhaps a better solution to the problem that we are having.
Admin
Although especially the former is perhaps not the best example...
Admin
Admin
Admin
Java EE and most associated frameworks are why we can't have nice things. Also, since Java doesn't have the concept of AppDomain, singletons are shared across the whole JVM,which seems pretty WTFy to me.
Admin
Admin
Second of all, you aren't likely to figure out the benefits of using OOP here until you actually do it.
My ActiveDirectory class didn't start out all advanced with every bell and whistle. But because I didn't make it a static class, I was able to grow it over time into the feature-packed, performant beauty of OO design that it is today.
To get the same functionality I ended up eventually needing in my ActiveDirectory class using a static class would have required dozens or hundreds of static methods. It's a lot less ugly when those methods are bound to data rather than using spaghetti code/static classes.
OOP is a good thing. I have never once written a stateless class (other than extension methods).
On to your example. XML receipt, processing, and transmitting is one of the most common things you have to do today. I went the other direction than you and made my own Xml namespace with classes like Post<T>, ElementDispatcher<T>, and ElementAction<T> (although that last one is a struct) to encapsulate the whole process.
Now all my streaming XML parsing is generic + generalized, and I will never, ever write that code again. But you will. All I have to do is specify endpoints, elements, and the lambdas that act on the elements in the XML stream and the target T that will be modified by those lambda statements.
OOP is better than what we had before. You will get much further with it than you will by regressing back to the most primitive programming techniques.
Addendum (2011-09-29 09:30): And by "never once written a stateless class", I am not referring to SOA. SOA might get away with statelessness, although all of my RESTful work still caches behind the scenes...
Admin
Admin
i am allmost positive fake nagesh is opereted by frits or boog.
Admin
Admin
BTW- Who is frits, but a registered sock puppet anyway?