Someone get me a belt fed weapon...



  • In the past couple of hours I have just learned that our Techincal Architect hitherto believed that Java could only connect to web services running in PHP on Linux boxes... That's the architect who thinks I am the muppet in residence here...

    Then, from our crack VB.Net paramilitary wing, we have this...

    Why the hell would you cast something to the type you already know it is> (No, there's nothing below this in the hierarchy) They've done this all over the place...

    <html><body style='color:#000000; background:#ffffff; '>
    Public Property SchedulerService() As WebServiceElement
                Get
                    Return CType(Me("schedulerService"), WebServiceElement)
                End Get
                Set(ByVal value As WebServiceElement)
                    Me("schedulerService") = CType(value, WebServiceElement)
                End Set
            End Property
    


  • @DumbByAssociation said:

    In the past couple of hours I have just learned that our Techincal Architect hitherto believed that Java could only connect to web services running in PHP on Linux boxes... That's the architect who thinks I am the muppet in residence here...

    Then, from our crack VB.Net paramilitary wing, we have this...

    Why the hell would you cast something to the type you already know it is> (No, there's nothing below this in the hierarchy) They've done this all over the place...

    Public Property SchedulerService() As WebServiceElement
                Get
                    Return CType(Me("schedulerService"), WebServiceElement)
                End Get
                Set(ByVal value As WebServiceElement)
                    Me("schedulerService") = CType(value, WebServiceElement)
                End Set
            End Property
    

    For the Get part:  You need to do that if Option Strict is on, and you need to force strong typing.  If I am reading this right they are passing a string to the default method of itself (Me==this in C#).  The return type from the method is probably something like "Object", seing people still tend to do those kind of things, so they would need to cast it to the return type. 

     For the set part:  I have no Idea why they are casting it.  Value would alrady be of type WebServiceElement.  I am guessing some manager put down a standard, or everyone is just very fond of copy/paste.



  • @The Bytemaster said:

    For the set part:  I have no Idea why they are casting it.  Value would alrady be of type WebServiceElement.  I am guessing some manager put down a standard, or everyone is just very fond of copy/paste.

    Or: someone read one MS example of GET/SET coding the first time they needed to write one, and somehow managed to assume that because MS used CType in the GET and the SET, that's somehow that's always necessary, whereas actually it was in the SET purely as … well, an example! They then slavishly repeat their cock-eyed notion of the'correct' way to do it forever, not once questioning it nor ever figuring out that as you correctly said, CType is utterly redundant in the SET.

    I've seen that kind of thing happen many times, both in VB and in other languages. I think the OP has already posited the best solution to the problem, though. :)


  • Winner of the 2016 Presidential Election

    @Cad Delworth said:

    @The Bytemaster said:
    For the set part:  I have no Idea why they are casting it.  Value would alrady be of type WebServiceElement.  I am guessing some manager put down a standard, or everyone is just very fond of copy/paste.

    Or: someone read one MS example of GET/SET coding the first time they needed to write one, and somehow managed to assume that because MS used CType in the GET and the SET, that's somehow that's always necessary, whereas actually it was in the SET purely as … well, an example! They then slavishly repeat their cock-eyed notion of the'correct' way to do it forever, not once questioning it nor ever figuring out that as you correctly said, CType is utterly redundant in the SET.

    I've seen that kind of thing happen many times, both in VB and in other languages. I think the OP has already posited the best solution to the problem, though. :)

    If only there was a term to succinctly describe this kind of ignorant mimicry.



  • @DumbByAssociation said:

    In the past couple of hours I have just learned that our Techincal Architect hitherto believed that Java could only connect to web services running in PHP on Linux boxes... That's the architect who thinks I am the muppet in residence here...

    Then, from our crack VB.Net paramilitary wing, we have this...

    Why the hell would you cast something to the type you already know it is> (No, there's nothing below this in the hierarchy) They've done this all over the place...

    Public Property SchedulerService() As WebServiceElement
                Get
                    Return CType(Me("schedulerService"), WebServiceElement)
                End Get
                Set(ByVal value As WebServiceElement)
                    Me("schedulerService") = CType(value, WebServiceElement)
                End Set
            End Property
    

     

     

    Quick, someone tell them. They've reinvented DependencyObject.

     



  • @joe.edwards said:

    If only there was a term to succinctly describe this kind of ignorant mimicry.


    Unfortunately, only ever using the succinct term to refer to the concept helps other people to just ignorantly mimic that term with no actual understanding of the underlying concept.



  • @aihtdikh said:

    @joe.edwards said:

    If only there was a term to succinctly describe this kind of ignorant mimicry.


    Unfortunately, only ever using the succinct term to refer to the concept helps other people to just ignorantly mimic that term with no actual understanding of the underlying concept.

    That's why I prefer the term "wilfully ignorant dipshits who should never be allowed to code ever again".



  • @Cad Delworth said:

    @The Bytemaster said:
    For the set part:  I have no Idea why they are casting it.  Value would alrady be of type WebServiceElement.  I am guessing some manager put down a standard, or everyone is just very fond of copy/paste.

    Or: someone read one MS example of GET/SET coding the first time they needed to write one, and somehow managed to assume that because MS used CType in the GET and the SET, that's somehow that's always necessary, whereas actually it was in the SET purely as … well, an example! They then slavishly repeat their cock-eyed notion of the'correct' way to do it forever, not once questioning it nor ever figuring out that as you correctly said, CType is utterly redundant in the SET.

    I thought that was pretty much de rigueur for learning VB/VB.NET.



  • @db2 said:

    @Cad Delworth said:

    Or: someone read one MS example of GET/SET coding the first time they needed to write one, and somehow managed to assume that because MS used CType in the GET and the SET, that's somehow that's always necessary, whereas actually it was in the SET purely as … well, an example! They then slavishly repeat their cock-eyed notion of the'correct' way to do it forever, not once questioning it nor ever figuring out that as you correctly said, CType is utterly redundant in the SET.

    I thought that was pretty much de rigueur for learning VB/VB.NET.


    Much depends on whether you've already got your programming chops in a different language before learning VB/VB.NET.



  • @joe.edwards said:

    If only there was a term to succinctly describe this kind of ignorant mimicry.

    So THAT'S what Cargo Cult Programming means!



  • @Cad Delworth said:

    @joe.edwards said:

    If only there was a term to succinctly describe this kind of ignorant mimicry.

    So THAT'S what Cargo Cult Programming means!
     

    I know, huh? I was just using the term become an old manager used it once and the team made good software.

     



  • @Lorne Kates said:

    @Cad Delworth said:

    @joe.edwards said:

    If only there was a term to succinctly describe this kind of ignorant mimicry.

    So THAT'S what Cargo Cult Programming means!
     

    I know, huh? I was just using the term become an old manager used it once and the code compiled.

     

    FTFY


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.