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. who wrote wrote this C program?

who wrote wrote this C program?

Scheduled Pinned Locked Moved The Weird and The Wonderful
questiondatabasecombusiness
10 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.
  • S Offline
    S Offline
    Steven A Lowe
    wrote on last edited by
    #1

    Several years ago I was asked to evaluate a C program. The question was: can we fix it, or do we need to rewrite it? What the program did and for whom doesn't matter, other than it should have been a straightforward business application: user-interface screens and database reads and updates. The client was concerned that the program - used daily by several people for real work - was "flaky" and would often lock up or BSOD after 15-20 minutes. So I started looking at the code...and found several interesting things:

    • the program was using invisible pop-up windows as temporary data buffers to implement wizard-like operations in the user-interface, and never deallocating them.
    • every variable was global
    • there were no data structures anywhere for anything
    • there were no functions other than those required by the GUI
    • several functions were over 75 pages long - that's about 4500 lines of code in a single function
    • the level of code redundancy was incredible; it was common to see the same 5-10 lines of code repeated several dozen times within the same function

    Naturally, my recommendation was that the system be rewritten, preferably in an object-oriented language [which we did, but that was a Success Story, not a Horror Story]. My curiosity could not be held back, I had to know who had written this program... This program was written by a COBOL programmer. It was her first C program, and her first GUI program. I asked what happened to her. They said she got a job with a larger firm in the same industry just down the street - teaching C programming!

    Best regards, Steven A. Lowe CEO, Innovator LLC www.nov8r.com

    D Q Y P 4 Replies Last reply
    0
    • S Steven A Lowe

      Several years ago I was asked to evaluate a C program. The question was: can we fix it, or do we need to rewrite it? What the program did and for whom doesn't matter, other than it should have been a straightforward business application: user-interface screens and database reads and updates. The client was concerned that the program - used daily by several people for real work - was "flaky" and would often lock up or BSOD after 15-20 minutes. So I started looking at the code...and found several interesting things:

      • the program was using invisible pop-up windows as temporary data buffers to implement wizard-like operations in the user-interface, and never deallocating them.
      • every variable was global
      • there were no data structures anywhere for anything
      • there were no functions other than those required by the GUI
      • several functions were over 75 pages long - that's about 4500 lines of code in a single function
      • the level of code redundancy was incredible; it was common to see the same 5-10 lines of code repeated several dozen times within the same function

      Naturally, my recommendation was that the system be rewritten, preferably in an object-oriented language [which we did, but that was a Success Story, not a Horror Story]. My curiosity could not be held back, I had to know who had written this program... This program was written by a COBOL programmer. It was her first C program, and her first GUI program. I asked what happened to her. They said she got a job with a larger firm in the same industry just down the street - teaching C programming!

      Best regards, Steven A. Lowe CEO, Innovator LLC www.nov8r.com

      D Offline
      D Offline
      darkelv
      wrote on last edited by
      #2

      You know, those who can't code, manage. Those who can't manage... you know where they end up at.. :)

      V 1 Reply Last reply
      0
      • S Steven A Lowe

        Several years ago I was asked to evaluate a C program. The question was: can we fix it, or do we need to rewrite it? What the program did and for whom doesn't matter, other than it should have been a straightforward business application: user-interface screens and database reads and updates. The client was concerned that the program - used daily by several people for real work - was "flaky" and would often lock up or BSOD after 15-20 minutes. So I started looking at the code...and found several interesting things:

        • the program was using invisible pop-up windows as temporary data buffers to implement wizard-like operations in the user-interface, and never deallocating them.
        • every variable was global
        • there were no data structures anywhere for anything
        • there were no functions other than those required by the GUI
        • several functions were over 75 pages long - that's about 4500 lines of code in a single function
        • the level of code redundancy was incredible; it was common to see the same 5-10 lines of code repeated several dozen times within the same function

        Naturally, my recommendation was that the system be rewritten, preferably in an object-oriented language [which we did, but that was a Success Story, not a Horror Story]. My curiosity could not be held back, I had to know who had written this program... This program was written by a COBOL programmer. It was her first C program, and her first GUI program. I asked what happened to her. They said she got a job with a larger firm in the same industry just down the street - teaching C programming!

        Best regards, Steven A. Lowe CEO, Innovator LLC www.nov8r.com

        Q Offline
        Q Offline
        QuiJohn
        wrote on last edited by
        #3

        Steven A. Lowe wrote:

        the program was using invisible pop-up windows as temporary data buffers to implement wizard-like operations in the user-interface, and never deallocating them.

        Ahead of its time: garbage collection without the collection!

        Steven A. Lowe wrote:

        every variable was global

        But think of all the stack space you have!

        Steven A. Lowe wrote:

        there were no data structures anywhere for anything

        Or you could think of it as a data structure everywhere for everything.

        Steven A. Lowe wrote:

        there were no functions other than those required by the GUI

        Again, think of the saved stack space!

        Steven A. Lowe wrote:

        several functions were over 75 pages long - that's about 4500 lines of code in a single function

        But I bet Intellisense was nice and responsive.

        Steven A. Lowe wrote:

        the level of code redundancy was incredible; it was common to see the same 5-10 lines of code repeated several dozen times within the same function

        Man, haven't you heard of code reuse??


        Faith is a fine invention For gentlemen who see; But microscopes are prudent In an emergency!            -Emily Dickinson

        M D 2 Replies Last reply
        0
        • Q QuiJohn

          Steven A. Lowe wrote:

          the program was using invisible pop-up windows as temporary data buffers to implement wizard-like operations in the user-interface, and never deallocating them.

          Ahead of its time: garbage collection without the collection!

          Steven A. Lowe wrote:

          every variable was global

          But think of all the stack space you have!

          Steven A. Lowe wrote:

          there were no data structures anywhere for anything

          Or you could think of it as a data structure everywhere for everything.

          Steven A. Lowe wrote:

          there were no functions other than those required by the GUI

          Again, think of the saved stack space!

          Steven A. Lowe wrote:

          several functions were over 75 pages long - that's about 4500 lines of code in a single function

          But I bet Intellisense was nice and responsive.

          Steven A. Lowe wrote:

          the level of code redundancy was incredible; it was common to see the same 5-10 lines of code repeated several dozen times within the same function

          Man, haven't you heard of code reuse??


          Faith is a fine invention For gentlemen who see; But microscopes are prudent In an emergency!            -Emily Dickinson

          M Offline
          M Offline
          Mladen Jankovic
          wrote on last edited by
          #4

          David Kentley wrote:

          Ahead of its time: garbage collection without the collection!

          5! :laugh:

          [Genetic Algorithm Library]

          1 Reply Last reply
          0
          • Q QuiJohn

            Steven A. Lowe wrote:

            the program was using invisible pop-up windows as temporary data buffers to implement wizard-like operations in the user-interface, and never deallocating them.

            Ahead of its time: garbage collection without the collection!

            Steven A. Lowe wrote:

            every variable was global

            But think of all the stack space you have!

            Steven A. Lowe wrote:

            there were no data structures anywhere for anything

            Or you could think of it as a data structure everywhere for everything.

            Steven A. Lowe wrote:

            there were no functions other than those required by the GUI

            Again, think of the saved stack space!

            Steven A. Lowe wrote:

            several functions were over 75 pages long - that's about 4500 lines of code in a single function

            But I bet Intellisense was nice and responsive.

            Steven A. Lowe wrote:

            the level of code redundancy was incredible; it was common to see the same 5-10 lines of code repeated several dozen times within the same function

            Man, haven't you heard of code reuse??


            Faith is a fine invention For gentlemen who see; But microscopes are prudent In an emergency!            -Emily Dickinson

            D Offline
            D Offline
            Dan Neely
            wrote on last edited by
            #5

            David Kentley wrote:

            Steven A. Lowe wrote: the level of code redundancy was incredible; it was common to see the same 5-10 lines of code repeated several dozen times within the same function Man, haven't you heard of code refuse??

            fixed that for you.

            Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots. -- Robert Royall

            1 Reply Last reply
            0
            • S Steven A Lowe

              Several years ago I was asked to evaluate a C program. The question was: can we fix it, or do we need to rewrite it? What the program did and for whom doesn't matter, other than it should have been a straightforward business application: user-interface screens and database reads and updates. The client was concerned that the program - used daily by several people for real work - was "flaky" and would often lock up or BSOD after 15-20 minutes. So I started looking at the code...and found several interesting things:

              • the program was using invisible pop-up windows as temporary data buffers to implement wizard-like operations in the user-interface, and never deallocating them.
              • every variable was global
              • there were no data structures anywhere for anything
              • there were no functions other than those required by the GUI
              • several functions were over 75 pages long - that's about 4500 lines of code in a single function
              • the level of code redundancy was incredible; it was common to see the same 5-10 lines of code repeated several dozen times within the same function

              Naturally, my recommendation was that the system be rewritten, preferably in an object-oriented language [which we did, but that was a Success Story, not a Horror Story]. My curiosity could not be held back, I had to know who had written this program... This program was written by a COBOL programmer. It was her first C program, and her first GUI program. I asked what happened to her. They said she got a job with a larger firm in the same industry just down the street - teaching C programming!

              Best regards, Steven A. Lowe CEO, Innovator LLC www.nov8r.com

              Y Offline
              Y Offline
              Yusuf
              wrote on last edited by
              #6

              Steven A. Lowe wrote:

              I asked what happened to her. They said she got a job with a larger firm in the same industry just down the street - teaching C programming!

              It is a shame X| My first C class was thought by a guy who is good at COBOL but knows very little C. I made it through the class thinking, I am C Master. It did not occur to me how little I Knew until I took Data Structures with the toughest instructor in my life. I broke down and admitted I didn't knew C. He said, if you are willing to put up the time and effort I will help you. After painful semester, I learned C and felt very grateful. Because of that lesson I am a better developer now. :cool:

              Yusuf

              M B 2 Replies Last reply
              0
              • S Steven A Lowe

                Several years ago I was asked to evaluate a C program. The question was: can we fix it, or do we need to rewrite it? What the program did and for whom doesn't matter, other than it should have been a straightforward business application: user-interface screens and database reads and updates. The client was concerned that the program - used daily by several people for real work - was "flaky" and would often lock up or BSOD after 15-20 minutes. So I started looking at the code...and found several interesting things:

                • the program was using invisible pop-up windows as temporary data buffers to implement wizard-like operations in the user-interface, and never deallocating them.
                • every variable was global
                • there were no data structures anywhere for anything
                • there were no functions other than those required by the GUI
                • several functions were over 75 pages long - that's about 4500 lines of code in a single function
                • the level of code redundancy was incredible; it was common to see the same 5-10 lines of code repeated several dozen times within the same function

                Naturally, my recommendation was that the system be rewritten, preferably in an object-oriented language [which we did, but that was a Success Story, not a Horror Story]. My curiosity could not be held back, I had to know who had written this program... This program was written by a COBOL programmer. It was her first C program, and her first GUI program. I asked what happened to her. They said she got a job with a larger firm in the same industry just down the street - teaching C programming!

                Best regards, Steven A. Lowe CEO, Innovator LLC www.nov8r.com

                P Offline
                P Offline
                Paul Conrad
                wrote on last edited by
                #7

                Steven A. Lowe wrote:

                several functions were over 75 pages long - that's about 4500 lines of code in a single function

                That is just flat out a horror itself.

                Steven A. Lowe wrote:

                asked what happened to her. They said she got a job with a larger firm in the same industry just down the street - teaching C programming!

                That's even scarier.

                "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

                1 Reply Last reply
                0
                • Y Yusuf

                  Steven A. Lowe wrote:

                  I asked what happened to her. They said she got a job with a larger firm in the same industry just down the street - teaching C programming!

                  It is a shame X| My first C class was thought by a guy who is good at COBOL but knows very little C. I made it through the class thinking, I am C Master. It did not occur to me how little I Knew until I took Data Structures with the toughest instructor in my life. I broke down and admitted I didn't knew C. He said, if you are willing to put up the time and effort I will help you. After painful semester, I learned C and felt very grateful. Because of that lesson I am a better developer now. :cool:

                  Yusuf

                  M Offline
                  M Offline
                  mattraffel
                  wrote on last edited by
                  #8

                  how about a C++ class taught by an accountant (by profession) handing out code examples that were not syntax correct? Sorry to say, yes this is a true story. Good thing I was already working w/ C++

                  1 Reply Last reply
                  0
                  • D darkelv

                    You know, those who can't code, manage. Those who can't manage... you know where they end up at.. :)

                    V Offline
                    V Offline
                    Vimalsoft Pty Ltd
                    wrote on last edited by
                    #9

                    :) You are right, those who cant code Manage :),(She) is now a teacher:)

                    Vuyiswa Maseko, Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding VB.NET/SQL7/2000/2005 http://vuyiswamb.007ihost.com http://Ecadre.007ihost.com vuyiswam@tshwane.gov.za

                    1 Reply Last reply
                    0
                    • Y Yusuf

                      Steven A. Lowe wrote:

                      I asked what happened to her. They said she got a job with a larger firm in the same industry just down the street - teaching C programming!

                      It is a shame X| My first C class was thought by a guy who is good at COBOL but knows very little C. I made it through the class thinking, I am C Master. It did not occur to me how little I Knew until I took Data Structures with the toughest instructor in my life. I broke down and admitted I didn't knew C. He said, if you are willing to put up the time and effort I will help you. After painful semester, I learned C and felt very grateful. Because of that lesson I am a better developer now. :cool:

                      Yusuf

                      B Offline
                      B Offline
                      BillW33
                      wrote on last edited by
                      #10

                      More proof that just knowing the syntax of a language is not enough to write high quality code. Bill W

                      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