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. How many lines of C# code does it take to change a light bulb?

How many lines of C# code does it take to change a light bulb?

Scheduled Pinned Locked Moved The Lounge
csharpquestion
18 Posts 16 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.
  • I Ian Shlasko

    Q. How many lines of VB code does it take to change a light bulb? A. Zero. The light bulb control is included with VB. Find the ChangeButton property in the visual designer, and set it to the name of a button on your form. That button will now automatically change the light bulb. (After the recent complaining about VB-bashing, I figured I'd say something semi-nice :) )

    Proud to have finally moved to the A-Ark. Which one are you in?
    Author of the Guardians Saga (Sci-Fi/Fantasy novels)

    G Offline
    G Offline
    Gregory Gadow
    wrote on last edited by
    #8

    :thumbsup:

    1 Reply Last reply
    0
    • S Soulus83

      A thousand, as you need to create the interfaces so the bulb is not tightly coupled to the socket and the socket not knowing what type of bulb will it receive. And the implement them on the concrete classes Bulb and Socket Also, need to place 100 unit tests for both bulb and socket to manage how will they behave in different scenarios (with electric supply, without it, under water, under sand, etc) Finally, set your continuous integration tool so each time you need to change Bulb, it compiles, run tests and code coverage statistics and finally deploys the new bulb to the socket. Briefly, what comes to my mind :laugh:

      "Whether you think you can, or you think you can't--either way, you are right." — Henry Ford "When I waste my time, I only use the best, Code Project...don't leave home without it." — Slacker007

      G Offline
      G Offline
      Gregory Gadow
      wrote on last edited by
      #9

      Which is why you inherit from a generic light bulb object and leave that whole mess for someone else to figure out. :rolleyes:

      1 Reply Last reply
      0
      • G Gregory Gadow

        Q: How many lines of C# code does it take to change a light bulb? A: One. A properly designed light bulb object would inherit a change method from a generic light bulb class, so just call it and your're done.

        G Offline
        G Offline
        Ger Hayden
        wrote on last edited by
        #10

        A, None - thats a hardware problem

        Ger

        1 Reply Last reply
        0
        • G Gregory Gadow

          Q: How many lines of C# code does it take to change a light bulb? A: One. A properly designed light bulb object would inherit a change method from a generic light bulb class, so just call it and your're done.

          P Offline
          P Offline
          Peter Mulholland
          wrote on last edited by
          #11

          These days, does the 'change' behaviour not have to be injected from somewhere else?

          Pete

          R 1 Reply Last reply
          0
          • P Peter Mulholland

            These days, does the 'change' behaviour not have to be injected from somewhere else?

            Pete

            R Offline
            R Offline
            R Erasmus
            wrote on last edited by
            #12

            I would say that you would probebly have to create a robot to do the job. Write the software for the robot. You'll have to keep a check on the stock levels though. You can also design another robot to create the actual light bulb if you'd like. You'd have to keep a check on the stock level of that as well though. So you'll have a production line in the form of: 1) Get resources for bulbs. 2) Transport to robot1 3) Insert material into robot1 4) Manufacture glass with robot1 5) Transport to robot2 6) Insert bulbs into robot2 Software should be written for robot1 and robot2 More C than C#... C# maybe just for the gui for configuering robot externally depending how involved you want it to be.

            "Program testing can be used to show the presence of bugs, but never to show their absence." << please vote!! >>

            1 Reply Last reply
            0
            • G Gregory Gadow

              Q: How many lines of C# code does it take to change a light bulb? A: One. A properly designed light bulb object would inherit a change method from a generic light bulb class, so just call it and your're done.

              M Offline
              M Offline
              mmelvis
              wrote on last edited by
              #13

              Being an end user and this feature was not requested in the original scope of the project I was asked to submit a Change Request Form. I was advised that the change will be reviewed by a committee and they would get back to with an estimate on cost and time to implement. In the meantime I sit in the dark hoping for the new feature to be implemented.

              A 1 Reply Last reply
              0
              • S Soulus83

                A thousand, as you need to create the interfaces so the bulb is not tightly coupled to the socket and the socket not knowing what type of bulb will it receive. And the implement them on the concrete classes Bulb and Socket Also, need to place 100 unit tests for both bulb and socket to manage how will they behave in different scenarios (with electric supply, without it, under water, under sand, etc) Finally, set your continuous integration tool so each time you need to change Bulb, it compiles, run tests and code coverage statistics and finally deploys the new bulb to the socket. Briefly, what comes to my mind :laugh:

                "Whether you think you can, or you think you can't--either way, you are right." — Henry Ford "When I waste my time, I only use the best, Code Project...don't leave home without it." — Slacker007

                R Offline
                R Offline
                rnbergren
                wrote on last edited by
                #14

                Awesome. I swear I worked with you in a previous life. Cause that is exactly what one of my old co-workers would have done.

                To err is human to really mess up you need a computer

                1 Reply Last reply
                0
                • M mmelvis

                  Being an end user and this feature was not requested in the original scope of the project I was asked to submit a Change Request Form. I was advised that the change will be reviewed by a committee and they would get back to with an estimate on cost and time to implement. In the meantime I sit in the dark hoping for the new feature to be implemented.

                  A Offline
                  A Offline
                  Alexander DiMauro
                  wrote on last edited by
                  #15

                  :laugh: Sounds like we work at the same place!

                  1 Reply Last reply
                  0
                  • S Soulus83

                    A thousand, as you need to create the interfaces so the bulb is not tightly coupled to the socket and the socket not knowing what type of bulb will it receive. And the implement them on the concrete classes Bulb and Socket Also, need to place 100 unit tests for both bulb and socket to manage how will they behave in different scenarios (with electric supply, without it, under water, under sand, etc) Finally, set your continuous integration tool so each time you need to change Bulb, it compiles, run tests and code coverage statistics and finally deploys the new bulb to the socket. Briefly, what comes to my mind :laugh:

                    "Whether you think you can, or you think you can't--either way, you are right." — Henry Ford "When I waste my time, I only use the best, Code Project...don't leave home without it." — Slacker007

                    I Offline
                    I Offline
                    InfRes
                    wrote on last edited by
                    #16

                    Those interfaces exist in the real world too... Bayonet Cap, Edison Screw, Small edison Screw. They'd be modeled in the original version. Therefore I'd say 0 lines, its done in the dependancy injection framework's configuration script.... :-)

                    1 Reply Last reply
                    0
                    • G Gregory Gadow

                      Q: How many lines of C# code does it take to change a light bulb? A: One. A properly designed light bulb object would inherit a change method from a generic light bulb class, so just call it and your're done.

                      A Offline
                      A Offline
                      arcb
                      wrote on last edited by
                      #17

                      None. Unfortunately, the lightbulb was originally implemented in VB6, there's only one guy in the building who maintains the old codebase and he's got an 11 year backlog of Y2K stuff still to fix.

                      1 Reply Last reply
                      0
                      • G Gregory Gadow

                        Q: How many lines of C# code does it take to change a light bulb? A: One. A properly designed light bulb object would inherit a change method from a generic light bulb class, so just call it and your're done.

                        R Offline
                        R Offline
                        robbertnix
                        wrote on last edited by
                        #18

                        try a reboot. like everyone else

                        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