• (cs)

    Did it blow up?

    Were they functions on public class Pandora?

  • Jon Skeet (unregistered)

    I'm not suggesting it really justifies it, but it's possible that the name was intended for anyone changing the method rather than calling it. Every so often it's handy (though really ugly) to have a dummy parameter for the sake of distinguishing calls from an overloading point of view. In that situation, you don't want the called method to use the parameter at all, because you don't know what people might have supplied when it genuinely wasn't being used.

    Just a thought.

  • Phr34ker (unregistered)

    Or it could have been a method in a class that is serialized, that required an Object-variable to be sent in at first, but which later on got unnecessary. If you change the "layout" of the method, all the objects that has been serialized will become invalid (unless you code around it), and so, doing like this could just be the lazy mans way of getting around a change in a Serialized class.

  • (cs)

    There's a bunch of this in the native DirectShow API - probably in MFC too I shouldn't wonder, but life's too short to go and find out.

  • (cs) in reply to Phr34ker
    Phr34ker:
    Or it could have been a method in a class that is serialized, that required an Object-variable to be sent in at first, but which later on got unnecessary. If you change the "layout" of the method, all the objects that has been serialized will become invalid (unless you code around it), and so, doing like this could just be the lazy mans way of getting around a change in a Serialized class.

    And this, ladies and gentlemen, is why you should never use built-in serialization to write into persistent memory. You never know what can of worms you are creating for the future maintaners of your code.

  • Shinobu (unregistered)

    Wow! That's so cute... it brings a smile to my eyes.

  • Dan (unregistered)

    I'm more amazed by the fact there was documentation

  • ElQuberto (unregistered)

    This is like God tempting Adam with the forbidden fruit. Well sorta. If God was a crappy coder.

  • Gnudiff (unregistered)
    Happy Independence Day, U.S. readers! And for you non-U.S. readers, Happy .. errr ... Regular Day of the Week!
    Today is actually a Holocaust remembrance day in Latvia.
  • Pizza Boy (unregistered) in reply to Gnudiff
    Gnudiff:
    Happy Independence Day, U.S. readers! And for you non-U.S. readers, Happy .. errr ... Regular Day of the Week!
    Today is actually a Holocaust remembrance day in Latvia.

    So not exactly a happy day then.

  • noah (unregistered)

    Did anybody ever consider that the name of the parameter means to not use the function? It's possible that the intention was to warn that the function was deprecated, or something to that effect. In fact, I imagine we would have all caught on to it, if not for the summary and title "The Forbidden Parameter".

  • erktrek (unregistered)

    Could be some sort of recursive function thing. IOW do not use this parm for the initial call or something (but subsequent calls need to pass an instance of itself etc etc).

    Nice descriptive naming too... you could also call it the "shinyRedHistoryEraserButton" parm.

  • AdT (unregistered) in reply to erktrek
    erktrek:
    Could be some sort of recursive function thing. IOW do not use this parm for the initial call or something (but subsequent calls need to pass an instance of itself etc etc).

    But then it should be two functions - one for the public interface and one private function that recurses.

    I'm not saying you're wrong, all I say is: Even if you're right, it's still a WTF...

  • AC (unregistered) in reply to noah
    noah:
    Did anybody ever consider that the name of the parameter means to not use the function? It's possible that the intention was to warn that the function was deprecated, or something to that effect. In fact, I imagine we would have all caught on to it, if not for the summary and title "The Forbidden Parameter".

    What an obvious way to declare something deprecated. Anyone would be stupid not to realize it.

    In other news: July 4th is "Ulrichstag", Wikipedia told me. On that day, people (mostly in the Alps) bless everything around them to protect it against bad weather.

  • Jon W (unregistered) in reply to GuntherVB

    It's probably a parameter to make the function behave in a slightly different way, used by some other module, that has internal knowledge about this function, but is not in the same assembly/namespace and thus can't be made internal. Your typical implementation dependence coupling, in other words, with a developer too short on time or give-a-dams to factor and document it better,

  • Sharkie (unregistered) in reply to GuntherVB

    If you pass something as that object, it likely throws a OMFG_I_TOLD_YOU_NOT_TO_USE_IT exception.

  • EPE (unregistered)
    Never before was Steve so intrigued and tempted to find out what might happen if he passed in something ... a string ... an integer ... or even just an itsy-bitsy little bit.
    How can you not pass a parameter? No 'default' values have been declared. Those names seem to imply that the passed data must not be used within the function, instead.
  • FreekV (unregistered) in reply to EPE

    Damn, this "worse than failure" is super lame. It doesn't even... go into an explanation why the parameter is there, that might have been interesting

  • (cs) in reply to FreekV
    FreekV:
    Damn, this "worse than failure" is super lame. It doesn't even... go into an explanation why the parameter is there, that might have been interesting

    I think it's a wtf because we don't know >_>

  • Dana (unregistered) in reply to pin

    The real WTF is that there wasn't a comment explaining the cutesy parameter name. Why play games instead of a simple comment inside the function?

    Another argument for code reviews. A second pair of eyes would have hopefully kept this out of production.

    Captcha: kungfu

  • (cs) in reply to ElQuberto
    ElQuberto:
    This is like God tempting Adam with the forbidden fruit. Well sorta. If God was a crappy coder.

    Ummm, god WAS a crappy coder!

    Let's see, where to start... Vote for your favorite!

    (code reuse)

    1. pleasure organs coupled with waste management
    2. oxygen intake coupled with food/water intake

    (scalability) 3. Antivirus software without automatic updates?! At least it doesn't slow down the system when there is no active infection...

    (extensibility) 4. There's no easy way to use any plug-ins (wings, gills...)

    (maintainability) 5. It's really hard to replace malfunctioning/broken modules (organs)

    (dead code) 6. Look at all the junk DNA!

    1. Garbage collector is not perfect - free radicals accumulate over time?!

    (happy path) 8. Most (if not all) pleasurable/indulgent activities eventually result in unstable system?!

    1. Debugger & source code do not come bundled with the system?!

    2. Maximum average uptime of only 70-90 years, highly dependent on external factors?!

    the list goes on...

  • nerdytenor (unregistered)

    Come on, the real WTF is that nobody can use the call. I'm thinking what they really wanted was:

    public object LoadOrg(int cmpKey, object DO_NOT_USE_AT_ALL_EVER_UNLESS_YOU_ARE_AT_LEAST_SENIOR_SOFTWARE_ENGINEER_LEVEL_5);

  • Bozo the Engineer (unregistered) in reply to Jon Skeet

    Y'know, it is legal to use different names for different methods.

  • Bozo the Engineer (unregistered) in reply to Phr34ker
    Phr34ker:
    Or it could have been a method in a class that is serialized, that required an Object-variable to be sent in at first, but which later on got unnecessary. If you change the "layout" of the method, all the objects that has been serialized will become invalid (unless you code around it), and so, doing like this could just be the lazy mans way of getting around a change in a Serialized class.

    ...or, you could do what a competent developer would do: change the serialVersionUID and modify the deserializer to recognize and handle both versions.

  • Bozo the Engineer (unregistered) in reply to noah
    noah:
    Did anybody ever consider that the name of the parameter means to not use the function? It's possible that the intention was to warn that the function was deprecated, or something to that effect. In fact, I imagine we would have all caught on to it, if not for the summary and title "The Forbidden Parameter".

    @deprecated? private? protected? package?

  • zzo38 (unregistered) in reply to Fry-kun
    Fry-kun:
    .... 6. Look at all the junk DNA! ...
    I saw some joke somewhere said the junk DNA is actually comments

Leave a comment on “Classic WTF: The Forbidden Parameter”

Log In or post as a guest

Replying to comment #:

« Return to Article