Comment On Completely missing the point...

Originally posted to the Sidebar by "Welbog"... [expand full text]
« PrevPage 1 | Page 2Next »

Re: Completely missing the point...

2008-07-04 08:04 • by Spreadsheet (unregistered)
Yes, we definitely need yet another spreadsheet application instead of modifying one of the already existing ones!!



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

Re: Completely missing the point...

2008-07-04 08:18 • by delete (unregistered)
Since what most user want to use is Excel, why not making a better one for your company?


Second?

Re: Completely missing the point...

2008-07-04 08:19 • by Turd (unregistered)
Turd

Re: Completely missing the point...

2008-07-04 08:27 • by delete (unregistered)
204515 in reply to 204511
That seems an offense

Re: Completely missing the point...

2008-07-04 08:44 • by 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.

Re: Completely missing the point...

2008-07-04 08:45 • by Tobias (unregistered)
Trigger...interface...reflection....guh?

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

Re: Completely missing the point...

2008-07-04 08:48 • by Sunday Ironfoot
204520 in reply to 204519
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.

Re: Completely missing the point...

2008-07-04 08:50 • by Mii (unregistered)
204521 in reply to 204519
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

Re: Completely missing the point...

2008-07-04 08:51 • by 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.

Re: Completely missing the point...

2008-07-04 08:51 • by Mii (unregistered)
204523 in reply to 204520
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

Re: Completely missing the point...

2008-07-04 08:52 • by JonC (unregistered)
204524 in reply to 204520
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)

Re: Completely missing the point...

2008-07-04 08:52 • by Mii (unregistered)
204525 in reply to 204522
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

Re: Completely missing the point...

2008-07-04 09:02 • by Markp

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.

Re: Completely missing the point...

2008-07-04 09:05 • by real_aardvark
204528 in reply to 204524
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.

Re: Completely missing the point...

2008-07-04 09:13 • by Rob G (unregistered)
204530 in reply to 204523
... and Smalltalk, Java, the list goes on...

Re: Completely missing the point...

2008-07-04 09:13 • by 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?

Re: Completely missing the point...

2008-07-04 09:13 • by 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.

Re: Completely missing the point...

2008-07-04 09:14 • by 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.

Re: Completely missing the point...

2008-07-04 09:17 • by real_aardvark
204534 in reply to 204533
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.

Re: Completely missing the point...

2008-07-04 09:20 • by dkf
204535 in reply to 204533
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.

Re: Completely missing the point...

2008-07-04 09:24 • by Greg (unregistered)
No, while loops are subsets of gotos. Gotos are evil. Therefore, loops are evil. Someone, quick, tell all the managers!

Re: Completely missing the point...

2008-07-04 09:39 • by Welbog
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.

Re: Completely missing the point...

2008-07-04 09:39 • by JimM
204540 in reply to 204536
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...

Re: Completely missing the point...

2008-07-04 09:41 • by picker du nit (unregistered)
204541 in reply to 204528
real_aardvark:
It's simply fixed. Go into vi and type 20dd:wq!


Why the exclamation mark?

Re: Completely missing the point...

2008-07-04 09:46 • by Pierre Tramo (unregistered)
204543 in reply to 204541
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 _!_

Re: Completely missing the point...

2008-07-04 09:56 • by SenTree
204546 in reply to 204540
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.

Re: Completely missing the point...

2008-07-04 09:57 • by webrunner
204547 in reply to 204524
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.

Re: Completely missing the point...

2008-07-04 10:10 • by jamface (unregistered)
204550 in reply to 204547
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...

Re: Completely missing the point...

2008-07-04 10:10 • by real_aardvark
204551 in reply to 204540
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 ...

Re: Completely missing the point...

2008-07-04 10:14 • by Yuck (unregistered)
Come on people. Why has no one posted "The Real WTF is Visual Basic" yet?

Re: Completely missing the point...

2008-07-04 10:20 • by picker du nit (unregistered)
204554 in reply to 204543
My point was: is there a scenario in which wq wouldn't work, but wq! would?

Re: Completely missing the point...

2008-07-04 10:23 • by Dirk Gently (unregistered)
204555 in reply to 204522
Kevin Kofler:
Not all the world is Java.

That's trash talk!

Re: Completely missing the point...

2008-07-04 10:41 • by danixdefcon5
204558 in reply to 204552
Yuck:
Come on people. Why has no one posted "The Real WTF is Visual Basic" yet?
The Real WTF is Visual Basic. ;)

Re: Completely missing the point...

2008-07-04 10:44 • by Aaron
204560 in reply to 204528
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.

Re: Completely missing the point...

2008-07-04 10:51 • by Ragnax
204562 in reply to 204539
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?

Re: Completely missing the point...

2008-07-04 10:57 • by Welbog
204563 in reply to 204562
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.

Re: Completely missing the point...

2008-07-04 10:57 • by 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

Re: Completely missing the point...

2008-07-04 11:05 • by Joon
204565 in reply to 204539
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.

Re: Completely missing the point...

2008-07-04 11:12 • by 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?

Re: Completely missing the point...

2008-07-04 11:25 • by real_aardvark
204570 in reply to 204560
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.

Re: Completely missing the point...

2008-07-04 11:59 • by Anonymous Coward (unregistered)
204572 in reply to 204535
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.

Re: Completely missing the point...

2008-07-04 12:42 • by 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.

Re: Completely missing the point...

2008-07-04 13:20 • by Cabotian (unregistered)
Okay, maybe I'm missing something, but...

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

Re: Completely missing the point...

2008-07-04 13:22 • by 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

Re: Completely missing the point...

2008-07-04 13:23 • by CoderHero (unregistered)
204579 in reply to 204522
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.

Re: Completely missing the point...

2008-07-04 13:35 • by GregP (unregistered)
204581 in reply to 204578
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

Re: Completely missing the point...

2008-07-04 13:38 • by JD (unregistered)
204582 in reply to 204581
You mean it couldn't be written as "If Not/! RecordFound Then"??? Ifs in VB do not evaluate a boolean but a comparission??

Re: Completely missing the point...

2008-07-04 13:41 • by 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.

Re: Completely missing the point...

2008-07-04 13:46 • by protected static
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.

Re: Completely missing the point...

2008-07-04 13:47 • by Edward Royce (unregistered)
204585 in reply to 204546
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.
« PrevPage 1 | Page 2Next »

Add Comment