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 Weird and The Wonderful
  4. #region

#region

Scheduled Pinned Locked Moved The Weird and The Wonderful
rubyquestionlearning
12 Posts 9 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.
  • B Bernhard Hiller

    Sometimes I have the impression to work for Augeas[^] Stables Inc, but actually I am expected to produce more dung than to get rid of it... In the 13395 lines of code of the main window of one of our applications, I found this little gem (really little - only 320 loc) whose functionality I'll need in a new application (a little anonymized):

        /// <summary>
        /// some description
        /// </summary>
        private void DoSomething()
        {
            ...
            #region do X
            ...
            #endregion
    
            #region do Y
            ...
            #endregion
    
            #region do Z
            ...
            #endregion
    
            #region do A
            ...
            #endregion
    
            #region do B
            if (some condition)
            {
                #region do C
                ...
                #endregion
            }
            else
            {
                #region do D
                ...
                #endregion
            }
            #endregion
            ...
            #region do E
            try
            {
                switch (some swicth)
                {
                    #region do F
                    case ...
                        break;
                    #endregion
                    #region do G
                    case ...
                        break;
                    #endregion
                    #region do H
                    case ...
                        break;
                    #endregion
                    #region do I
                    case ...
                        break;
                    #endregion
                }
                ...
            #endregion
        }
    

    Of course with some extra try...catch inside the regions or other try...catch. Well, at least, it looks like the functionality I need to transfer to the new application is - with the exception of some member variables - in that one single function, and not scattered all over the class... ;) "Have you heard of 'Clean Code' by Robert C. Martin? You can download it from the web", said the guy who uses to write such functions.

    OriginalGriffO Offline
    OriginalGriffO Offline
    OriginalGriff
    wrote on last edited by
    #3

    It's a form of modular code: each module goes in it's own region so you don't get the visual clutter associated with methods... :doh: X| Find a new job! Life is too short...

    Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

    B 1 Reply Last reply
    0
    • B Bernhard Hiller

      Sometimes I have the impression to work for Augeas[^] Stables Inc, but actually I am expected to produce more dung than to get rid of it... In the 13395 lines of code of the main window of one of our applications, I found this little gem (really little - only 320 loc) whose functionality I'll need in a new application (a little anonymized):

          /// <summary>
          /// some description
          /// </summary>
          private void DoSomething()
          {
              ...
              #region do X
              ...
              #endregion
      
              #region do Y
              ...
              #endregion
      
              #region do Z
              ...
              #endregion
      
              #region do A
              ...
              #endregion
      
              #region do B
              if (some condition)
              {
                  #region do C
                  ...
                  #endregion
              }
              else
              {
                  #region do D
                  ...
                  #endregion
              }
              #endregion
              ...
              #region do E
              try
              {
                  switch (some swicth)
                  {
                      #region do F
                      case ...
                          break;
                      #endregion
                      #region do G
                      case ...
                          break;
                      #endregion
                      #region do H
                      case ...
                          break;
                      #endregion
                      #region do I
                      case ...
                          break;
                      #endregion
                  }
                  ...
              #endregion
          }
      

      Of course with some extra try...catch inside the regions or other try...catch. Well, at least, it looks like the functionality I need to transfer to the new application is - with the exception of some member variables - in that one single function, and not scattered all over the class... ;) "Have you heard of 'Clean Code' by Robert C. Martin? You can download it from the web", said the guy who uses to write such functions.

      B Offline
      B Offline
      Brisingr Aerowing
      wrote on last edited by
      #4

      I'm guessing it's a regional issue.

      What do you get when you cross a joke with a rhetorical question?

      L 1 Reply Last reply
      0
      • B Bernhard Hiller

        Sometimes I have the impression to work for Augeas[^] Stables Inc, but actually I am expected to produce more dung than to get rid of it... In the 13395 lines of code of the main window of one of our applications, I found this little gem (really little - only 320 loc) whose functionality I'll need in a new application (a little anonymized):

            /// <summary>
            /// some description
            /// </summary>
            private void DoSomething()
            {
                ...
                #region do X
                ...
                #endregion
        
                #region do Y
                ...
                #endregion
        
                #region do Z
                ...
                #endregion
        
                #region do A
                ...
                #endregion
        
                #region do B
                if (some condition)
                {
                    #region do C
                    ...
                    #endregion
                }
                else
                {
                    #region do D
                    ...
                    #endregion
                }
                #endregion
                ...
                #region do E
                try
                {
                    switch (some swicth)
                    {
                        #region do F
                        case ...
                            break;
                        #endregion
                        #region do G
                        case ...
                            break;
                        #endregion
                        #region do H
                        case ...
                            break;
                        #endregion
                        #region do I
                        case ...
                            break;
                        #endregion
                    }
                    ...
                #endregion
            }
        

        Of course with some extra try...catch inside the regions or other try...catch. Well, at least, it looks like the functionality I need to transfer to the new application is - with the exception of some member variables - in that one single function, and not scattered all over the class... ;) "Have you heard of 'Clean Code' by Robert C. Martin? You can download it from the web", said the guy who uses to write such functions.

        B Offline
        B Offline
        BobJanova
        wrote on last edited by
        #5

        To write that and then quote Clean Code is a special level of genius!

        1 Reply Last reply
        0
        • B Bernhard Hiller

          Sometimes I have the impression to work for Augeas[^] Stables Inc, but actually I am expected to produce more dung than to get rid of it... In the 13395 lines of code of the main window of one of our applications, I found this little gem (really little - only 320 loc) whose functionality I'll need in a new application (a little anonymized):

              /// <summary>
              /// some description
              /// </summary>
              private void DoSomething()
              {
                  ...
                  #region do X
                  ...
                  #endregion
          
                  #region do Y
                  ...
                  #endregion
          
                  #region do Z
                  ...
                  #endregion
          
                  #region do A
                  ...
                  #endregion
          
                  #region do B
                  if (some condition)
                  {
                      #region do C
                      ...
                      #endregion
                  }
                  else
                  {
                      #region do D
                      ...
                      #endregion
                  }
                  #endregion
                  ...
                  #region do E
                  try
                  {
                      switch (some swicth)
                      {
                          #region do F
                          case ...
                              break;
                          #endregion
                          #region do G
                          case ...
                              break;
                          #endregion
                          #region do H
                          case ...
                              break;
                          #endregion
                          #region do I
                          case ...
                              break;
                          #endregion
                      }
                      ...
                  #endregion
              }
          

          Of course with some extra try...catch inside the regions or other try...catch. Well, at least, it looks like the functionality I need to transfer to the new application is - with the exception of some member variables - in that one single function, and not scattered all over the class... ;) "Have you heard of 'Clean Code' by Robert C. Martin? You can download it from the web", said the guy who uses to write such functions.

          Richard Andrew x64R Offline
          Richard Andrew x64R Offline
          Richard Andrew x64
          wrote on last edited by
          #6

          If a little of something is good, then a whole lot of it must be better, right?

          The difficult we do right away... ...the impossible takes slightly longer.

          1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            It's a form of modular code: each module goes in it's own region so you don't get the visual clutter associated with methods... :doh: X| Find a new job! Life is too short...

            Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

            B Offline
            B Offline
            Bernhard Hiller
            wrote on last edited by
            #7

            Why? In order to get experience with even more styles of WTF used in those different places?

            OriginalGriffO 1 Reply Last reply
            0
            • B Bernhard Hiller

              Why? In order to get experience with even more styles of WTF used in those different places?

              OriginalGriffO Offline
              OriginalGriffO Offline
              OriginalGriff
              wrote on last edited by
              #8

              So you're saying "better the crap you know"? :laugh:

              Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

              "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
              "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

              1 Reply Last reply
              0
              • B Brisingr Aerowing

                I'm guessing it's a regional issue.

                What do you get when you cross a joke with a rhetorical question?

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

                I guess stupidity is not regional, it's universal :D

                1 Reply Last reply
                0
                • B Bernhard Hiller

                  Sometimes I have the impression to work for Augeas[^] Stables Inc, but actually I am expected to produce more dung than to get rid of it... In the 13395 lines of code of the main window of one of our applications, I found this little gem (really little - only 320 loc) whose functionality I'll need in a new application (a little anonymized):

                      /// <summary>
                      /// some description
                      /// </summary>
                      private void DoSomething()
                      {
                          ...
                          #region do X
                          ...
                          #endregion
                  
                          #region do Y
                          ...
                          #endregion
                  
                          #region do Z
                          ...
                          #endregion
                  
                          #region do A
                          ...
                          #endregion
                  
                          #region do B
                          if (some condition)
                          {
                              #region do C
                              ...
                              #endregion
                          }
                          else
                          {
                              #region do D
                              ...
                              #endregion
                          }
                          #endregion
                          ...
                          #region do E
                          try
                          {
                              switch (some swicth)
                              {
                                  #region do F
                                  case ...
                                      break;
                                  #endregion
                                  #region do G
                                  case ...
                                      break;
                                  #endregion
                                  #region do H
                                  case ...
                                      break;
                                  #endregion
                                  #region do I
                                  case ...
                                      break;
                                  #endregion
                              }
                              ...
                          #endregion
                      }
                  

                  Of course with some extra try...catch inside the regions or other try...catch. Well, at least, it looks like the functionality I need to transfer to the new application is - with the exception of some member variables - in that one single function, and not scattered all over the class... ;) "Have you heard of 'Clean Code' by Robert C. Martin? You can download it from the web", said the guy who uses to write such functions.

                  Sander RosselS Offline
                  Sander RosselS Offline
                  Sander Rossel
                  wrote on last edited by
                  #10

                  #endcontract

                  1 Reply Last reply
                  0
                  • B Bernhard Hiller

                    Sometimes I have the impression to work for Augeas[^] Stables Inc, but actually I am expected to produce more dung than to get rid of it... In the 13395 lines of code of the main window of one of our applications, I found this little gem (really little - only 320 loc) whose functionality I'll need in a new application (a little anonymized):

                        /// <summary>
                        /// some description
                        /// </summary>
                        private void DoSomething()
                        {
                            ...
                            #region do X
                            ...
                            #endregion
                    
                            #region do Y
                            ...
                            #endregion
                    
                            #region do Z
                            ...
                            #endregion
                    
                            #region do A
                            ...
                            #endregion
                    
                            #region do B
                            if (some condition)
                            {
                                #region do C
                                ...
                                #endregion
                            }
                            else
                            {
                                #region do D
                                ...
                                #endregion
                            }
                            #endregion
                            ...
                            #region do E
                            try
                            {
                                switch (some swicth)
                                {
                                    #region do F
                                    case ...
                                        break;
                                    #endregion
                                    #region do G
                                    case ...
                                        break;
                                    #endregion
                                    #region do H
                                    case ...
                                        break;
                                    #endregion
                                    #region do I
                                    case ...
                                        break;
                                    #endregion
                                }
                                ...
                            #endregion
                        }
                    

                    Of course with some extra try...catch inside the regions or other try...catch. Well, at least, it looks like the functionality I need to transfer to the new application is - with the exception of some member variables - in that one single function, and not scattered all over the class... ;) "Have you heard of 'Clean Code' by Robert C. Martin? You can download it from the web", said the guy who uses to write such functions.

                    G Offline
                    G Offline
                    Giuseppe Tollini
                    wrote on last edited by
                    #11

                    Bernhard Hiller wrote:

                    In the 13395 lines of code of the main window

                    Bernhard Hiller wrote:

                    In the 13395 lines of code

                    Bernhard Hiller wrote:

                    13395

                    What? :wtf:

                    B 1 Reply Last reply
                    0
                    • G Giuseppe Tollini

                      Bernhard Hiller wrote:

                      In the 13395 lines of code of the main window

                      Bernhard Hiller wrote:

                      In the 13395 lines of code

                      Bernhard Hiller wrote:

                      13395

                      What? :wtf:

                      B Offline
                      B Offline
                      Bernhard Hiller
                      wrote on last edited by
                      #12

                      That's clean code, isn't it?

                      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