The Daily WTF: Curious Perversions in Information Technology
Welcome to TDWTF Forums Sign in | Join | Help
in Search

Write-only property

Last post 02-18-2013 4:29 PM by Cassidy. 14 replies.
Page 1 of 1 (15 items)
Sort Posts: Previous Next
  • 02-10-2013 10:20 AM

    Write-only property

            public bool InvokePropertyChangedEvent
            {
                set
                {
                    OnPropertyChanged(new PropertyChangedEventArgs("InvokePropertyChangedEvent"));
                }
            }
    
    This is called like so: x.InvokePropertyChangedEvent = true;.

    Basically, they couldn't figure out how to simulate a PropertyChangedEvent without changing a property, and this is what happened.

  • 02-10-2013 9:12 PM In reply to

    Re: Write-only property

    configurator:
            public bool InvokePropertyChangedEvent
            {
                set
                {
                    OnPropertyChanged(new PropertyChangedEventArgs("InvokePropertyChangedEvent"));
                }
            }
    
    This is called like so: x.InvokePropertyChangedEvent = true;.

    Basically, they couldn't figure out how to simulate a PropertyChangedEvent without changing a property, and this is what happened.

    Now if the property type was PropertyChangedEventArgs or even the constructor argument for same...it would be interesting...

  • 02-11-2013 7:31 AM In reply to

    Re: Write-only property

    configurator:

            public bool InvokePropertyChangedEvent
            {
                set
                {
                    OnPropertyChanged(new PropertyChangedEventArgs("InvokePropertyChangedEvent"));
                }
            }
    
    This is called like so: x.InvokePropertyChangedEvent = true;.

    Basically, they couldn't figure out how to simulate a PropertyChangedEvent without changing a property, and this is what happened.

     

    Is OnPropertyChanged visible outside the class? I know a lot of these methods are often declared protected override or protected virtual.

     

    [blakeyrat] NOBODY expects the Slashdot inquisition!
  • 02-11-2013 9:03 AM In reply to

    Re: Write-only property

    This reminds me of write only registers on custom hardware.
  • 02-11-2013 10:07 AM In reply to

    Re: Write-only property

    RaceProUK:
    Is OnPropertyChanged visible outside the class?
    Does that matter? InvokePropertyChangedEvent should be a method, not a setter.
  • 02-11-2013 11:01 AM In reply to

    Re: Write-only property

    configurator:
    RaceProUK:
    Is OnPropertyChanged visible outside the class?
    Does that matter? InvokePropertyChangedEvent should be a method, not a setter.
     

    Yes, it does matter.

    [blakeyrat] NOBODY expects the Slashdot inquisition!
  • 02-11-2013 2:39 PM In reply to

    Re: Write-only property

    RaceProUK:
    configurator:
    RaceProUK:
    Is OnPropertyChanged visible outside the class?
    Does that matter? InvokePropertyChangedEvent should be a method, not a setter.
    Yes, it does matter.
    If they're using the same MSDN sample code for handing PropertyChangedEvents that's been around since 2002, then no, it's protected. But either way, a) why is InvokePropertyChangedEvent a property when a method fits better with both the action and the name? b) Why don't they raise the visibility of OnPropertyChanged to public? It's in the source code... c) Why are they sending PropertyChangedEvents that say that no property they actually store a value for is changed?
  • 02-12-2013 7:49 AM In reply to

    Re: Write-only property

    TwelveBaud:
    RaceProUK:
    configurator:
    RaceProUK:
    Is OnPropertyChanged visible outside the class?
    Does that matter? InvokePropertyChangedEvent should be a method, not a setter.
    Yes, it does matter.
    If they're using the same MSDN sample code for handing PropertyChangedEvents that's been around since 2002, then no, it's protected. But either way, a) why is InvokePropertyChangedEvent a property when a method fits better with both the action and the name? b) Why don't they raise the visibility of OnPropertyChanged to public? It's in the source code... c) Why are they sending PropertyChangedEvents that say that no property they actually store a value for is changed?
     

    a) The handler being tested is OnPropertyChanged, so why not?
    b) Because they'd have to remember to change it back again
    c) Because they're testing the handler without wanting to change object state

    [blakeyrat] NOBODY expects the Slashdot inquisition!
  • 02-12-2013 10:28 AM In reply to

    Re: Write-only property

    RaceProUK:
    a) The handler being tested is OnPropertyChanged, so why not?
    b) Because they'd have to remember to change it back again
    c) Because they're testing the handler without wanting to change object state
    Why are you so quick to assume that they're testing?
  • 02-12-2013 10:58 AM In reply to

    Re: Write-only property

    TwelveBaud:
    RaceProUK:
    a) The handler being tested is OnPropertyChanged, so why not?
    b) Because they'd have to remember to change it back again
    c) Because they're testing the handler without wanting to change object state
    Why are you so quick to assume that they're testing?
    Who says they aren't?

    [blakeyrat] NOBODY expects the Slashdot inquisition!
  • 02-12-2013 11:26 AM In reply to

    Re: Write-only property

    RaceProUK:
    Who says they aren't?
    They aren't :-(
  • 02-13-2013 7:08 AM In reply to

    Re: Write-only property

    configurator:
    RaceProUK:
    Who says they aren't?
    They aren't :-(
     

    In that case they are fools of the greatest impertinence, and must be vanquished forthwith.

    [blakeyrat] NOBODY expects the Slashdot inquisition!
  • 02-13-2013 11:52 AM In reply to

    Re: Write-only property

    RaceProUK:
    In that case they are fools of the greatest impertinence, and must be vanquished forthwith.
     

    Their approach to testing suggests that Darwinism will soon sort that.

     

  • 02-18-2013 6:38 AM In reply to

    • Hmmmm
    • Not Ranked
    • Joined on 06-13-2012
    • Posts 32

    Re: Write-only property

    Cassidy:
    Filed under: Lick these battery terminals
    Get them to try it with a car battery, though if their tongue can bridge the terminals on one of those, then they can probably make a lot more money in a different career...
  • 02-18-2013 4:29 PM In reply to

    Re: Write-only property

    Only if they can breathe through their ears...

Page 1 of 1 (15 items)
Powered by Community Server (Non-Commercial Edition), by Telligent Systems