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. Other Discussions
  3. The Soapbox
  4. Do you prefix everything with "this"? Did you ever..

Do you prefix everything with "this"? Did you ever..

Scheduled Pinned Locked Moved The Soapbox
csharpcomtoolsquestion
20 Posts 10 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.
  • L Lost User

    Did you ever consider creating a class-member called "that" and assign "this" in the constructor to "that", and then to refer into code to "that" instead of "this"? Why not?

    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

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

    I've used "that" for a parameter name, especially in comparison methods. I NEVER, EVER USE "this.". I absolutely HATE code that is littered with "this.someMember" type syntax. I absolutely HATE code that is littered with "pszHungarianAsswipeTypeFuckedupShit" prefix naming crap. I absolutely HATE code that is littered with "m_" name prefix crap. I absolutely HATE classes that start with C for "class". I absolutely HATE K&R formatting of code. I absolutely HATE when C# property get/set code takes up SEVEN FUCKING LINES when all it's doing is returning/setting a member variable! ONE FUCKING LINE WILL DO ASSWIPES!

    #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

    M D L 3 Replies Last reply
    0
    • T TheGreatAndPowerfulOz

      I've used "that" for a parameter name, especially in comparison methods. I NEVER, EVER USE "this.". I absolutely HATE code that is littered with "this.someMember" type syntax. I absolutely HATE code that is littered with "pszHungarianAsswipeTypeFuckedupShit" prefix naming crap. I absolutely HATE code that is littered with "m_" name prefix crap. I absolutely HATE classes that start with C for "class". I absolutely HATE K&R formatting of code. I absolutely HATE when C# property get/set code takes up SEVEN FUCKING LINES when all it's doing is returning/setting a member variable! ONE FUCKING LINE WILL DO ASSWIPES!

      #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

      M Offline
      M Offline
      MarkTJohnson
      wrote on last edited by
      #7

      Decaf for you from now on

      T 1 Reply Last reply
      0
      • M MarkTJohnson

        Decaf for you from now on

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

        :^) :~:java::rose:

        #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
        • T TheGreatAndPowerfulOz

          I've used "that" for a parameter name, especially in comparison methods. I NEVER, EVER USE "this.". I absolutely HATE code that is littered with "this.someMember" type syntax. I absolutely HATE code that is littered with "pszHungarianAsswipeTypeFuckedupShit" prefix naming crap. I absolutely HATE code that is littered with "m_" name prefix crap. I absolutely HATE classes that start with C for "class". I absolutely HATE K&R formatting of code. I absolutely HATE when C# property get/set code takes up SEVEN FUCKING LINES when all it's doing is returning/setting a member variable! ONE FUCKING LINE WILL DO ASSWIPES!

          #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

          D Offline
          D Offline
          den2k88
          wrote on last edited by
          #9

          Mu code falls in 4 of your 6 categories. :~

          Geek code v 3.12 GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- r++>+++ y+++* Weapons extension: ma- k++ F+2 X // No comment

          T 1 Reply Last reply
          0
          • D den2k88

            Mu code falls in 4 of your 6 categories. :~

            Geek code v 3.12 GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- r++>+++ y+++* Weapons extension: ma- k++ F+2 X // No comment

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

            den2k88 wrote:

            Mu code

            Well, there's your problem. You're using some sort of degenerate mutated cow to do your coding. Repent! I say! Repent! Fix your ways!

            #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

            D 1 Reply Last reply
            0
            • T TheGreatAndPowerfulOz

              den2k88 wrote:

              Mu code

              Well, there's your problem. You're using some sort of degenerate mutated cow to do your coding. Repent! I say! Repent! Fix your ways!

              #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

              D Offline
              D Offline
              den2k88
              wrote on last edited by
              #11

              :baaaa!: :baaaa!: :baaaa!: You're right, now I sheep better software! Getting my coat and running

              Geek code v 3.12 GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- r++>+++ y+++* Weapons extension: ma- k++ F+2 X // No comment

              T 1 Reply Last reply
              0
              • D den2k88

                :baaaa!: :baaaa!: :baaaa!: You're right, now I sheep better software! Getting my coat and running

                Geek code v 3.12 GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- r++>+++ y+++* Weapons extension: ma- k++ F+2 X // No comment

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

                You better run... I've set the wolves on ya!

                #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
                • T TheGreatAndPowerfulOz

                  I've used "that" for a parameter name, especially in comparison methods. I NEVER, EVER USE "this.". I absolutely HATE code that is littered with "this.someMember" type syntax. I absolutely HATE code that is littered with "pszHungarianAsswipeTypeFuckedupShit" prefix naming crap. I absolutely HATE code that is littered with "m_" name prefix crap. I absolutely HATE classes that start with C for "class". I absolutely HATE K&R formatting of code. I absolutely HATE when C# property get/set code takes up SEVEN FUCKING LINES when all it's doing is returning/setting a member variable! ONE FUCKING LINE WILL DO ASSWIPES!

                  #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

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

                  I absolutely LOVE it when I find myself agreeing wholeheartedly with someone about coding style :) Don't read on without your medication :)

                  private bool m_boolIsInAgreement = true;
                  public bool IsInAgreement {
                  get {
                  return this.m_boolIsInAgreement;
                  }
                  set {
                  if (this.m_boolIsInAgreement != value){
                  this.m_boolIsInAgreement = value;
                  }
                  }
                  }

                  PooperPig - Coming Soon

                  A T L 3 Replies Last reply
                  0
                  • L Lost User

                    I absolutely LOVE it when I find myself agreeing wholeheartedly with someone about coding style :) Don't read on without your medication :)

                    private bool m_boolIsInAgreement = true;
                    public bool IsInAgreement {
                    get {
                    return this.m_boolIsInAgreement;
                    }
                    set {
                    if (this.m_boolIsInAgreement != value){
                    this.m_boolIsInAgreement = value;
                    }
                    }
                    }

                    PooperPig - Coming Soon

                    A Offline
                    A Offline
                    Agent__007
                    wrote on last edited by
                    #14

                    :laugh: And may I add:

                    internal class CCleanCode{
                    // ...
                    }

                    :-D

                    Your time will come, if you let it be right.

                    1 Reply Last reply
                    0
                    • L Lost User

                      I absolutely LOVE it when I find myself agreeing wholeheartedly with someone about coding style :) Don't read on without your medication :)

                      private bool m_boolIsInAgreement = true;
                      public bool IsInAgreement {
                      get {
                      return this.m_boolIsInAgreement;
                      }
                      set {
                      if (this.m_boolIsInAgreement != value){
                      this.m_boolIsInAgreement = value;
                      }
                      }
                      }

                      PooperPig - Coming Soon

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

                      _Maxxx_ wrote:

                      coding style

                      Proper coding style improves comprehension and reduces bugs. Plus it's just damn fun!

                      _Maxxx_ wrote:

                      if (this.m_boolIsInAgreement != value){ this.m_boolIsInAgreement = value; }

                      What the FUCK is that shiite! Whoever wrote this should be raked over hot coals, be tossed into a pool of salt water and be forced to take a rubbing alchohol bath.

                      #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
                      • L Lost User

                        I absolutely LOVE it when I find myself agreeing wholeheartedly with someone about coding style :) Don't read on without your medication :)

                        private bool m_boolIsInAgreement = true;
                        public bool IsInAgreement {
                        get {
                        return this.m_boolIsInAgreement;
                        }
                        set {
                        if (this.m_boolIsInAgreement != value){
                        this.m_boolIsInAgreement = value;
                        }
                        }
                        }

                        PooperPig - Coming Soon

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

                        _Maxxx_ wrote:

                        set { if (this.m_boolIsInAgreement != value){ this.m_boolIsInAgreement = value; } }

                        I would like to improve on that, it doesn't quite meet the required standards. Better:

                        set {
                        if (value == true) {
                        this.m_boolIsInAgreement = true;
                        } else if (value == false) {
                        this.m_boolIsInAgreement = false;
                        }
                        }

                        Recursion: see Recursion.

                        Richard DeemingR 1 Reply Last reply
                        0
                        • L Lost User

                          _Maxxx_ wrote:

                          set { if (this.m_boolIsInAgreement != value){ this.m_boolIsInAgreement = value; } }

                          I would like to improve on that, it doesn't quite meet the required standards. Better:

                          set {
                          if (value == true) {
                          this.m_boolIsInAgreement = true;
                          } else if (value == false) {
                          this.m_boolIsInAgreement = false;
                          }
                          }

                          Recursion: see Recursion.

                          Richard DeemingR Offline
                          Richard DeemingR Offline
                          Richard Deeming
                          wrote on last edited by
                          #17

                          No, no, no. You're assigning to the field unnecessarily, which wastes CPU cycles. You also need spaces within the parentheses, and Yoda conditionals. The proper way to do it would be:

                          if ( true == value && value != this.m_boolIsInAgreement ) {
                          this.m_boolIsInAgreement = value;
                          } else if ( false == value && value != this.m_boolIsInAgreement ) {
                          this.m_boolIsInAgreement = value;
                          }

                          There, that's much better! :-\


                          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                          L 2 Replies Last reply
                          0
                          • Richard DeemingR Richard Deeming

                            No, no, no. You're assigning to the field unnecessarily, which wastes CPU cycles. You also need spaces within the parentheses, and Yoda conditionals. The proper way to do it would be:

                            if ( true == value && value != this.m_boolIsInAgreement ) {
                            this.m_boolIsInAgreement = value;
                            } else if ( false == value && value != this.m_boolIsInAgreement ) {
                            this.m_boolIsInAgreement = value;
                            }

                            There, that's much better! :-\


                            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

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

                            "Yoda conditionals" made my evening! :laugh: :thumbsup: From now on there'll be at least one funny thought when spotting Yoda code :)

                            Recursion: see Recursion.

                            1 Reply Last reply
                            0
                            • Richard DeemingR Richard Deeming

                              No, no, no. You're assigning to the field unnecessarily, which wastes CPU cycles. You also need spaces within the parentheses, and Yoda conditionals. The proper way to do it would be:

                              if ( true == value && value != this.m_boolIsInAgreement ) {
                              this.m_boolIsInAgreement = value;
                              } else if ( false == value && value != this.m_boolIsInAgreement ) {
                              this.m_boolIsInAgreement = value;
                              }

                              There, that's much better! :-\


                              "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

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

                              Not thread-safe, no error-handling code, no comments.. I assume you left that out so the example is more clear?

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

                              Richard DeemingR 1 Reply Last reply
                              0
                              • L Lost User

                                Not thread-safe, no error-handling code, no comments.. I assume you left that out so the example is more clear?

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

                                Richard DeemingR Offline
                                Richard DeemingR Offline
                                Richard Deeming
                                wrote on last edited by
                                #20

                                Of course - that's left as an exercise for the reader. :laugh:


                                "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                                "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                                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