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. Coding standards?

Coding standards?

Scheduled Pinned Locked Moved The Lounge
comquestion
27 Posts 13 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.
  • N Not Active

    I can't believe my eyes. I was looking over some code we were supposed to port for use in a W2K COM project. I found the previous authors had created about 800 lines of macros, divided into about 25+ header files (some with just one line). Their implementation was basically nothing more than calling these macros. No exception handling, code formatted with no regard to tabs, 30-40 blank lines in the middle of a routine. What gets even worse is the lead developer for this project thinks this is the best they can produce. Makes me glad to be a consultant. One, I'll always have work fixing their work, and two I can leave when the axe begins to fall.;P

    G Offline
    G Offline
    George
    wrote on last edited by
    #18

    I guess it's always the case that the other peoples code doesn't look the way we would expect it to. I am not sure about the macros and exceptions problem because it often depends on the problem and implementation and it might be justified. However the bad formatting of the code is quite bad. The 30-40 blank lines is really bad. If I was a manager and some of my people would produce blank lines like that I would simply fire the guy on the spot. People who do not take a second to review their code and leave mess behind are only to cause the troubles in the (near) future. People who review their code and think that's OK are not worthy to keep either. In my office the main problem I notice is a lot of copy-paste that leads to a huge multiplicated chunks of code that is a nightmare to maintain. I blame it for the company's policy to code fast and without proper design - that always forces people to take shortcuts to make job done fast.

    1 Reply Last reply
    0
    • M Marcus Spitzmiller

      Funny you should mention that. Altough I understand the concepts, I really have never been able to implement anything I was satisfied with. Do you know of any good reading material on some good exception handling techniques? Thanks, Marcus

      W Offline
      W Offline
      Wilka
      wrote on last edited by
      #19

      Do you know of any good reading material on some good exception handling techniques? Exceptional C++ - http://www.gotw.ca/publications/xc++.htm More Exceptional C++ - http://www.gotw.ca/publications/mxc++.htm - Wilka

      1 Reply Last reply
      0
      • C Christian Graus

        :eek: :eek: :eek: Until I started working on a debugging tool this week, I've written one macro ( mid, to return a value clamped between two values ). Macros are evil, in fact Stroustrup says they are usually indicative of bad design. He must have consulted there before you did. :-) Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

        Sonork ID 100.10002:MeanManOz

        I live in Bob's HungOut now

        C Offline
        C Offline
        Chris Losinger
        wrote on last edited by
        #20

        ****Christian Graus wrote: Macros are evil I disagree. I use them often in code where, if it weren't for speed considerations, i'd use a small subroutine. yes, i could use an inline function, but as i see it, aside from type checking (which isn't really required in the sections of code i'm talking about), inlines and macros are identical. ****Christian Graus wrote: Stroustrup says they are usually indicative of bad design that's quite a broad statement from someone who probably hasn't written every possible program under every possible constraint. :) -c


        Smaller Animals Software, Inc.

        C 1 Reply Last reply
        0
        • N Neville Franks

          Ravi Bhavnani wrote: I think things will change only when the software development industry is held accountable like other industries such as makers of airplanes, toasters and water heaters. I agree with you but I really do have to wonder whether my toaster manufacture can be held accountable. About 6.53 times out of 10 the toast pops out so vigourously that it lands on the floor. Every time it happens I stand their jaw dropped wondering how in this day and age such a thing is possible.:confused: Neville Franks, Author of ED for Windows. www.getsoft.com

          RaviBeeR Offline
          RaviBeeR Offline
          RaviBee
          wrote on last edited by
          #21

          Neville, In the US, we have a non-profit watchdog organization (Consumer's Union) that publishes a monthly magazine (Consumer's Report) in which they review household kitchen appliances, among other things. The magazine accepts no advertising and has been partially responsible for exposing the truth about the Suzuki Samurai in the '80s. I think your errant toaster would make it to the magazine if you wrote to them and it was sold in the US. PS: Ed looks very cool! /ravi "There is always one more bug..." http://www.ravib.com ravib@ravib.com

          1 Reply Last reply
          0
          • C Chris Losinger

            ****Christian Graus wrote: Macros are evil I disagree. I use them often in code where, if it weren't for speed considerations, i'd use a small subroutine. yes, i could use an inline function, but as i see it, aside from type checking (which isn't really required in the sections of code i'm talking about), inlines and macros are identical. ****Christian Graus wrote: Stroustrup says they are usually indicative of bad design that's quite a broad statement from someone who probably hasn't written every possible program under every possible constraint. :) -c


            Smaller Animals Software, Inc.

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #22

            Chris Losinger wrote: I use them often in code where, if it weren't for speed considerations, i'd use a small subroutine. Before yesterday I had a couple I used, I suspect in similar circumstances to you, when I need a small routine inside a loop iterating over an image's bits. I've had to write several over the past day, because of the nature of the code I am working on. I still believe they are an option to only use after careful consideration of available options. Chris Losinger wrote: that's quite a broad statement from someone who probably hasn't written every possible program under every possible constraint. I'm not sure why you're discounting the fact that he has had to consider the broadness of uses for C++ when he designed it. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

            Sonork ID 100.10002:MeanManOz

            I live in Bob's HungOut now

            C 1 Reply Last reply
            0
            • C Christian Graus

              Chris Losinger wrote: I use them often in code where, if it weren't for speed considerations, i'd use a small subroutine. Before yesterday I had a couple I used, I suspect in similar circumstances to you, when I need a small routine inside a loop iterating over an image's bits. I've had to write several over the past day, because of the nature of the code I am working on. I still believe they are an option to only use after careful consideration of available options. Chris Losinger wrote: that's quite a broad statement from someone who probably hasn't written every possible program under every possible constraint. I'm not sure why you're discounting the fact that he has had to consider the broadness of uses for C++ when he designed it. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

              Sonork ID 100.10002:MeanManOz

              I live in Bob's HungOut now

              C Offline
              C Offline
              Chris Losinger
              wrote on last edited by
              #23

              ****Christian Graus wrote: I'm not sure why you're discounting the fact that he has had to consider the broadness of uses for C++ when he designed it. because i discount most statements that are as broad as that one :). IMO, macros are no more dangerous than pointers, virtual functions, gotos or any other C++ concept. they are all perfectly valid and useful when used appropriately. -c


              Smaller Animals Software, Inc.

              C 1 Reply Last reply
              0
              • N Not Active

                I also find it hard to believe some of this code was written by someone with 10+ years experience and a Master's Degree. You can lead a horse to university, but you can't educate him. :)

                R Offline
                R Offline
                Roger Wright new
                wrote on last edited by
                #24

                When he got the degree, were the computers still made with vacuum tubes?

                1 Reply Last reply
                0
                • N Neville Franks

                  Ravi Bhavnani wrote: I think things will change only when the software development industry is held accountable like other industries such as makers of airplanes, toasters and water heaters. I agree with you but I really do have to wonder whether my toaster manufacture can be held accountable. About 6.53 times out of 10 the toast pops out so vigourously that it lands on the floor. Every time it happens I stand their jaw dropped wondering how in this day and age such a thing is possible.:confused: Neville Franks, Author of ED for Windows. www.getsoft.com

                  R Offline
                  R Offline
                  Roger Wright new
                  wrote on last edited by
                  #25

                  Neville Franks wrote: About 6.53 times out of 10 the toast pops out so vigourously that it lands on the floor. I had one like that! After a time, I ceased thinking of its ballistic payload as toast and began viewing it as skeet for my BB gun. Great entertainment until a BB fell into the launcher, shorting the heating wires... Ah, sweet bedlam:-)

                  1 Reply Last reply
                  0
                  • C Chris Losinger

                    ****Christian Graus wrote: I'm not sure why you're discounting the fact that he has had to consider the broadness of uses for C++ when he designed it. because i discount most statements that are as broad as that one :). IMO, macros are no more dangerous than pointers, virtual functions, gotos or any other C++ concept. they are all perfectly valid and useful when used appropriately. -c


                    Smaller Animals Software, Inc.

                    C Offline
                    C Offline
                    Christian Graus
                    wrote on last edited by
                    #26

                    Chris Losinger wrote: IMO, macros are no more dangerous than pointers, virtual functions, gotos or any other C++ concept. they are all perfectly valid and useful when used appropriately. That's probably true, pointers are obviously also dangerous if misused. But goto - that's just the Devil you're talking about. I use macros sparingly, pointers often, and goto not one in my entire time of using C++. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

                    Sonork ID 100.10002:MeanManOz

                    I live in Bob's HungOut now

                    C 1 Reply Last reply
                    0
                    • C Christian Graus

                      Chris Losinger wrote: IMO, macros are no more dangerous than pointers, virtual functions, gotos or any other C++ concept. they are all perfectly valid and useful when used appropriately. That's probably true, pointers are obviously also dangerous if misused. But goto - that's just the Devil you're talking about. I use macros sparingly, pointers often, and goto not one in my entire time of using C++. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

                      Sonork ID 100.10002:MeanManOz

                      I live in Bob's HungOut now

                      C Offline
                      C Offline
                      Chris Losinger
                      wrote on last edited by
                      #27

                      ****Christian Graus wrote: But goto - that's just the Devil you're talking about. I use [...] goto not one in my entire time of using C++. there is power and a kind of sinister clarity in the directness and forcefullness of GoTo. give in to the dark pleasure of goto! do not be afraid. fear is for those who do not understand. -c


                      Smaller Animals Software, Inc.

                      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