Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. DOH!!!!

DOH!!!!

Scheduled Pinned Locked Moved The Lounge
questioncsharphelp
10 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #1

    So I posted a question in the C# forum trying to figure out why my app settings were not reloading. My class has properties for each setting:

    public bool IsSensorListVisible
    {
    get { return _IsSensorListVisible; }
    set
    {
    if (_IsSensorListVisible != value)
    {
    _IsSensorListVisible = value;

            **save();**
        }
    }
    

    }
    .
    .
    .

    Notice the call to Save?? So the CTOR calls Load, which sets each property, which then calls Save... DOH!!!

    If it's not broken, fix it until it is

    M L 2 Replies Last reply
    0
    • K Kevin Marois

      So I posted a question in the C# forum trying to figure out why my app settings were not reloading. My class has properties for each setting:

      public bool IsSensorListVisible
      {
      get { return _IsSensorListVisible; }
      set
      {
      if (_IsSensorListVisible != value)
      {
      _IsSensorListVisible = value;

              **save();**
          }
      }
      

      }
      .
      .
      .

      Notice the call to Save?? So the CTOR calls Load, which sets each property, which then calls Save... DOH!!!

      If it's not broken, fix it until it is

      M Offline
      M Offline
      Marc Clifton
      wrote on last edited by
      #2

      This is the very first thing a junior programmer is smacked over the head with -- do not have hidden functionality ESPECIALLY IN PROPERTY SETTERS *Smack* Marc

      Imperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!

      T 1 Reply Last reply
      0
      • K Kevin Marois

        So I posted a question in the C# forum trying to figure out why my app settings were not reloading. My class has properties for each setting:

        public bool IsSensorListVisible
        {
        get { return _IsSensorListVisible; }
        set
        {
        if (_IsSensorListVisible != value)
        {
        _IsSensorListVisible = value;

                **save();**
            }
        }
        

        }
        .
        .
        .

        Notice the call to Save?? So the CTOR calls Load, which sets each property, which then calls Save... DOH!!!

        If it's not broken, fix it until it is

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Whehe, nice one; I was wondering why the code you posted would not work, seemed like a simple enough example :D

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

        1 Reply Last reply
        0
        • M Marc Clifton

          This is the very first thing a junior programmer is smacked over the head with -- do not have hidden functionality ESPECIALLY IN PROPERTY SETTERS *Smack* Marc

          Imperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!

          T Offline
          T Offline
          TheGreatAndPowerfulOz
          wrote on last edited by
          #4

          I'm still dealing with code like that which was written by a very senior programmer who is no longer here. GRRRRRRRRRRRRRRR X| :mad: X| :mad: X|                                                                                          X| X| X| X| X|                         X| X| X| X| X| X|                             X| X| X| X| X| X| X| X| X|               X| X|                             X| X|               X| X| X| X| X| X| X| X| X| X| X| X|           X|                                                X|      X| X| X| X| X| X| X| X| X| X| X| X| X| X|      X|                                                     X| X| X| X| X| X| X| X| X| X| X| X| X| X| X| X| X|      X|               X|      X|             &

          R 1 Reply Last reply
          0
          • T TheGreatAndPowerfulOz

            I'm still dealing with code like that which was written by a very senior programmer who is no longer here. GRRRRRRRRRRRRRRR X| :mad: X| :mad: X|                                                                                          X| X| X| X| X|                         X| X| X| X| X| X|                             X| X| X| X| X| X| X| X| X|               X| X|                             X| X|               X| X| X| X| X| X| X| X| X| X| X| X|           X|                                                X|      X| X| X| X| X| X| X| X| X| X| X| X| X| X|      X|                                                     X| X| X| X| X| X| X| X| X| X| X| X| X| X| X| X| X|      X|               X|      X|             &

            R Offline
            R Offline
            RossMW
            wrote on last edited by
            #5

            Impressive.. :) :) Must have taken a little while to do..

            T 1 Reply Last reply
            0
            • R RossMW

              Impressive.. :) :) Must have taken a little while to do..

              T Offline
              T Offline
              TheGreatAndPowerfulOz
              wrote on last edited by
              #6

              Yeah, it must've. I copied it from someone else. :-O

              #SupportHeForShe

              If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun Only 2 things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein

              R 1 Reply Last reply
              0
              • T TheGreatAndPowerfulOz

                Yeah, it must've. I copied it from someone else. :-O

                #SupportHeForShe

                If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun Only 2 things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein

                R Offline
                R Offline
                RossMW
                wrote on last edited by
                #7

                :laugh: :laugh: :laugh: Cheat

                T 1 Reply Last reply
                0
                • R RossMW

                  :laugh: :laugh: :laugh: Cheat

                  T Offline
                  T Offline
                  TheGreatAndPowerfulOz
                  wrote on last edited by
                  #8

                  I call it object-reuse! ;P

                  #SupportHeForShe

                  If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun Only 2 things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein

                  F 1 Reply Last reply
                  0
                  • T TheGreatAndPowerfulOz

                    I call it object-reuse! ;P

                    #SupportHeForShe

                    If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun Only 2 things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein

                    F Offline
                    F Offline
                    Freak30
                    wrote on last edited by
                    #9

                    That's just copy & paste, i.e. code duplication. Object reuse would have been to link to the post containing this "picture". ;P

                    The good thing about pessimism is, that you are always either right or pleasently surprised.

                    T 1 Reply Last reply
                    0
                    • F Freak30

                      That's just copy & paste, i.e. code duplication. Object reuse would have been to link to the post containing this "picture". ;P

                      The good thing about pessimism is, that you are always either right or pleasently surprised.

                      T Offline
                      T Offline
                      TheGreatAndPowerfulOz
                      wrote on last edited by
                      #10

                      It's a subclass, actually. Mine is slightly different. ;P

                      #SupportHeForShe

                      If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun Only 2 things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups