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. Why some of them (developers) dont confuse using Global variables heavily or they aren't aware of reality.

Why some of them (developers) dont confuse using Global variables heavily or they aren't aware of reality.

Scheduled Pinned Locked Moved The Weird and The Wonderful
architecture
13 Posts 5 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.
  • M Offline
    M Offline
    Mohammed Hameed
    wrote on last edited by
    #1

    It has been noticed that some of the developers knowingly/unknowingly use many global variables. But in my view, naturally they should feel confused at sometime, still some of them dont reveal the fact may be.

    Understand SOLID! Believe SOLID! Try SOLID; your Code becomes Rock SOLID!!!

    OriginalGriffO I S 3 Replies Last reply
    0
    • M Mohammed Hameed

      It has been noticed that some of the developers knowingly/unknowingly use many global variables. But in my view, naturally they should feel confused at sometime, still some of them dont reveal the fact may be.

      Understand SOLID! Believe SOLID! Try SOLID; your Code becomes Rock SOLID!!!

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

      Well I'm confused by your two sentences. Does that help?

      The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

      "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

      M 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        Well I'm confused by your two sentences. Does that help?

        The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

        M Offline
        M Offline
        Mohammed Hameed
        wrote on last edited by
        #3

        I mean: dont they get confused if they over use Global variables?

        Understand SOLID! Believe SOLID! Try SOLID; your Code becomes Rock SOLID!!!

        J 1 Reply Last reply
        0
        • M Mohammed Hameed

          I mean: dont they get confused if they over use Global variables?

          Understand SOLID! Believe SOLID! Try SOLID; your Code becomes Rock SOLID!!!

          J Offline
          J Offline
          jim lahey
          wrote on last edited by
          #4

          I don't know. do you?

          M 1 Reply Last reply
          0
          • J jim lahey

            I don't know. do you?

            M Offline
            M Offline
            Mohammed Hameed
            wrote on last edited by
            #5

            I too dont know. It would be great if I get some discussion on this to get more clear picture.

            Understand SOLID! Believe SOLID! Try SOLID; your Code becomes Rock SOLID!!!

            OriginalGriffO 1 Reply Last reply
            0
            • M Mohammed Hameed

              I too dont know. It would be great if I get some discussion on this to get more clear picture.

              Understand SOLID! Believe SOLID! Try SOLID; your Code becomes Rock SOLID!!!

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

              This isn't the place for such discussions - look at the top of the page. "This forum is purely for amusement and discussions on code snippets." For a more serious discussion (ish) try the lounge. But I'd suggest that you phrase it a little differently: "Do you get confused if there are too many global variables?" is a lot clearer.

              The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

              "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

              M 1 Reply Last reply
              0
              • OriginalGriffO OriginalGriff

                This isn't the place for such discussions - look at the top of the page. "This forum is purely for amusement and discussions on code snippets." For a more serious discussion (ish) try the lounge. But I'd suggest that you phrase it a little differently: "Do you get confused if there are too many global variables?" is a lot clearer.

                The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

                M Offline
                M Offline
                Mohammed Hameed
                wrote on last edited by
                #7

                Ok, thanks.

                Understand SOLID! Believe SOLID! Try SOLID; your Code becomes Rock SOLID!!!

                1 Reply Last reply
                0
                • M Mohammed Hameed

                  It has been noticed that some of the developers knowingly/unknowingly use many global variables. But in my view, naturally they should feel confused at sometime, still some of them dont reveal the fact may be.

                  Understand SOLID! Believe SOLID! Try SOLID; your Code becomes Rock SOLID!!!

                  I Offline
                  I Offline
                  Ingo
                  wrote on last edited by
                  #8

                  Mohammed Hameed wrote:

                  But in my view, naturally they should feel confused at sometime, still some of them dont reveal the fact may be.

                  I don't understand that sentences.

                  Mohammed Hameed wrote:

                  It has been noticed that some of the developers knowingly/unknowingly use many global variables.

                  Well, in 99,9% of all my actual project have no global variable. I write OOP so there is no need, except when I like to have one to offend my collegues. :rolleyes:

                  Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.

                  M 1 Reply Last reply
                  0
                  • I Ingo

                    Mohammed Hameed wrote:

                    But in my view, naturally they should feel confused at sometime, still some of them dont reveal the fact may be.

                    I don't understand that sentences.

                    Mohammed Hameed wrote:

                    It has been noticed that some of the developers knowingly/unknowingly use many global variables.

                    Well, in 99,9% of all my actual project have no global variable. I write OOP so there is no need, except when I like to have one to offend my collegues. :rolleyes:

                    Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.

                    M Offline
                    M Offline
                    Mohammed Hameed
                    wrote on last edited by
                    #9

                    Thank you for discussing on this topic. I mean to say: Most of the developers who over use global variables, at some point in time, while development get confused whether to use them or avoid. Some of them may never reveal to others about this confusion.

                    http://authenticcode.com

                    I 1 Reply Last reply
                    0
                    • M Mohammed Hameed

                      Thank you for discussing on this topic. I mean to say: Most of the developers who over use global variables, at some point in time, while development get confused whether to use them or avoid. Some of them may never reveal to others about this confusion.

                      http://authenticcode.com

                      I Offline
                      I Offline
                      Ingo
                      wrote on last edited by
                      #10

                      Ah! Ok. Now I got it. :) Well, yes. Like everything that is abbused, a lot of global variables can make your day a little bit harder. I'm not one of those "Don't use global variables ever", I'm more of the kind saying. "Don't use global variables ever, when there is an alternative." Oh. I just realized. It's the same. :-\

                      Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.

                      M 1 Reply Last reply
                      0
                      • I Ingo

                        Ah! Ok. Now I got it. :) Well, yes. Like everything that is abbused, a lot of global variables can make your day a little bit harder. I'm not one of those "Don't use global variables ever", I'm more of the kind saying. "Don't use global variables ever, when there is an alternative." Oh. I just realized. It's the same. :-\

                        Author of Primary ROleplaying SysTem How do I take my coffee? Black as midnight on a moonless night. War doesn't determine who's right. War determines who's left.

                        M Offline
                        M Offline
                        Mohammed Hameed
                        wrote on last edited by
                        #11

                        Perfect. Thanks.

                        http://authenticcode.com

                        1 Reply Last reply
                        0
                        • M Mohammed Hameed

                          It has been noticed that some of the developers knowingly/unknowingly use many global variables. But in my view, naturally they should feel confused at sometime, still some of them dont reveal the fact may be.

                          Understand SOLID! Believe SOLID! Try SOLID; your Code becomes Rock SOLID!!!

                          S Offline
                          S Offline
                          Stefan_Lang
                          wrote on last edited by
                          #12

                          Correct. Global variables can cause confusion. Therefore developers should avoid them. It is all about the readability of code: If you call a function, and it calculates a return value based on the current value of a global variable, the only way to realize this dependency is to read and understand the function code. Without that knowledge, you may expect that every time you call that function you get the same value. But if you pass that 'global' value as a parameter to the function, then it will be obvious what the function depends on, just by looking at the interface. Understanding code with global variables takes a lot more time than understanding code without global variables.

                          M 1 Reply Last reply
                          0
                          • S Stefan_Lang

                            Correct. Global variables can cause confusion. Therefore developers should avoid them. It is all about the readability of code: If you call a function, and it calculates a return value based on the current value of a global variable, the only way to realize this dependency is to read and understand the function code. Without that knowledge, you may expect that every time you call that function you get the same value. But if you pass that 'global' value as a parameter to the function, then it will be obvious what the function depends on, just by looking at the interface. Understanding code with global variables takes a lot more time than understanding code without global variables.

                            M Offline
                            M Offline
                            Mohammed Hameed
                            wrote on last edited by
                            #13

                            Agreed...

                            My Reading-o-Meter

                            Previous -> Read "CLR via C#" by Jeffrey Richter. Current -> Exploring WCF thru Apress' "Pro WCF" by Chris Peiris and Dennis Mulder. Next -> Need to read "The Art of Computer Programming" by Donald E. Knuth.

                            My blog - My recent article

                            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