Practicing the Dark Arts of Invocation
-
I gave up counting them after reading
optional byref p2 as object
just luckily its the practically weekend at 5:30 today (long live the long weekend :D)Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON
Luckily I've got two weeks vacation - I think I need it. My eyes are bleeding.
"If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.
-
Sadly, its 3rd party code I have to interface to. It kinda works, but X| ! (At least it works 'til it fails horribly, when someone calls a function with one too many parameters, when it fail ungracefully)
"If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.
Have somea lot of :beer:.
What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???
-
Sadly, its 3rd party code I have to interface to. It kinda works, but X| ! (At least it works 'til it fails horribly, when someone calls a function with one too many parameters, when it fail ungracefully)
"If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.
Oh, and the person who created this needs to be bashed over the head with a solid iron clue bat. Several times.
What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???
-
I think this just speaks for itself... (I apologise in advance for the pain caused) How many bad practices can y'all spot in this?
Function InvokeMember(MethodName As String, \_ Optional ByRef P1 As Object = "!%$", Optional ByRef P2 As Object = "!%$", \_ Optional ByRef P3 As Object = "!%$", Optional ByRef P4 As Object = "!%$", \_ Optional ByRef P5 As Object = "!%$", Optional ByRef P6 As Object = "!%$", \_ Optional ByRef P7 As Object = "!%$", Optional ByRef P8 As Object = "!%$", \_ Optional ByRef P9 As Object = "!%$", Optional ByRef P10 As Object = "!%$", \_ Optional ByRef P11 As Object = "!%$") As Object Dim Parms(0) As Object If P1.GetType Is GetType(String) Then If P1 = "!%$" Then GoTo a150 Parms(0) = P1 If P2.GetType Is GetType(String) Then If P2 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P2 If P3.GetType Is GetType(String) Then If P3 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P3 If P4.GetType Is GetType(String) Then If P4 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P4 If P5.GetType Is GetType(String) Then If P5 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P5 If P6.GetType Is GetType(String) Then If P6 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P6 If P7.GetType Is GetType(String) Then If P7 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P7 If P8.GetType Is GetType(String) Then If P8 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P8 If P9.GetType Is GetType(String) Then If P9 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P9 If P10.GetType Is GetType(String) Then If P10 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P10 If P11.GetType Is GetType(String) Then If P11 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P11
a100:
On Error GoTo a200But why would you want to do something like that? :confused:
Wrong is evil and must be defeated. - Jeff Ello
-
I think this just speaks for itself... (I apologise in advance for the pain caused) How many bad practices can y'all spot in this?
Function InvokeMember(MethodName As String, \_ Optional ByRef P1 As Object = "!%$", Optional ByRef P2 As Object = "!%$", \_ Optional ByRef P3 As Object = "!%$", Optional ByRef P4 As Object = "!%$", \_ Optional ByRef P5 As Object = "!%$", Optional ByRef P6 As Object = "!%$", \_ Optional ByRef P7 As Object = "!%$", Optional ByRef P8 As Object = "!%$", \_ Optional ByRef P9 As Object = "!%$", Optional ByRef P10 As Object = "!%$", \_ Optional ByRef P11 As Object = "!%$") As Object Dim Parms(0) As Object If P1.GetType Is GetType(String) Then If P1 = "!%$" Then GoTo a150 Parms(0) = P1 If P2.GetType Is GetType(String) Then If P2 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P2 If P3.GetType Is GetType(String) Then If P3 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P3 If P4.GetType Is GetType(String) Then If P4 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P4 If P5.GetType Is GetType(String) Then If P5 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P5 If P6.GetType Is GetType(String) Then If P6 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P6 If P7.GetType Is GetType(String) Then If P7 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P7 If P8.GetType Is GetType(String) Then If P8 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P8 If P9.GetType Is GetType(String) Then If P9 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P9 If P10.GetType Is GetType(String) Then If P10 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P10 If P11.GetType Is GetType(String) Then If P11 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P11
a100:
On Error GoTo a200Rob Grainger wrote:
(PS - this is actually VB.NET code).
It's a disgrace, and that's language agnostic (which is pretty hip by the way) :D
Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.
Simplicity is prerequisite for reliability. — Edsger W. Dijkstra
Regards, Sander
-
Rob Grainger wrote:
(PS - this is actually VB.NET code).
It's a disgrace, and that's language agnostic (which is pretty hip by the way) :D
Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.
Simplicity is prerequisite for reliability. — Edsger W. Dijkstra
Regards, Sander
Sander Rossel wrote:
It's a disgrace, and that's language agnostic (which is pretty hip by the way)
I'm trying real hard to take it to the next level and be language atheist, but its not working out to well so far. ;-)
"If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.
-
Sander Rossel wrote:
It's a disgrace, and that's language agnostic (which is pretty hip by the way)
I'm trying real hard to take it to the next level and be language atheist, but its not working out to well so far. ;-)
"If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.
I love VB.NET and I love C#. I'm trying to love JavaScript, but it just gives me so much reasons to hate it... I really hate HTML and CSS and I'm past the points where I'd like to like it. They're not programming languages anyway. Each language you know makes learning another language easier. Try to look past the language specific part and see how your knowledge about some language can be applied to other languages :D
Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.
Simplicity is prerequisite for reliability. — Edsger W. Dijkstra
Regards, Sander
-
I love VB.NET and I love C#. I'm trying to love JavaScript, but it just gives me so much reasons to hate it... I really hate HTML and CSS and I'm past the points where I'd like to like it. They're not programming languages anyway. Each language you know makes learning another language easier. Try to look past the language specific part and see how your knowledge about some language can be applied to other languages :D
Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.
Simplicity is prerequisite for reliability. — Edsger W. Dijkstra
Regards, Sander
"Each language you know makes learning another language easier." Don't know, after a point if you keep learning similar (read imperative, OO) languages you reach a point where you pick up another one quickly, but you'll still have a certain time. Normally its libraries/frameworks which take most time. Especially for JavaScript where there seems to a new framework every day. To really push yourself step outside the comfort zone. Try a functional language (A LISP variant and Haskell are particular good for going outside the comfort zone). Try a real OO language like Smalltalk. That kind of difference changes the whole way you think about programming.
"If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.
-
"Each language you know makes learning another language easier." Don't know, after a point if you keep learning similar (read imperative, OO) languages you reach a point where you pick up another one quickly, but you'll still have a certain time. Normally its libraries/frameworks which take most time. Especially for JavaScript where there seems to a new framework every day. To really push yourself step outside the comfort zone. Try a functional language (A LISP variant and Haskell are particular good for going outside the comfort zone). Try a real OO language like Smalltalk. That kind of difference changes the whole way you think about programming.
"If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.
Even the JavaScript frameworks look similar after a while. Once you know what they do it's relatively easy to find how they do it. Usually there are some HTML bindings, some viewModel thingy, etc. I know C#, VB(.NET), SQL, JavaScript, HTML, CSS, LESS, some Haskell, F#, and Java, and I've read other languages like Lisp, Ada, C, C++, and Cobol. I should try a non-managed language some time, and I mean really working with it. Learning new languages can be fun, it's just a little useless if you can't really use it in day to day life :sigh: Although learning Haskell and F# did make me a better C# programmer.
Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.
Simplicity is prerequisite for reliability. — Edsger W. Dijkstra
Regards, Sander
-
I think this just speaks for itself... (I apologise in advance for the pain caused) How many bad practices can y'all spot in this?
Function InvokeMember(MethodName As String, \_ Optional ByRef P1 As Object = "!%$", Optional ByRef P2 As Object = "!%$", \_ Optional ByRef P3 As Object = "!%$", Optional ByRef P4 As Object = "!%$", \_ Optional ByRef P5 As Object = "!%$", Optional ByRef P6 As Object = "!%$", \_ Optional ByRef P7 As Object = "!%$", Optional ByRef P8 As Object = "!%$", \_ Optional ByRef P9 As Object = "!%$", Optional ByRef P10 As Object = "!%$", \_ Optional ByRef P11 As Object = "!%$") As Object Dim Parms(0) As Object If P1.GetType Is GetType(String) Then If P1 = "!%$" Then GoTo a150 Parms(0) = P1 If P2.GetType Is GetType(String) Then If P2 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P2 If P3.GetType Is GetType(String) Then If P3 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P3 If P4.GetType Is GetType(String) Then If P4 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P4 If P5.GetType Is GetType(String) Then If P5 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P5 If P6.GetType Is GetType(String) Then If P6 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P6 If P7.GetType Is GetType(String) Then If P7 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P7 If P8.GetType Is GetType(String) Then If P8 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P8 If P9.GetType Is GetType(String) Then If P9 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P9 If P10.GetType Is GetType(String) Then If P10 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P10 If P11.GetType Is GetType(String) Then If P11 = "!%$" Then GoTo a100 ReDim Preserve Parms(UBound(Parms) + 1) : Parms(UBound(Parms)) = P11
a100:
On Error GoTo a200Yuck! That reads like FORTRAN 66 was the author's first programming language. :laugh:
__________________ Lord, grant me the serenity to accept that there are some things I just can’t keep up with, the determination to keep up with the things I must keep up with, and the wisdom to find a good RSS feed from someone who keeps up with what I’d like to, but just don’t have the damn bandwidth to handle right now. © 2009, Rex Hammock
-
I had to highlight that - at a casual glance it looks just like VB6 code, which is a WTF in itself.
"If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.
I was just about to comment that is looks more as VB6 then VB.NET It is a terrible, terrible mess of VB6 programmer(s) trying to cross over :omg: