Why, oh why....



  • On a Saturday (non-billable) trying to solve a few things before the engagement ends at EOM....

    Mazimize(true) means DONT maximize, 
    Maximize(false) is what will maximize...
    

    I should have opened a Deli, so many decades ago...


  • Java Dev

    @TheCPUWizard said in Why, oh why....:

    On a Saturday (non-billable) trying to solve a few things before the engagement ends at EOM....

    Mazimize(true) means DONT maximize, 
    Maximize(false) is what will maximize...
    

    I should have opened a Deli, so many decades ago...

    :trwtf: is having boolean arguments at all. They are (nearly) always confusing.



  • @PleegWat said in Why, oh why....:

    :trwtf: is having boolean arguments at all. They are (nearly) always confusing.

    In at least 90% (probably more) of cases, complete agreement. Yet I would not go so far as to say they should be eliminated (by language design)


  • Considered Harmful

    @PleegWat said in Why, oh why....:

    @TheCPUWizard said in Why, oh why....:

    On a Saturday (non-billable) trying to solve a few things before the engagement ends at EOM....

    Mazimize(true) means DONT maximize, 
    Maximize(false) is what will maximize...
    

    I should have opened a Deli, so many decades ago...

    :trwtf: is having boolean arguments at all. They are (nearly) always confusing.

    Seems like a rather boolean position. I say you're wrong. I don't actually believe this to be the case, but I am saying it.



  • @PleegWat said in Why, oh why....:

    @TheCPUWizard said in Why, oh why....:

    On a Saturday (non-billable) trying to solve a few things before the engagement ends at EOM....

    Mazimize(true) means DONT maximize, 
    Maximize(false) is what will maximize...
    

    I should have opened a Deli, so many decades ago...

    :trwtf: is having boolean arguments at all. They are (nearly) always confusing.

    My favorite is the DereferenceLinks property of various FileDialogs. I can never remember what true/false actually means in that context and the Intellisense tooltip hint is absolutely no help.


  • BINNED

    @Zenith said in Why, oh why....:

    @PleegWat said in Why, oh why....:

    @TheCPUWizard said in Why, oh why....:

    On a Saturday (non-billable) trying to solve a few things before the engagement ends at EOM....

    Mazimize(true) means DONT maximize, 
    Maximize(false) is what will maximize...
    

    I should have opened a Deli, so many decades ago...

    :trwtf: is having boolean arguments at all. They are (nearly) always confusing.

    My favorite is the DereferenceLinks property of various FileDialogs. I can never remember what true/false actually means in that context and the Intellisense tooltip hint is absolutely no help.

    Isn't it pretty obvious for verbs? Maximize, dereference, ... What else should that mean?

    At least if you can see the parameter / property name. A long list of true/false is indeed pretty confusing, but so are other kinds of parameters, so that's an argument for named parameters.


  • Java Dev

    @topspin said in Why, oh why....:

    @Zenith said in Why, oh why....:

    @PleegWat said in Why, oh why....:

    @TheCPUWizard said in Why, oh why....:

    On a Saturday (non-billable) trying to solve a few things before the engagement ends at EOM....

    Mazimize(true) means DONT maximize, 
    Maximize(false) is what will maximize...
    

    I should have opened a Deli, so many decades ago...

    :trwtf: is having boolean arguments at all. They are (nearly) always confusing.

    My favorite is the DereferenceLinks property of various FileDialogs. I can never remember what true/false actually means in that context and the Intellisense tooltip hint is absolutely no help.

    Isn't it pretty obvious for verbs? Maximize, dereference, ... What else should that mean?

    At least if you can see the parameter / property name. A long list of true/false is indeed pretty confusing, but so are other kinds of parameters, so that's an argument for named parameters.

    In my experience, booleans are the most likely to be passed as a literal value in an 'additional' argument. Other types are more likely to be the primary argument (whose meaning is reflected in the function name), and are more likely to be set using a variable whose value originates elsewhere (hopefully with a descriptive name, but that's a different matter).



  • @topspin said in Why, oh why....:

    @Zenith said in Why, oh why....:

    @PleegWat said in Why, oh why....:

    @TheCPUWizard said in Why, oh why....:

    On a Saturday (non-billable) trying to solve a few things before the engagement ends at EOM....

    Mazimize(true) means DONT maximize, 
    Maximize(false) is what will maximize...
    

    I should have opened a Deli, so many decades ago...

    :trwtf: is having boolean arguments at all. They are (nearly) always confusing.

    My favorite is the DereferenceLinks property of various FileDialogs. I can never remember what true/false actually means in that context and the Intellisense tooltip hint is absolutely no help.

    Isn't it pretty obvious for verbs? Maximize, dereference, ... What else should that mean?

    At least if you can see the parameter / property name. A long list of true/false is indeed pretty confusing, but so are other kinds of parameters, so that's an argument for named parameters.

    I recently fixed some code to remove a boolean parameter from a function.

    So now it only takes 4 boolean params instead of 5.

    frobnicate(dataset, true, true, false, true);


  • @topspin it's the phrasing. A shortcut references another location. Does dereferenceing it undo reference and point to the LNK file? Or does dereferencing collapse the middleman LNK file and go to the target? Then the help says something like "is dereferenced or not" instead of something unambiguous like "true means the LNK, false means the target." When I wrote my own file windows I was far more explicit.



  • @Zenith They fixed it.


  • Considered Harmful

    @topspin said in Why, oh why....:

    @Zenith said in Why, oh why....:

    @PleegWat said in Why, oh why....:

    @TheCPUWizard said in Why, oh why....:

    On a Saturday (non-billable) trying to solve a few things before the engagement ends at EOM....

    Mazimize(true) means DONT maximize, 
    Maximize(false) is what will maximize...
    

    I should have opened a Deli, so many decades ago...

    :trwtf: is having boolean arguments at all. They are (nearly) always confusing.

    My favorite is the DereferenceLinks property of various FileDialogs. I can never remember what true/false actually means in that context and the Intellisense tooltip hint is absolutely no help.

    Isn't it pretty obvious for verbs? Maximize, dereference, ... What else should that mean?

    At least if you can see the parameter / property name. A long list of true/false is indeed pretty confusing, but so are other kinds of parameters, so that's an argument for named parameters.

    named parameters are a unary object/map/struct parameter under the hood. which supports the case that only one parameter should be allowed.


  • Banned

    @Zenith said in Why, oh why....:

    @topspin it's the phrasing. A shortcut references another location. Does dereferenceing it undo reference and point to the LNK file? Or does dereferencing collapse the middleman LNK file and go to the target? Then the help says something like "is dereferenced or not" instead of something unambiguous like "true means the LNK, false means the target." When I wrote my own file windows I was far more explicit.

    Usually, dereferencing means following the reference (e.g. the unary * in C, which is called dereference operator). I'd expect dereference=true to open shortcut target, and dereference=false to open the shortcut itself. And looking at the docs, that's exactly what happens.

    I guess the problem here is that "dereference" just isn't a common enough word to assume an average programmer will know what it means.



  • @Gąska said in Why, oh why....:

    unary * in C ... an average programmer

    :frystare:


  • And then the murders began.

    @Gąska said in Why, oh why....:

    I guess the problem here is that "dereference" just isn't a common enough word to assume an average programmer will know what it means.

    Twenty years ago it might have been common knowledge. But with Java and C# doing their best to hide pointers from developers through the magic of reference types, a developer could spend their entire career without ever using the unary * operator.



  • @HardwareGeek Considering there have been no C++ jobs here in the last 20 years and I've scarcely looked at the language in almost as long, it's a minor miracle that I knew what @Gąska was talking about.


  • Banned

    @HardwareGeek said in Why, oh why....:

    @Gąska said in Why, oh why....:

    unary * in C ... an average programmer

    :frystare:

    Step 1: Cut out the negation from the quote.
    Step 2: ???
    Step 3: Profit!


  • BINNED

    @Gąska said in Why, oh why....:

    @Zenith said in Why, oh why....:

    @topspin it's the phrasing. A shortcut references another location. Does dereferenceing it undo reference and point to the LNK file? Or does dereferencing collapse the middleman LNK file and go to the target? Then the help says something like "is dereferenced or not" instead of something unambiguous like "true means the LNK, false means the target." When I wrote my own file windows I was far more explicit.

    Usually, dereferencing means following the reference (e.g. the unary * in C, which is called dereference operator). I'd expect dereference=true to open shortcut target, and dereference=false to open the shortcut itself. And looking at the docs, that's exactly what happens.

    I guess the problem here is that "dereference" just isn't a common enough word to assume an average programmer will know what it means.

    So if we replaced the bool with enum { DEREFERENCE, DONT_DEREFERENCE } the problem goes away. Got it. 🚎


  • Banned

    @topspin dialog.dereference = (Dereference) true; 🚎



  • @Gąska said in Why, oh why....:

    I'd expect dereference=true to open shortcut target, and dereference=false to open the shortcut itself.

    And if the file does not exist, the function sets dereference=file_not_found?



  • @topspin said in Why, oh why....:

    @Zenith said in Why, oh why....:

    @PleegWat said in Why, oh why....:

    @TheCPUWizard said in Why, oh why....:

    On a Saturday (non-billable) trying to solve a few things before the engagement ends at EOM....

    Mazimize(true) means DONT maximize, 
    Maximize(false) is what will maximize...
    

    I should have opened a Deli, so many decades ago...

    :trwtf: is having boolean arguments at all. They are (nearly) always confusing.

    My favorite is the DereferenceLinks property of various FileDialogs. I can never remember what true/false actually means in that context and the Intellisense tooltip hint is absolutely no help.

    Isn't it pretty obvious for verbs? Maximize, dereference, ... What else should that mean?

    At least if you can see the parameter / property name. A long list of true/false is indeed pretty confusing, but so are other kinds of parameters, so that's an argument for named parameters.

    VS2019 now has an experimental setting where you get parameter names for functions even when you don't use named parameters.

    For example, the Contains method for a list has this signature bool List<T>.Contains(t item) which means that you normally don't see the item name when you use the function. With this setting on, it becomes this:

    4ce92c60-1f13-4658-bd6a-eff4c88034b3-image.png



  • @Rhywden So is the Maximize parameter name notMaximized?



  • @dcon I don't know? What's the function's signature?


  • Trolleybus Mechanic

    @Rhywden said in Why, oh why....:

    @topspin said in Why, oh why....:

    @Zenith said in Why, oh why....:

    @PleegWat said in Why, oh why....:

    @TheCPUWizard said in Why, oh why....:

    On a Saturday (non-billable) trying to solve a few things before the engagement ends at EOM....

    Mazimize(true) means DONT maximize, 
    Maximize(false) is what will maximize...
    

    I should have opened a Deli, so many decades ago...

    :trwtf: is having boolean arguments at all. They are (nearly) always confusing.

    My favorite is the DereferenceLinks property of various FileDialogs. I can never remember what true/false actually means in that context and the Intellisense tooltip hint is absolutely no help.

    Isn't it pretty obvious for verbs? Maximize, dereference, ... What else should that mean?

    At least if you can see the parameter / property name. A long list of true/false is indeed pretty confusing, but so are other kinds of parameters, so that's an argument for named parameters.

    VS2019 now has an experimental setting where you get parameter names for functions even when you don't use named parameters.

    For example, the Contains method for a list has this signature bool List<T>.Contains(t item) which means that you normally don't see the item name when you use the function. With this setting on, it becomes this:

    4ce92c60-1f13-4658-bd6a-eff4c88034b3-image.png

    IntelliJ has had that feature for a while now. It's pretty nice. It introduces some rare editor wonkiness sometimes, but overall a nice feature.


  • Banned

    @mikehurley said in Why, oh why....:

    @Rhywden said in Why, oh why....:

    @topspin said in Why, oh why....:

    @Zenith said in Why, oh why....:

    @PleegWat said in Why, oh why....:

    @TheCPUWizard said in Why, oh why....:

    On a Saturday (non-billable) trying to solve a few things before the engagement ends at EOM....

    Mazimize(true) means DONT maximize, 
    Maximize(false) is what will maximize...
    

    I should have opened a Deli, so many decades ago...

    :trwtf: is having boolean arguments at all. They are (nearly) always confusing.

    My favorite is the DereferenceLinks property of various FileDialogs. I can never remember what true/false actually means in that context and the Intellisense tooltip hint is absolutely no help.

    Isn't it pretty obvious for verbs? Maximize, dereference, ... What else should that mean?

    At least if you can see the parameter / property name. A long list of true/false is indeed pretty confusing, but so are other kinds of parameters, so that's an argument for named parameters.

    VS2019 now has an experimental setting where you get parameter names for functions even when you don't use named parameters.

    For example, the Contains method for a list has this signature bool List<T>.Contains(t item) which means that you normally don't see the item name when you use the function. With this setting on, it becomes this:

    4ce92c60-1f13-4658-bd6a-eff4c88034b3-image.png

    IntelliJ has had that feature for a while now.

    That "while" being at least 4 years. But it's always nice to see VS catch up with competition.



  • @Rhywden said in Why, oh why....:

    @dcon I don't know? What's the function's signature?

    Sorry, should have addressed that to @TheCPUWizard with reference to your note about showing the parameter name!


Log in to reply