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. Programming standards...no flaming please!

Programming standards...no flaming please!

Scheduled Pinned Locked Moved The Lounge
csharpdatabasequestion
84 Posts 36 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.
  • L led mike

    Christian Graus wrote:

    The book that covers all of this is called Code Complete

    4 cups of coffee: $3.25 Bag of M&M peanuts: $2.49 Surfing Code Project: Free Don Miguel's comment on Code Complete[^]: Priceless There are some things money can't buy, for everything else there's Mastercard :-D

    L Offline
    L Offline
    leckey 0
    wrote on last edited by
    #41

    Ooh, you better hide! They'll get you for copyright infringement!:-D

    1 Reply Last reply
    0
    • E Ennis Ray Lynch Jr

      While I did have formal training in the form of a CS degree I taught myself coding long before I was degreed. A man said to the universe: "Sir I exist!" "However," replied the Universe, "The fact has not created in me A sense of obligation." -- Stephen Crane

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

      Me too. But I'm not offended, I'd expect more self taught people to write bad code than good. Although, sometimes I think more formally trained people write bad code than good.... Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

      E 1 Reply Last reply
      0
      • L leckey 0

        I wasn't really sure if this belonged to a particular message board so please no flaming! I am wondering what others habits are when it comes to programming. I just inherited a huge VB.NET program. In one VB page it has over 10k lines of code. One function within that has about half those lines. Do you have a "limit" on how big/small a function/method/class should be before breaking it into smaller parts? We just used the analyzer on this thing and found one case statement has over 70 routes to go. So I'm hoping to clean this puppy up. BTW...heat index is currently at 109 degrees. Hope everyone else is staying cool.

        A Offline
        A Offline
        Andy Brummer
        wrote on last edited by
        #43

        leckey wrote:

        We just used the analyzer on this thing and found one case statement has over 70 routes to go.

        Ha, I once had to fix one that only had 30 branches, but each branch had it's own 10 branch case statement that were all cut and pasted from one original and had one or two cases modified in each of the 30 branches. As far as advice for fixing it goes. Clean it up in VB first before you try to convert it to any other language. Otherwise you are merging understanding the code and translating it into one step which will cause more problems.


        I can imagine the sinking feeling one would have after ordering my book, only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon

        1 Reply Last reply
        0
        • L leckey 0

          I'm not sure. He was playing with the new analyzer we got and just told me about it. I'm just starting to go through the code to figure it out. It's an engineering program so it's a lot of "trying" to get the smallest weight depending on the factors (of which there seem to be a zillion).

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #44

          leckey wrote:

          It's an engineering program

          ROTFLMAO :laugh::laugh::laugh::laugh::laugh::laugh: :laugh::laugh::laugh::laugh::laugh::laugh: Yes we are writing this engineering program in VB! What's next building a space craft out of bricks? Some days CP is one of the funniest .... ummm whatever.... tired from laughing now.

          L 1 Reply Last reply
          0
          • L led mike

            leckey wrote:

            It's an engineering program

            ROTFLMAO :laugh::laugh::laugh::laugh::laugh::laugh: :laugh::laugh::laugh::laugh::laugh::laugh: Yes we are writing this engineering program in VB! What's next building a space craft out of bricks? Some days CP is one of the funniest .... ummm whatever.... tired from laughing now.

            L Offline
            L Offline
            leckey 0
            wrote on last edited by
            #45

            I know...I know. It does interact with another 3rd party product that uses FORTRAN. Glad I could make you laugh though....as I cry while going through this code.

            P 1 Reply Last reply
            0
            • L leckey 0

              I know...I know. It does interact with another 3rd party product that uses FORTRAN. Glad I could make you laugh though....as I cry while going through this code.

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

              leckey wrote:

              I know...I know. It does interact with another 3rd party product that uses FORTRAN.

              :omg:

              L S 2 Replies Last reply
              0
              • P Paul Conrad

                leckey wrote:

                I know...I know. It does interact with another 3rd party product that uses FORTRAN.

                :omg:

                L Offline
                L Offline
                led mike
                wrote on last edited by
                #47

                hehehehe if I don't stop laughing soon I will need to got to hospital

                P 1 Reply Last reply
                0
                • C Christian Graus

                  Me too. But I'm not offended, I'd expect more self taught people to write bad code than good. Although, sometimes I think more formally trained people write bad code than good.... Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                  E Offline
                  E Offline
                  Ennis Ray Lynch Jr
                  wrote on last edited by
                  #48

                  There are more people that write bad code than good. Formal training, unf., doesn't even enter into the equation. A man said to the universe: "Sir I exist!" "However," replied the Universe, "The fact has not created in me A sense of obligation." -- Stephen Crane

                  1 Reply Last reply
                  0
                  • C Christian Graus

                    leckey wrote:

                    Unfortunately, it's my BOSS.

                    Then tread with care, but still indicate that a lot of refactoring is required in the interest of maintainability.

                    leckey wrote:

                    I am hoping to persuade said boss to let me rewrite this evil thing in C#.

                    I've done conversions of large projects to C# using automated tools, and it went pretty well. I wouldn't advocate a move of language on the basis that this would solve any problems, but if you're more comfortable with C# ( as I am ), then it's a good move to start with. It also has the benefit that perhaps the boss doesn't know C#, so he won't be able to tinker with it again.... Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                    C Offline
                    C Offline
                    charlieg
                    wrote on last edited by
                    #49

                    10K lines in one function? Heck, *I'll* come smack your boss. And if he gives you the "what is wrong with the code" look/comment, it is a *BAD* sign. :) Btw, I'll second the recommendation on Code Complete. I do not agree with everything he says, but I would categorize the book as an excellent source of how to code. It should be required reading for every programmer. What I cannot agree with is the relatively arbitrary 30 lines/function rule (give or take). Some concepts that code implements don't make sense broken up - the multiple functions don't help the clarity. And clarity is the goal. Charlie Gilley Will program for food... Whoever said children were cheaper by the dozen... lied. My son's PDA is an M249 SAW.

                    C 1 Reply Last reply
                    0
                    • L led mike

                      hehehehe if I don't stop laughing soon I will need to got to hospital

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

                      led mike wrote:

                      hehehehe if I don't stop laughing soon I will need to got to hospital

                      I am glad I've had a few :beer: so far :)

                      1 Reply Last reply
                      0
                      • C charlieg

                        10K lines in one function? Heck, *I'll* come smack your boss. And if he gives you the "what is wrong with the code" look/comment, it is a *BAD* sign. :) Btw, I'll second the recommendation on Code Complete. I do not agree with everything he says, but I would categorize the book as an excellent source of how to code. It should be required reading for every programmer. What I cannot agree with is the relatively arbitrary 30 lines/function rule (give or take). Some concepts that code implements don't make sense broken up - the multiple functions don't help the clarity. And clarity is the goal. Charlie Gilley Will program for food... Whoever said children were cheaper by the dozen... lied. My son's PDA is an M249 SAW.

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

                        charlieg wrote:

                        relatively arbitrary 30 lines/function rule

                        I tend to regard that as a good guide, but I would say people who convolute their code to reach that aim are doing as much harm as people who don't pay attention at all. I find it's a good guide, but I won't even make my code more complex in order to reach it. It's more a good starting point than an immutable law, IMO. Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                        C 1 Reply Last reply
                        0
                        • C Christian Graus

                          charlieg wrote:

                          relatively arbitrary 30 lines/function rule

                          I tend to regard that as a good guide, but I would say people who convolute their code to reach that aim are doing as much harm as people who don't pay attention at all. I find it's a good guide, but I won't even make my code more complex in order to reach it. It's more a good starting point than an immutable law, IMO. Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                          C Offline
                          C Offline
                          charlieg
                          wrote on last edited by
                          #52

                          concur. What drives me battier is no comments. Charlie Gilley Will program for food... Whoever said children were cheaper by the dozen... lied. My son's PDA is an M249 SAW.

                          1 Reply Last reply
                          0
                          • L leckey 0

                            I wasn't really sure if this belonged to a particular message board so please no flaming! I am wondering what others habits are when it comes to programming. I just inherited a huge VB.NET program. In one VB page it has over 10k lines of code. One function within that has about half those lines. Do you have a "limit" on how big/small a function/method/class should be before breaking it into smaller parts? We just used the analyzer on this thing and found one case statement has over 70 routes to go. So I'm hoping to clean this puppy up. BTW...heat index is currently at 109 degrees. Hope everyone else is staying cool.

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

                            Try to keep a function to one page. A guide, not a rule however. Elaine :rose: The tigress is here :-D

                            1 Reply Last reply
                            0
                            • L led mike

                              Christian Graus wrote:

                              The book that covers all of this is called Code Complete

                              4 cups of coffee: $3.25 Bag of M&M peanuts: $2.49 Surfing Code Project: Free Don Miguel's comment on Code Complete[^]: Priceless There are some things money can't buy, for everything else there's Mastercard :-D

                              R Offline
                              R Offline
                              Ryan Binns
                              wrote on last edited by
                              #54

                              led mike wrote:

                              Don Miguel's comment on Code Complete[^]: Priceless

                              Please explain what is good about that. You've posted this as being some high-quality post-of-the-year a few times, but I fail to see anything that stands out about it.

                              Ryan

                              "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

                              L 1 Reply Last reply
                              0
                              • L leckey 0

                                I wasn't really sure if this belonged to a particular message board so please no flaming! I am wondering what others habits are when it comes to programming. I just inherited a huge VB.NET program. In one VB page it has over 10k lines of code. One function within that has about half those lines. Do you have a "limit" on how big/small a function/method/class should be before breaking it into smaller parts? We just used the analyzer on this thing and found one case statement has over 70 routes to go. So I'm hoping to clean this puppy up. BTW...heat index is currently at 109 degrees. Hope everyone else is staying cool.

                                C Offline
                                C Offline
                                code frog 0
                                wrote on last edited by
                                #55

                                109 wow. It's only 68 for me but that's the beauty of A/C. Technology should read SD someday. I just saw you were a code-chick (slang intended for humor) that's cool!:cool: So what's a leckey anyways? I'd explain code-frog but it would take about 32 years as of July 18th.:-D


                                When I'm joking people take me seriously.
                                When I'm serious they think I'm joking.
                                I'm left to conclude my life must be a complete joke. :sigh: :laugh: :cool:

                                L S 2 Replies Last reply
                                0
                                • L leckey 0

                                  Ennis Ray Lynch, Jr. wrote:

                                  Switch to c#

                                  Amen brother! I hate VB.

                                  Ennis Ray Lynch, Jr. wrote:

                                  In business applications readability and maintainability and self-documentation is more important that the absolute fastest code [in most cases].

                                  Like I said, it's ugly code. Not much commenting. Old code just commented out. And it is definately not that fast. If it were me I'd rewrite the entire thing.

                                  M Offline
                                  M Offline
                                  mr_lasseter
                                  wrote on last edited by
                                  #56

                                  I wonder why VB gets such a bad name? Your boss could have very easily written the same progam in C#. Last time I checked there was nothing in C# that prevents a function from being a certain number of lines or that limits the branching in a switch statement. Judging by some of the questions in C# forum, I wouldn't be surprised if you will soon see C# applications built like this. Remember not everyone that is using C# right now has a C or java background.;P Mike Lasseter

                                  1 Reply Last reply
                                  0
                                  • C code frog 0

                                    109 wow. It's only 68 for me but that's the beauty of A/C. Technology should read SD someday. I just saw you were a code-chick (slang intended for humor) that's cool!:cool: So what's a leckey anyways? I'd explain code-frog but it would take about 32 years as of July 18th.:-D


                                    When I'm joking people take me seriously.
                                    When I'm serious they think I'm joking.
                                    I'm left to conclude my life must be a complete joke. :sigh: :laugh: :cool:

                                    L Offline
                                    L Offline
                                    leckey 0
                                    wrote on last edited by
                                    #57

                                    I prefer Geek Girl, but Code Chick works. When I ran into other computer science students around town they would always be like, "Oh I remember you! I had class xyz with you!" I guess I was pretty memorable being the only white chick in class.:cool: leckey be part of my last name. I was one of those girls who hyphenated.

                                    1 Reply Last reply
                                    0
                                    • L leckey 0

                                      I wasn't really sure if this belonged to a particular message board so please no flaming! I am wondering what others habits are when it comes to programming. I just inherited a huge VB.NET program. In one VB page it has over 10k lines of code. One function within that has about half those lines. Do you have a "limit" on how big/small a function/method/class should be before breaking it into smaller parts? We just used the analyzer on this thing and found one case statement has over 70 routes to go. So I'm hoping to clean this puppy up. BTW...heat index is currently at 109 degrees. Hope everyone else is staying cool.

                                      E Offline
                                      E Offline
                                      Eric Goedhart
                                      wrote on last edited by
                                      #58

                                      Hi, I assume you talk about a program that has to be completed and you are faced with a lot of code from others who have worked on this program before. I think that you (forget the whole program you have at this moment), should make clear what the function is of this program, what it should do, what results are expected (who will work with it) and then compare all of this with what you have when you hit F5. When this result is acceptable regarding what the software should perorm, and the overall design is ok, i would go deeper into the code, otherwise i would suggest dropping what you have right now. When you look to modern software (corporate software) 99.9 % of the expected (Visual Studio based) software is all about inserting, editing and updating or removing data in a database that runs on the Windows Operating System and can be accesed via your Windows or Internet application, or be shared over a network, and is presented to the users in a logical working relating way,so these operations can be performed. 0.1% (my quess) are difficult calculations and so on, that need special attention. When you have the main things ok i would concentrate on this 1% with your whole team, and see how far you can go in realising the task these functions have ro perform. Good luck with your project:) With friendly greetings, Eric Goedhart Skype: eric-goedhart Deep in the fundamental heart of mind and Universe there is a reason. -Slartibartfast

                                      1 Reply Last reply
                                      0
                                      • C code frog 0

                                        109 wow. It's only 68 for me but that's the beauty of A/C. Technology should read SD someday. I just saw you were a code-chick (slang intended for humor) that's cool!:cool: So what's a leckey anyways? I'd explain code-frog but it would take about 32 years as of July 18th.:-D


                                        When I'm joking people take me seriously.
                                        When I'm serious they think I'm joking.
                                        I'm left to conclude my life must be a complete joke. :sigh: :laugh: :cool:

                                        S Offline
                                        S Offline
                                        S Senthil Kumar
                                        wrote on last edited by
                                        #59

                                        Belated birthday wishes Rex. I should've remembered it, especially because my birthday is also July 18th :)

                                        Regards Senthil _____________________________ My Blog | My Articles | WinMacro

                                        C 1 Reply Last reply
                                        0
                                        • L leckey 0

                                          I wasn't really sure if this belonged to a particular message board so please no flaming! I am wondering what others habits are when it comes to programming. I just inherited a huge VB.NET program. In one VB page it has over 10k lines of code. One function within that has about half those lines. Do you have a "limit" on how big/small a function/method/class should be before breaking it into smaller parts? We just used the analyzer on this thing and found one case statement has over 70 routes to go. So I'm hoping to clean this puppy up. BTW...heat index is currently at 109 degrees. Hope everyone else is staying cool.

                                          S Offline
                                          S Offline
                                          Stuart Dootson
                                          wrote on last edited by
                                          #60

                                          The one time we had a strictly enforced limit was when I developed safety critical code - and then we put a limit on the McCabe Complexity metric[^] per sub-program (15, I think). This means that there is a strict limit on the number of decision points in the function/procedure, making understanding of said code item, easier, as well as making unit testing cheaper. The only times you could argue against the limit was when you had case statements on big enumerated types (for example, our scheduler used an enumerated type as a sort of task id and switched on that to dispatch scheduled functions).

                                          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