• Spreadsheet (unregistered)

    Yes, we definitely need yet another spreadsheet application instead of modifying one of the already existing ones!!

    FIRST!!!!!!!!!!!!!1111111111111^^^^^

  • delete (unregistered)

    Since what most user want to use is Excel, why not making a better one for your company?

    Second?

  • Turd (unregistered)

    Turd

  • delete (unregistered) in reply to Turd

    That seems an offense

  • TV John (unregistered)

    I'm not too familiar with VB, which I presume this is, but I would have thought that:

    RecordFound = DataFacade.GetRecordCount(ItemGuid)

    was valid. Not good, I never said good, but valid. Because of the way that all versions of Basic hold your hand, it would let you put an integer value in to a Boolean - so any record count other than zero would be true.

  • Tobias (unregistered)

    Trigger...interface...reflection....guh?

    Are these special Microsoft things, or do I just not know how to program after all?

  • (cs) in reply to Tobias
    Tobias:
    Trigger...interface...reflection....guh?

    Are these special Microsoft things, or do I just not know how to program after all?

    Trigger is a database thing, trigger an action when an update/delete/insert happens on a particular table. Interfaces found in C++, Java, C#, VB.NET etc. Reflection is Microsoft (.NET) specific I believe.

  • Mii (unregistered) in reply to Tobias
    Tobias:
    Trigger...interface...reflection....guh?

    Are these special Microsoft things, or do I just not know how to program after all?

    If you don't know what reflection is you must be a real geek, never to have seen your own reflection in a mirror..

    it's either that or you're a vampire.. take your pick :P

  • Kevin Kofler (unregistered)

    C++ also allows you to put an int into a bool without a cast (it will be true if and only if the int was nonzero). The C99 _Bool also behaves that way. This is hardly just VB "holding your hand". Not all the world is Java.

  • Mii (unregistered) in reply to Sunday Ironfoot
    Sunday Ironfoot:
    Tobias:
    Trigger...interface...reflection....guh?

    Are these special Microsoft things, or do I just not know how to program after all?

    Trigger is a database thing, trigger an action when an update/delete/insert happens on a particular table. Interfaces found in C++, Java, C#, VB.NET etc. Reflection is Microsoft (.NET) specific I believe.

    PHP and Ruby also have reflection FYI

  • JonC (unregistered) in reply to Sunday Ironfoot
    Sunday Ironfoot:
    Tobias:
    Trigger...interface...reflection....guh?

    Are these special Microsoft things, or do I just not know how to program after all?

    Trigger is a database thing, trigger an action when an update/delete/insert happens on a particular table. Interfaces found in C++, Java, C#, VB.NET etc. Reflection is Microsoft (.NET) specific I believe.

    Reflection isn't Microsoft specific, though it is used quite a bit in .NET http://en.wikipedia.org/wiki/Reflection_(computer_science)

  • Mii (unregistered) in reply to Kevin Kofler
    Kevin Kofler:
    C++ also allows you to put an int into a bool without a cast (it will be true if and only if the int was nonzero). The C99 _Bool also behaves that way. This is hardly just VB "holding your hand". Not all the world is Java.

    That's nothing compared to loosly typed langugaes where you could return a boolean, an int, an Integer object. or a FileNotFound

  • (cs)
    Dim RowIndex As Integer = SpecController.View.Grid.ActiveRowIndex
    SpecController.View.Grid.ActiveRowIndex = RowIndex

    TRWTF is that even in single-threaded .NET program, that's not guaranteed to be a no-op. Doing that could have the side-effect of deleting your entire filesystem, for all you know.

    So who knows, maybe ActiveRowIndex is a property with a huge side-effect, and the original poster actually knew that it did something. More likely he's an idiot though.

  • (cs) in reply to JonC
    JonC:
    Sunday Ironfoot:
    Tobias:
    Trigger...interface...reflection....guh?

    Are these special Microsoft things, or do I just not know how to program after all?

    Trigger is a database thing, trigger an action when an update/delete/insert happens on a particular table. Interfaces found in C++, Java, C#, VB.NET etc. Reflection is Microsoft (.NET) specific I believe.

    Reflection isn't Microsoft specific, though it is used quite a bit in .NET http://en.wikipedia.org/wiki/Reflection_(computer_science)

    In what way is this reflection? It's just run-time type identification as far as I can see. If this be reflection, then C++ "does" reflection via dynamic_cast<> and/or typeid.

    (Of course, sensible C++ would use either templating or a non-pure virtual function here. Not that that's relevant.)

    Is this a case of Microsoft misappropriating a perfectly legitimate and widely used term, as per usual, or is it a case of various posters getting thoroughly confused, as per usual?

    Or me being hopelessly wrong, as per ...

    Addendum (2008-07-04 09:16): And I'm none too convinced by this BeforeDelete implements BeforeDelete stuff, either.

    Actually, there does seem to be an element of relection here, albeit one to do with the database and not the class. I suppose the question being asked is meant to be "does this database/record support delete?" rather than "does this view support delete?" ... which is confusing and dumb.

    Particularly since the actual question being asked (once the bugs noted in the OP are sorted out) is "Does this record exist in the database?"

    Well, the whole thing is a singularly pointless exercise, but it's not a real WTF. It's simply fixed. Go into vi and type 20dd:wq!

    Then put a proper BeforeDelete method into the relevant classes.

  • Rob G (unregistered) in reply to Mii

    ... and Smalltalk, Java, the list goes on...

  • His (unregistered)

    Security check by a function that returns a boolean beforehand instead of throwing an exception when illegally trying to perform the action?!? So the check has to be done in the working method again - and should react there by throwing the exception. So why do it twice?

  • Jax (unregistered)

    Reflection allows you inspect metadata and invoke functions upon a particular object (or even create an instance of that object) without having the object definition at compile-time. It's tightly integrated into the .NET (as the base object has .GetType() which can then move onto reflectiony things like .GetType().GetProperties() etc).

    It's useful when creating dynamic systems or dynamic UI components (that magically work out what an object contains and creates the appropriate columns in a grid for example).

    It's also used to evilly look at internal types and invoke them inside an assembly and used for other seriously evil, evil hacks.

    To me this example sounds like a hacky use of it as well.

  • Anonymous Coward (unregistered)

    Java has reflection too: http://java.sun.com/docs/books/tutorial/reflect/index.html ; as does Smalltalk.

    @real_aardvark: It's a bit more than that. With reflection, you can modify the program's behaviour at runtime - it can compile and add new code to itself as it's running, as long as it knows what to look for. Further, you can tell it what methods to execute via a text file.

    Specifically, I made a "bean loader" that could use the standard Java-bean specification (getX() and setX() rather than exposing the variable) to make a loader that would load any compliant classes, even if I'd never seen them before. Of course, it had slight security problems like allowing 'System.exec("calc.exe")', but that's just because I didn't code in a blacklist.

  • (cs) in reply to Anonymous Coward
    Anonymous Coward:
    Java has reflection too: http://java.sun.com/docs/books/tutorial/reflect/index.html ; as does Smalltalk.

    @real_aardvark: It's a bit more than that. With reflection, you can modify the program's behaviour at runtime - it can compile and add new code to itself as it's running, as long as it knows what to look for. Further, you can tell it what methods to execute via a text file.

    Specifically, I made a "bean loader" that could use the standard Java-bean specification (getX() and setX() rather than exposing the variable) to make a loader that would load any compliant classes, even if I'd never seen them before. Of course, it had slight security problems like allowing 'System.exec("calc.exe")', but that's just because I didn't code in a blacklist.

    Well, yes, that's exactly what I meant by "in what way is this reflection?"

    You could argue that run-time type identification is a sub-set of reflection, but then goto is a subset of while loops, so it's not a very useful lemma.

  • (cs) in reply to Anonymous Coward
    Anonymous Coward:
    Of course, it had slight security problems like allowing 'System.exec("calc.exe")', but that's just because I didn't code in a blacklist.
    No, that's because you didn't use a SecurityManager properly. Java reflection can't defeat the security system; only stupidity can do that.
  • Greg (unregistered)

    No, while loops are subsets of gotos. Gotos are evil. Therefore, loops are evil. Someone, quick, tell all the managers!

  • (cs)

    OP here.

    There seem to be a few questions regarding the fact that I mention reflection without having any in the code snippet. The function itself is invoked using reflection, from whatever view is dealing with the record in question.

    It works like this: View has a record it wants to delete. View checks database for "actions" to invoke on the record before it's deleted If there are "actions", view uses reflection to instance objects based on name View casts these objects to the appropriate interface View calls the BeforeDelete method on the reflection object

    And the whole app is the real WTF. It's pretty much the posterchild to why soft coding is bad.

  • (cs) in reply to Greg
    Greg:
    real_aardvark:
    "Greg" didn't quote his reply, so I fixed it for him! You could argue that run-time type identification is a sub-set of reflection, but then goto is a subset of while loops, so it's not a very useful lemma.
    No, while loops are subsets of gotos. Gotos are evil. Therefore, loops are evil. Someone, quick, tell all the managers!
    I'm not convinced either of you is quite on the mark here (or you both are...) - while loops are surely a formalisation of one common use of gotos. As a result not all gotos are while loops, but while loops are more than just gotos. So while loops are a superset of a subset of gotos.

    The only logical conclusion is that ALL COMPUTERS are evil and we should burn them immediately...

  • picker du nit (unregistered) in reply to real_aardvark
    real_aardvark:
    It's simply fixed. Go into vi and type 20dd:wq!

    Why the exclamation mark?

  • Pierre Tramo (unregistered) in reply to picker du nit
    picker du nit:
    real_aardvark:
    It's simply fixed. Go into vi and type 20dd:wq!

    Why the exclamation mark?

    :wq! -> (try to) _w_rite and _q_uit even if file is not saved !

  • (cs) in reply to JimM
    JimM:
    The only logical conclusion is that ALL COMPUTERS are evil and we should burn them immediately...
    But computers are the creation of PEOPLE, therefore ALL PEOPLE ARE EVIL and we should - oh, work it out for yourselves.
  • (cs) in reply to JonC
    JonC:
    Sunday Ironfoot:
    Tobias:
    Trigger...interface...reflection....guh?

    Are these special Microsoft things, or do I just not know how to program after all?

    Trigger is a database thing, trigger an action when an update/delete/insert happens on a particular table. Interfaces found in C++, Java, C#, VB.NET etc. Reflection is Microsoft (.NET) specific I believe.

    Reflection isn't Microsoft specific, though it is used quite a bit in .NET http://en.wikipedia.org/wiki/Reflection_(computer_science)

    Wow that is.. a special article. Notice how the 'example' section just seems to be an argument between two editors on how to instantiate an object in Actionscript.

  • jamface (unregistered) in reply to webrunner
    webrunner:
    JonC:
    Reflection isn't Microsoft specific, though it is used quite a bit in .NET http://en.wikipedia.org/wiki/Reflection_(computer_science)

    Wow that is.. a special article. Notice how the 'example' section just seems to be an argument between two editors on how to instantiate an object in Actionscript.

    Maybe you stopped the page loading halfway through then. They weren't arguing about it in the Python section...

  • (cs) in reply to JimM
    JimM:
    Greg:
    real_aardvark:
    "Greg" didn't quote his reply, so I fixed it for him! You could argue that run-time type identification is a sub-set of reflection, but then goto is a subset of while loops, so it's not a very useful lemma.
    No, while loops are subsets of gotos. Gotos are evil. Therefore, loops are evil. Someone, quick, tell all the managers!
    I'm not convinced either of you is quite on the mark here (or you both are...) - while loops are surely a formalisation of one common use of gotos. As a result not all gotos are while loops, but while loops are more than just gotos. So while loops are a superset of a subset of gotos.

    The only logical conclusion is that ALL COMPUTERS are evil and we should burn them immediately...

    And that, my Lord, is how we may know the world to be VB.Net-shaped ...

  • Yuck (unregistered)

    Come on people. Why has no one posted "The Real WTF is Visual Basic" yet?

  • picker du nit (unregistered) in reply to Pierre Tramo

    My point was: is there a scenario in which wq wouldn't work, but wq! would?

  • Dirk Gently (unregistered) in reply to Kevin Kofler
    Kevin Kofler:
    Not all the world is Java.
    That's trash talk!
  • (cs) in reply to Yuck
    Yuck:
    Come on people. Why has no one posted "The Real WTF is Visual Basic" yet?
    The Real WTF is Visual Basic. ;)
  • (cs) in reply to real_aardvark
    real_aardvark:
    In what way is this reflection? It's just run-time type identification as far as I can see. If this be reflection, then C++ "does" reflection via dynamic_cast<> and/or typeid.
    RTTI is a C++/Delphi-specific term. It's an extremely limited subset of actual Reflection, which involves not only type inspection, but also dynamic invocation and in some cases modification.

    Reflection in .NET can be used to create instances and invoke methods without a static link to the class or even its assembly. It can also be used to inspect and modify private state. One of the most useful features is that it can also be used to read custom attributes (metadata).

    Some "RTTI" implementations are also able to do some of these things now, but that's because they've gone outside the initial RTTI scope. "Type information" implies being able to read, not write or execute. It also generally implies getting information for types you're vaguely aware of, whereas a common use of Reflection is to deal with totally unknown types, often to enumerate them and see which ones might be relevant for a particular purpose.

    RTTI:Reflection::While:Goto is an extremely bad analogy. Aside from the fact that while uses a conditional jump and goto uses an unconditional one, the jump itself is the primitive that all control structures must be built on. RTTI isn't some primitive or fundamental operation or architecture; it's an implementation of some of what's in the Reflection scope, much like how VBA is a limited implementation of VB, or how XHTML is a limited subset of XML.

  • (cs) in reply to Welbog
    Welbog:
    The function itself is invoked using reflection, from whatever view is dealing with the record in question.

    It works like this: View has a record it wants to delete. View checks database for "actions" to invoke on the record before it's deleted If there are "actions", view uses reflection to instance objects based on name View casts these objects to the appropriate interface View calls the BeforeDelete method on the reflection object

    I can't be the only one thinking that some simple, custom typed event handlers would have been a more adequate solution than breaking out reflection to dynamically instantiate classes and casting those to interfaces to actually work with them.

    Reinventing the square wheel?

  • (cs) in reply to Ragnax
    Ragnax:
    I can't be the only one thinking that some simple, custom typed event handlers would have been a more adequate solution than breaking out reflection to dynamically instantiate classes and casting those to interfaces to actually work with them.

    Reinventing the square wheel?

    If I had any control over this application's design, I would have definitely used a method like that to accomplish this particular goal.

    Unfortunately I'm just the cleanup crew.

  • Jimmy Dolittle (unregistered)

    Well, it sounds to me as if you have your work cut out for you. Good luck with that.

    JT http://www.Ultimate-Anonymity.com

  • (cs) in reply to Welbog
    Welbog:
    OP here.

    And the whole app is the real WTF. It's pretty much the posterchild to why soft coding is bad.

    Hi Welbog

    I wanted to chime in and say that I have yet to see one of these dynamic reflection driven systems that is easier to maintain than a more traditional MVC or base class driven system.

    Ultimately, when one of these systems is taken to its logical conclusion, you get a mishmash of logic scattered all over the show and linked together with attributes, factories and the like.

    Normally (to me, at least, YMMV), a pure reflection driven app is one of the things that could happen when you put 10 geeks in a room with no experienced leader, and they say to each other: "Hey, wouldn't it be cool if we..." (Insert newest shiny stone idea here)

    I spoke to someone recently that called this the Magpie approach to software development, and thought that was a brilliant metaphor.

  • Bill (unregistered)

    Wait, someone found bad VB code? Say it aint so. I wonder how easy the errors would be to correct if you just went and turned Strict on and had the compiler point you to the WTF's in the app.

    VB.NET would get so much less flack if the creators would have made ON as the default for Option Strict, or just removed the ability to turn it off in general. We're 6 years into vb.net now, is there really still a need to allow implicit type conversion? Is Microsoft still trying to convert VB6 developers?

  • (cs) in reply to Aaron
    Aaron:
    real_aardvark:
    In what way is this reflection? It's just run-time type identification as far as I can see. If this be reflection, then C++ "does" reflection via dynamic_cast<> and/or typeid.
    RTTI is a C++/Delphi-specific term. It's an extremely limited subset of actual Reflection, which involves not only type inspection, but also dynamic invocation and in some cases modification.

    Reflection in .NET can be used to create instances and invoke methods without a static link to the class or even its assembly. It can also be used to inspect and modify private state. One of the most useful features is that it can also be used to read custom attributes (metadata).

    Some "RTTI" implementations are also able to do some of these things now, but that's because they've gone outside the initial RTTI scope. "Type information" implies being able to read, not write or execute. It also generally implies getting information for types you're vaguely aware of, whereas a common use of Reflection is to deal with totally unknown types, often to enumerate them and see which ones might be relevant for a particular purpose.

    RTTI:Reflection::While:Goto is an extremely bad analogy. Aside from the fact that while uses a conditional jump and goto uses an unconditional one, the jump itself is the primitive that all control structures must be built on. RTTI isn't some primitive or fundamental operation or architecture; it's an implementation of some of what's in the Reflection scope, much like how VBA is a limited implementation of VB, or how XHTML is a limited subset of XML.

    Well, yes, and thanks for the lecture.

    Plz explane how 2 impelment relfexion w'out RTTI az pirmitvz.

    (The while/goto comment was a throwaway, btw. Not intended to be taken seriously; more a comment on how the OP is absolutely not something that can be described as reflection -- as pointed out by the OP'er him/herself, above.)

    You're going to mention slots at some point here, aren't you? Well, sorry, as far as I'm concerned, slots are a sort of "mixout" mechanism that just enable you to do RTTI on a named-method, type-agnostic basis. It's basically RTTI with the inheritance tree abstracted out.

  • Anonymous Coward (unregistered) in reply to dkf
    dkf:
    Anonymous Coward:
    Of course, it had slight security problems like allowing 'System.exec("calc.exe")', but that's just because I didn't code in a blacklist.
    No, that's because you didn't use a SecurityManager properly. Java reflection can't defeat the security system; only stupidity can do that.

    To be fair, I've never even heard of the SecurityManager. I'm a second-year CS student with only a few years of experience, so this isn't exactly unexpected. As the thing was a throw-away toy, I didn't bother making it secure / pleasant to use / capable of handling malformed files, etc. It was a proof-of-concept that showed I could load pretty well any noncyclical structure in about 100 lines of code.

  • Havok (unregistered)

    Lets mention that you can only use it in grids where the GUID is placed specifically in that column!

    Well, you should thank that at least they are trying to have some arquitecture in their systems. Imagine this kind of stuff copy pasted around all the app.

  • Cabotian (unregistered)

    Okay, maybe I'm missing something, but...

    What is this function supposed to be returning if TypeOf controller is not SpecificController?

  • JD (unregistered)

    No one is pointing out the "If RecordFound = False Then". Which is what a friend of mine uses to call "boolean panic".

    TRWTF is Microsoft

  • CoderHero (unregistered) in reply to Kevin Kofler
    Kevin Kofler:
    C++ also allows you to put an int into a bool without a cast (it will be true if and only if the int was nonzero). The C99 _Bool also behaves that way. This is hardly just VB "holding your hand". Not all the world is Java.

    yes, c++ allows you to convert an int to bool without a cast. And granted, it will work until the day that (value % std::numeric_limits<bool>::max == 0). When that happens you scratch your head and try to understand why the computer isn't working correctly.

  • GregP (unregistered) in reply to JD
    JD:
    No one is pointing out the "If RecordFound = False Then". Which is what a friend of mine uses to call "boolean panic".

    TRWTF is Microsoft

    As WTF'y as that looks - it's an equality check in VB

  • JD (unregistered) in reply to GregP

    You mean it couldn't be written as "If Not/! RecordFound Then"??? Ifs in VB do not evaluate a boolean but a comparission??

  • Edward Royce (unregistered)

    Hmmm.

    This makes baby Jesus cry.

    And me seriously consider giving up programming.

    Perhaps I'm a bit behind the curve here but isn't the process of an application actively modifying code during execution a serious liability in debugging?

    Jeez. And I thought the angst over excessive pointer manipulation in C applications was a pain.

  • (cs)
    3. Getting the active row and then immediately setting the active row to that row. WTF?
    I suspect that the coder in question used to write VB6 or VBA code... Wasn't there a quirk with DAO that required you to MoveFirst -> MoveLast -> MoveFirst in order to really get the first row because the recordset wasn't fully populated until you'd traversed it? If you just invoked MoveFirst, you'd get an empty record.
  • Edward Royce (unregistered) in reply to SenTree
    SenTree:
    JimM:
    The only logical conclusion is that ALL COMPUTERS are evil and we should burn them immediately...
    But computers are the creation of PEOPLE, therefore ALL PEOPLE ARE EVIL and we should - oh, work it out for yourselves.

    Drink plenty of beer?

    Give me a hint man, I'm drowning here.

Leave a comment on “Completely missing the point...”

Log In or post as a guest

Replying to comment #:

« Return to Article