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. code aesthetics

code aesthetics

Scheduled Pinned Locked Moved The Lounge
comquestiondiscussion
103 Posts 42 Posters 10 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.
  • P Pete OHanlon

    Ugly as sin - that's the way. Why should other people be able to read your code? Why they'll totally fail to appreciate your genius. Remember, if only you can understand your code then others will naturally think you're a gifted genius - granted one who's unable to relate to others, but tortured genius nonetheless.

    Deja View - the feeling that you've seen this post before.

    My blog | My articles

    M Offline
    M Offline
    Marc Clifton
    wrote on last edited by
    #62

    Pete O'Hanlon wrote:

    if only you can understand your code then others will naturally think you're a gifted genius

    There must be a phrase for when I can't understand my own code 7 years later. Maybe "gifted jerking off genius" since it's definitely a one-man show. Marc

    Thyme In The Country Interacx My Blog

    1 Reply Last reply
    0
    • H Hans Dietrich

      Fortunately, most of the programmers I meet feel the way you do. But you're missing an important point: there are some people who just don't care - to them it's a job, and a clean compile is the best you can expect from them.

      Best wishes, Hans


      [CodeProject Forum Guidelines] [How To Ask A Question] [My Articles]

      M Offline
      M Offline
      Marc Clifton
      wrote on last edited by
      #63

      Hans Dietrich wrote:

      to them it's a job, and a clean compile is the best you can expect from them.

      That pretty much sums it up. Sadly, a clean compile doesn't mean a bug free execution. "Your code looks like shit, and by the way, I can spot 5 logic errors just by looking at the code". That's what I seem to be saying a lot lately. :sigh: Marc

      Thyme In The Country Interacx My Blog

      S 1 Reply Last reply
      0
      • M Marc Clifton

        I take care to ensure the aesthetics of my code. That spacing and formatting is consistent. I don't care if I'm writing throw away code or production code. The code should always look neat and tidy. Why don't other programmers do the same??? OK, I'm sure there are some out there. And yes, there are code beautifiers, so who really cares, right? What's your thoughts on whether code should look good, in terms of spacing, formatting, structure, etc.? Marc

        Thyme In The Country Interacx My Blog

        R Offline
        R Offline
        Ri Qen Sin
        wrote on last edited by
        #64

        Do not go against Visual Studio's automatic formatting. That's one rule I always follow. :)

        So the creationist says: Everything must have a designer. God designed everything. I say: Why is God the only exception? Why not make the "designs" (like man) exceptions and make God a creation of man?

        1 Reply Last reply
        0
        • G geoffs

          Well, I am heading up a committee of 3 that is going to establish a new standard for future development in our company. Over more than 30 years in the development arena I've amassed quite a bit of my own ideas about what makes for a good standard. Also knowing that just because I think a particular guideline is good doesn't necessarily mean it really is, I'd like to ask you if you could point me in the direction of what you would consider some decent coding standard documents...

          S Offline
          S Offline
          Scott Dorman
          wrote on last edited by
          #65

          geoffs wrote:

          knowing that just because I think a particular guideline is good doesn't necessarily mean it really is

          That's an excellent start. It's important that your standards are a result of quality input from the rest of the team and not designed in a vacuum.

          geoffs wrote:

          point me in the direction of what you would consider some decent coding standard documents...

          I can, but a lot of it depends on your chosen programming language. I really like the Framework Design Guidelines book. It is focused on .NET and designing public facing APIs but at least 90% of the guidelines specified apply to any language. The other one (although more for a really solid reference and background information) is the Ada 95 Quality and Style Guide. (If you can't find it, email me directly from CP and I can email it to you.) From one of my talks on this: What is a code standard?

          • Encompasses all aspects of code construction
          • Designed to improve program adaptation and maintenance
          • Do not form an inflexible set of standards
          • Consistent
          • Is not “one size fits all” – different for different languages
          • Defines the “best practices” for writing code for your development group
          • Must adapt to changes in technology and language

          What is a code standard?

          • Source Code Presentation (Code Formatting)
          • Readability
          • Program Structure
          • Programming Practices
          • Concurrency
          • Portability/Interoperability
          • Reusability
          • Performance
          • Globalization

          The rest of the slide deck (it's short but a lot of the slides have speaker notes) is available on my blog if you want to browse through it. Also, if you're ever in the Florida area (or any of the east coast southern states) I present at a lot of the code camps and usually have a round-table discussion on this topic.

          Scott Dorman

          Microsoft® MVP - Visual C# | MCPD President - Tampa Bay IASA [Blog][Articles][Forum Guidelines]


          Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buc

          G 1 Reply Last reply
          0
          • G geoffs

            Well, I am heading up a committee of 3 that is going to establish a new standard for future development in our company. Over more than 30 years in the development arena I've amassed quite a bit of my own ideas about what makes for a good standard. Also knowing that just because I think a particular guideline is good doesn't necessarily mean it really is, I'd like to ask you if you could point me in the direction of what you would consider some decent coding standard documents...

            I Offline
            I Offline
            Igor Velikorossov
            wrote on last edited by
            #66

            If I may I add my 2c I would normally strongly encourage to have all personnel involved in development familiarised with Microsoft .NET Framework Design Guidelines. These guidelines set out naming conventions, file organisation and many other rules making the code readable and easy to maintain. There are number of resources worth reading, such as follows: 1. published by Brad Adams (founding member of both the Common Language Runtime, and .NET Framework teams) a) Microsoft Internal Coding Guidelines[^] - a good start and something I do follow myself. b) plenty of other guidelines[^] worth checking out in a free time 2. Design Guidelines for Class Library Developers on MSDN[^] 3. every now and then Krzysztof Cwalina's blog[^] is a good read too (at least it used to be) Secondly I would strongly encourage the code documentation. Whilst I do perfectly understand that documenting the code has been the bane of all programmers since the day 1 (and I also suffer from it), I believe it is imperative to write documentation. The main rule - explain NOT WHAT the code does but WHY you've written it this way. Again I would strongly encourage to make a habit of documenting (at least) all publicly exposed objects (types, classes, methods, properties etc) using XML documentation. A good start: here[^] and here[^] Because I work with .NET all of the above mainly applies to .NET stuff, yet it could still make sense for those working with other languages/technologies.

            G 1 Reply Last reply
            0
            • G geoffs

              Do any of your developers ever find there to be a need to print sections of code? That is still a pretty good lowest common denominator (80 cols for readability on an 8.5 x 11 page) which makes me hesitate to accept anything greater than 80 columns width in the code.

              T Offline
              T Offline
              Tom Deketelaere
              wrote on last edited by
              #67

              We don't print much code (everything is sent by email internaly and such means) but I guess you are right if that happens it isn't as readable anymore. (hadn't given it much thought untill you mentioned it, since it olmost never happens here) I'll keep that in mind and might reduce the number of cols

              G 1 Reply Last reply
              0
              • S Scott Dorman

                Tom deketelaere wrote:

                was actually more thinking about code placed here

                Yes, the same would apply to code here; and it's certainly a larger problem here due to the size and scope of the community.

                Tom deketelaere wrote:

                Yeah well the company did have a "senior" programmer at first who was going to 'lead' the department but he turned out to be a very big mistake, so my boss fired him and well I got stuck doing the standerd (with only 1year experiance, but so far I'v been doing well (I think )) and cleaning up his mess, and he left quite a mess behind, still feel the effects now olmost 1 year later

                You will probabbly be feeling the effects for a long time. That's almost always a difficult situation to find oneself in, but it sounds like it's working out for you. Code standards/style is one of those spaces I actually like to play in and have established them at several of the companies I've worked for.

                Scott Dorman

                Microsoft® MVP - Visual C# | MCPD President - Tampa Bay IASA [Blog][Articles][Forum Guidelines]


                Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai

                T Offline
                T Offline
                Tom Deketelaere
                wrote on last edited by
                #68

                Scott Dorman wrote:

                You will probabbly be feeling the effects for a long time.

                Well I'v managed to reduce it to one programme now that doens't need much maintenance or altering, but whenever it does I end up with headache's from hell.

                Scott Dorman wrote:

                Code standards/style is one of those spaces I actually like to play in and have established them at several of the companies I've worked for.

                I'm now in the process of doing the same for a client of us so I guess I'm heading the same direction as you, but I'm shure I'm just a noob in comparison ;P

                W S 2 Replies Last reply
                0
                • M Marc Clifton

                  I take care to ensure the aesthetics of my code. That spacing and formatting is consistent. I don't care if I'm writing throw away code or production code. The code should always look neat and tidy. Why don't other programmers do the same??? OK, I'm sure there are some out there. And yes, there are code beautifiers, so who really cares, right? What's your thoughts on whether code should look good, in terms of spacing, formatting, structure, etc.? Marc

                  Thyme In The Country Interacx My Blog

                  P Offline
                  P Offline
                  peterchen
                  wrote on last edited by
                  #69

                  The ultimate goal is readable, understandable code with few surprises[^]. Everything in that direction helps. Clean, consistent formatting trains the subconcious to provide additional information without mental effort*: indented == new scope, lowercase = local, gets destroyed when leaving block, and so on. Working on a consistent codebase for longer time likely "looks good" / "looks bad" will be injected when looking at a block of code. That might also explain why people get worked up so much about a specific coding convention: reading another one throws them off their guard. Belowdeck, all "danger!" - signs are flashing, while the captain has to reassure the crew that "waves" are indeed a normal appearance in some waters. *) In my mental model of the programmer, we work at the edge of the "7 things one can keep in his mind at a time". Maybe to be a great developer that need to be 8. Pair Programming extends that to maybe 11. "Without mental effort", in this setting, means: not clogging up your first level cache.

                  Burning Chrome ^ | Linkify!| FoldWithUs! | sighist

                  G 1 Reply Last reply
                  0
                  • T Tom Deketelaere

                    Scott Dorman wrote:

                    You will probabbly be feeling the effects for a long time.

                    Well I'v managed to reduce it to one programme now that doens't need much maintenance or altering, but whenever it does I end up with headache's from hell.

                    Scott Dorman wrote:

                    Code standards/style is one of those spaces I actually like to play in and have established them at several of the companies I've worked for.

                    I'm now in the process of doing the same for a client of us so I guess I'm heading the same direction as you, but I'm shure I'm just a noob in comparison ;P

                    W Offline
                    W Offline
                    WilliamFalconerUK
                    wrote on last edited by
                    #70

                    Scott Dorman wrote: Code standards/style is one of those spaces I actually like to play in and have established them at several of the companies I've worked for.

                    I'm currently working for a company where coding standards are talked about but there has been no agreement on a definitive guideline. The result of this being that each person has their own way of doing things, leading to the problem that the code can be difficult to understand and maintain. It also appears that theres resistance to any move to try to standardise, the reason being that the people involved have their own opinions so we get nowhere further with the discussion. Another excuse given is theres "no time" to sort things like this out. The Question I've got for you is this; when you have implemented such standards in existing development teams, what kind of hurdles have you encountered? and how did you manage to overcome them? I'd like to see if theres an approach that could be taken to get a bunch of developers (and their managers) who are set in their own ways to agree the standard and stick to them (not that I'm in a position currently to push for this, but who knows!) Also, reaching an consensus on the standard vs someone taking responsiblity of the standards, which of these might be a better approach? Any thoughts from anyone on this are appreciated.

                    Billy. "Duct tape is like the force, it has a light side, a dark side and it holds the universe together!" - Anonymous my holding page..more coming soon!

                    T S D S 4 Replies Last reply
                    0
                    • W WilliamFalconerUK

                      Scott Dorman wrote: Code standards/style is one of those spaces I actually like to play in and have established them at several of the companies I've worked for.

                      I'm currently working for a company where coding standards are talked about but there has been no agreement on a definitive guideline. The result of this being that each person has their own way of doing things, leading to the problem that the code can be difficult to understand and maintain. It also appears that theres resistance to any move to try to standardise, the reason being that the people involved have their own opinions so we get nowhere further with the discussion. Another excuse given is theres "no time" to sort things like this out. The Question I've got for you is this; when you have implemented such standards in existing development teams, what kind of hurdles have you encountered? and how did you manage to overcome them? I'd like to see if theres an approach that could be taken to get a bunch of developers (and their managers) who are set in their own ways to agree the standard and stick to them (not that I'm in a position currently to push for this, but who knows!) Also, reaching an consensus on the standard vs someone taking responsiblity of the standards, which of these might be a better approach? Any thoughts from anyone on this are appreciated.

                      Billy. "Duct tape is like the force, it has a light side, a dark side and it holds the universe together!" - Anonymous my holding page..more coming soon!

                      T Offline
                      T Offline
                      Tom Deketelaere
                      wrote on last edited by
                      #71

                      You might be better off asking scott this (reply to one of his posts) since he has alot more experiance in this than I have. I'v had the luxary up untill now to be at the start off it all and not having to agree with anyone (it was only me ;P )

                      williamFalconerUK wrote:

                      nother excuse given is theres "no time" to sort things like this out

                      Make the time because it will save you alot of time later on.

                      williamFalconerUK wrote:

                      approach that could be taken to get a bunch of developers (and their managers) who are set in their own ways to agree the standard and stick to them

                      Take an old programme/code (without comments or something) from them (written at least a year ago) and ask them to change something. Do the same but with code with comments and standerds and show them how much faster it can be.

                      williamFalconerUK wrote:

                      Also, reaching an consensus on the standard vs someone taking responsiblity of the standards, which of these might be a better approach?

                      In my (humble) opinion only one person should be responisble for the standerd but all should contribute (discusse best way)

                      1 Reply Last reply
                      0
                      • W WilliamFalconerUK

                        Scott Dorman wrote: Code standards/style is one of those spaces I actually like to play in and have established them at several of the companies I've worked for.

                        I'm currently working for a company where coding standards are talked about but there has been no agreement on a definitive guideline. The result of this being that each person has their own way of doing things, leading to the problem that the code can be difficult to understand and maintain. It also appears that theres resistance to any move to try to standardise, the reason being that the people involved have their own opinions so we get nowhere further with the discussion. Another excuse given is theres "no time" to sort things like this out. The Question I've got for you is this; when you have implemented such standards in existing development teams, what kind of hurdles have you encountered? and how did you manage to overcome them? I'd like to see if theres an approach that could be taken to get a bunch of developers (and their managers) who are set in their own ways to agree the standard and stick to them (not that I'm in a position currently to push for this, but who knows!) Also, reaching an consensus on the standard vs someone taking responsiblity of the standards, which of these might be a better approach? Any thoughts from anyone on this are appreciated.

                        Billy. "Duct tape is like the force, it has a light side, a dark side and it holds the universe together!" - Anonymous my holding page..more coming soon!

                        S Offline
                        S Offline
                        shubumpkin
                        wrote on last edited by
                        #72

                        The defining of a standard is more important than what the standard actually states. The end result is consistency. In large organisations it can be difficult, the key is to involve everyone in the discussions. You want to come to a common consensus and then implement it rapidly. It might take a long time to reach a consensus, but lots of interesting things will come up. Also it is important to make it clear that the guys doing the coding are responsible for defining the standards, the manaqers should act as trainer and enablers making sure new recruits are aware of their role to maintain, follow and help develop those standards. You must make it clear that you are not trying to tell people how to code! Any decent programmer should secretly love the thought of working with and developing standards even if they oppose resistance to it initially. The key is to highlight the fact that they are responsible for the definitions, its not going to be a management decision forced upon them. A good way to start is to have some collaboration perhaps on a wiki. Thus allowing flexibility in the generation of the standards and also to help get people involved. Ultimately 1 person has to be accountable and responsible for managing the "released" standards. Also it is good to start with something. Find a good general standard and get peoples feedback on it, then try to implement it. Well I hope that gives you a few ideas. It is more of a cultural shift you are trying to achieve. Working from, maintaining and constantly improving standards is a hugely powerful way of working. It is imperative for any company to focus large amounts of time working ON the way they do things rather than constantly firefighting - working in it. The "we just haven't got time now, we're too busy" scenario never ends. The key is to offset the short term, with a much longer term vision! Steve O'Brien A successful person isn't necessarily better than her less successful peers at solving problems; her pattern-recognition facilities have just learned what problems are worth solving. www.newicon.net

                        W 1 Reply Last reply
                        0
                        • S shubumpkin

                          The defining of a standard is more important than what the standard actually states. The end result is consistency. In large organisations it can be difficult, the key is to involve everyone in the discussions. You want to come to a common consensus and then implement it rapidly. It might take a long time to reach a consensus, but lots of interesting things will come up. Also it is important to make it clear that the guys doing the coding are responsible for defining the standards, the manaqers should act as trainer and enablers making sure new recruits are aware of their role to maintain, follow and help develop those standards. You must make it clear that you are not trying to tell people how to code! Any decent programmer should secretly love the thought of working with and developing standards even if they oppose resistance to it initially. The key is to highlight the fact that they are responsible for the definitions, its not going to be a management decision forced upon them. A good way to start is to have some collaboration perhaps on a wiki. Thus allowing flexibility in the generation of the standards and also to help get people involved. Ultimately 1 person has to be accountable and responsible for managing the "released" standards. Also it is good to start with something. Find a good general standard and get peoples feedback on it, then try to implement it. Well I hope that gives you a few ideas. It is more of a cultural shift you are trying to achieve. Working from, maintaining and constantly improving standards is a hugely powerful way of working. It is imperative for any company to focus large amounts of time working ON the way they do things rather than constantly firefighting - working in it. The "we just haven't got time now, we're too busy" scenario never ends. The key is to offset the short term, with a much longer term vision! Steve O'Brien A successful person isn't necessarily better than her less successful peers at solving problems; her pattern-recognition facilities have just learned what problems are worth solving. www.newicon.net

                          W Offline
                          W Offline
                          WilliamFalconerUK
                          wrote on last edited by
                          #73

                          Thanks very much for taking the time on this post, it's given me a lot of food for thought! We have a wiki in our department, but this is not being used for standards(at least as far as I know!), so this may be a good place to start. I'll take on board what you've said and think about what the next step is. You mentioned a cultural shift, there are several things here that need to be shifted culturally here (IMO) and the above is just one of those.. there are loads of other things also need to be looked at, but I won't moan about those! Cheers,

                          Billy. MCPD Windows Developer "Duct tape is like the force, it has a light side, a dark side and it holds the universe together!" - Anonymous my holding page..more coming soon!

                          S 1 Reply Last reply
                          0
                          • M Marc Clifton

                            I take care to ensure the aesthetics of my code. That spacing and formatting is consistent. I don't care if I'm writing throw away code or production code. The code should always look neat and tidy. Why don't other programmers do the same??? OK, I'm sure there are some out there. And yes, there are code beautifiers, so who really cares, right? What's your thoughts on whether code should look good, in terms of spacing, formatting, structure, etc.? Marc

                            Thyme In The Country Interacx My Blog

                            S Offline
                            S Offline
                            Steve Naidamast
                            wrote on last edited by
                            #74

                            Years ago when mainframes roamed the Earth, we developers took great pride in developing legible, neat code. In fact, style was paramount to serious developers since it set them apart from those that had no serious interest in the field. Code legibility was and still is the "mark" of what we used to call the "Super Programmer". Such a developer was one who was not the most technically detailed in knowledge but instead a developer who understood the natural flow of systems development and could design and implement a properly functioning and efficient system using nothing but the memories of patterned experience. Today, I find most developers don't really care how their code looks as long as they can clean it up with the IDE's built in formatters. Unfortunately, the only thing such tools can do is indent code neatly. They cannot declare your variables of method names in a consistent and understandable manner. They cannot develop clean methods that are solid and they cannot repair poor setups with respect to method and class order along with "locals of reference". Today, a developer who can seemingly regurgitate an 800 page text on his or her's preferred development language is now seen as the "Super Programmer" of a group. However, in my experience the best that such technicians can seemingly accomplish is that they "vomit" quite well which impresses management unendingly. Few of these people though, have ever put a major system together and seen their implementation function with few or no errors. I have and still do... The problem is most technical managers today are enamored by this new breed of technician who only seem to perpetuate the messes that management has encouraged in systems development the result being the long-standing and unfortunate hallmark of IT inefficiency, poor results, and failed project implementation...

                            Steve Naidamast Black Falcon Software, Inc. blackfalconsoftware@ix.netcom.com

                            1 Reply Last reply
                            0
                            • M Marc Clifton

                              I take care to ensure the aesthetics of my code. That spacing and formatting is consistent. I don't care if I'm writing throw away code or production code. The code should always look neat and tidy. Why don't other programmers do the same??? OK, I'm sure there are some out there. And yes, there are code beautifiers, so who really cares, right? What's your thoughts on whether code should look good, in terms of spacing, formatting, structure, etc.? Marc

                              Thyme In The Country Interacx My Blog

                              Z Offline
                              Z Offline
                              Zhat
                              wrote on last edited by
                              #75

                              Raises Hand I've been know to reformat entire pages of code, and totally forget why I was there in the first place...

                              1 Reply Last reply
                              0
                              • W WilliamFalconerUK

                                Thanks very much for taking the time on this post, it's given me a lot of food for thought! We have a wiki in our department, but this is not being used for standards(at least as far as I know!), so this may be a good place to start. I'll take on board what you've said and think about what the next step is. You mentioned a cultural shift, there are several things here that need to be shifted culturally here (IMO) and the above is just one of those.. there are loads of other things also need to be looked at, but I won't moan about those! Cheers,

                                Billy. MCPD Windows Developer "Duct tape is like the force, it has a light side, a dark side and it holds the universe together!" - Anonymous my holding page..more coming soon!

                                S Offline
                                S Offline
                                shubumpkin
                                wrote on last edited by
                                #76

                                Hi Billy, No problem at all. This is an interesting and sometimes frustrating topic. It requires large amounts of energy and you need management buy in. Sometimes training courses can inspire change. Alternatively start your own company with your own culture! One of the reasons Toyota is so successful is because they pay so much attention to their company culture. Plus processes and standards are not used appropriately in many organisations, where they become stuffy, and inflexible and even seems to inhibit work. On the other hand if used appropriately they can act as steps on the stairway to perfection. You end up getting so ahead of your competitors that their is oceans between you. As is the case with Toyota. If you find this all interesting i would recommend reading the E-Myth by Micheal Gerber (or the audio book) and/or the Toyota way, this is especially useful if you are considering starting your own business.

                                Steve O'Brien A successful person isn't necessarily better than her less successful peers at solving problems; her pattern-recognition facilities have just learned what problems are worth solving. - Ray Kurzweil www.newicon.net

                                1 Reply Last reply
                                0
                                • G geoffs

                                  Do any of your developers ever find there to be a need to print sections of code? That is still a pretty good lowest common denominator (80 cols for readability on an 8.5 x 11 page) which makes me hesitate to accept anything greater than 80 columns width in the code.

                                  S Offline
                                  S Offline
                                  stephen hazel
                                  wrote on last edited by
                                  #77

                                  I'm a firm believer in the 80 column limit myself (I, too, am a code nazi). But pick a different font and you can easily print 120 columns on even the crappiest of printers. Consolas is your friend.

                                  G 1 Reply Last reply
                                  0
                                  • M Marc Clifton

                                    Hans Dietrich wrote:

                                    to them it's a job, and a clean compile is the best you can expect from them.

                                    That pretty much sums it up. Sadly, a clean compile doesn't mean a bug free execution. "Your code looks like shit, and by the way, I can spot 5 logic errors just by looking at the code". That's what I seem to be saying a lot lately. :sigh: Marc

                                    Thyme In The Country Interacx My Blog

                                    S Offline
                                    S Offline
                                    stephen hazel
                                    wrote on last edited by
                                    #78

                                    And if the code was CLEAN, you could spot 5 -more- logic problems...

                                    1 Reply Last reply
                                    0
                                    • S Scott Dorman

                                      geoffs wrote:

                                      knowing that just because I think a particular guideline is good doesn't necessarily mean it really is

                                      That's an excellent start. It's important that your standards are a result of quality input from the rest of the team and not designed in a vacuum.

                                      geoffs wrote:

                                      point me in the direction of what you would consider some decent coding standard documents...

                                      I can, but a lot of it depends on your chosen programming language. I really like the Framework Design Guidelines book. It is focused on .NET and designing public facing APIs but at least 90% of the guidelines specified apply to any language. The other one (although more for a really solid reference and background information) is the Ada 95 Quality and Style Guide. (If you can't find it, email me directly from CP and I can email it to you.) From one of my talks on this: What is a code standard?

                                      • Encompasses all aspects of code construction
                                      • Designed to improve program adaptation and maintenance
                                      • Do not form an inflexible set of standards
                                      • Consistent
                                      • Is not “one size fits all” – different for different languages
                                      • Defines the “best practices” for writing code for your development group
                                      • Must adapt to changes in technology and language

                                      What is a code standard?

                                      • Source Code Presentation (Code Formatting)
                                      • Readability
                                      • Program Structure
                                      • Programming Practices
                                      • Concurrency
                                      • Portability/Interoperability
                                      • Reusability
                                      • Performance
                                      • Globalization

                                      The rest of the slide deck (it's short but a lot of the slides have speaker notes) is available on my blog if you want to browse through it. Also, if you're ever in the Florida area (or any of the east coast southern states) I present at a lot of the code camps and usually have a round-table discussion on this topic.

                                      Scott Dorman

                                      Microsoft® MVP - Visual C# | MCPD President - Tampa Bay IASA [Blog][Articles][Forum Guidelines]


                                      Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buc

                                      G Offline
                                      G Offline
                                      geoffs
                                      wrote on last edited by
                                      #79

                                      Hi Scott - thanks for the reply and the information. I forgot to include the info about the languages we use at my location. We are mostly a C++ development group, with some C. The targets are 95% embedded environments (non-Windows) but with some Windows application work for tools (the latter also perhaps using .Net and perhaps C#). That collection of languages and environments will obviously imply their own set of guidelines, yet many coding standard guidelines also crossover the language and environment boundaries. It looks like you have put quite a bit of time into exploring these issues and I'd like to gain from your efforts. I'll be emailing you to discuss this further. I appreciate your help. I am located in the Pacific Northwest and don't make it to Florida too often, although periodically I may head over to Orlando where we also have a satellite development group and also to West Palm Beach (family). Next time I am out I may have to look you up...

                                      S 1 Reply Last reply
                                      0
                                      • I Igor Velikorossov

                                        If I may I add my 2c I would normally strongly encourage to have all personnel involved in development familiarised with Microsoft .NET Framework Design Guidelines. These guidelines set out naming conventions, file organisation and many other rules making the code readable and easy to maintain. There are number of resources worth reading, such as follows: 1. published by Brad Adams (founding member of both the Common Language Runtime, and .NET Framework teams) a) Microsoft Internal Coding Guidelines[^] - a good start and something I do follow myself. b) plenty of other guidelines[^] worth checking out in a free time 2. Design Guidelines for Class Library Developers on MSDN[^] 3. every now and then Krzysztof Cwalina's blog[^] is a good read too (at least it used to be) Secondly I would strongly encourage the code documentation. Whilst I do perfectly understand that documenting the code has been the bane of all programmers since the day 1 (and I also suffer from it), I believe it is imperative to write documentation. The main rule - explain NOT WHAT the code does but WHY you've written it this way. Again I would strongly encourage to make a habit of documenting (at least) all publicly exposed objects (types, classes, methods, properties etc) using XML documentation. A good start: here[^] and here[^] Because I work with .NET all of the above mainly applies to .NET stuff, yet it could still make sense for those working with other languages/technologies.

                                        G Offline
                                        G Offline
                                        geoffs
                                        wrote on last edited by
                                        #80

                                        Igor - thank you for all of the resources mentioned. They will be helpful for me as I guide this committee towards a site-wide standard. Code documentation is one of the subjects very near to my heart. I am adamant about the commitment to providing it but have so far been having difficulty getting others to sign on to taking the time to do it. Some of that problem is a result of pressure from the management to get results out the door with an unrealistic scheduling, thereby pressuring the developers to feel that they must just get the logic implemented with the compromise being no time for documenting (very short-sighted but when you are between a rock and a hard place...). Happily, with some changes in management over the last year, that situation is quickly getting rectified. Personally, I always document the code. I have been using Doxygen for doing so. While not perfect, it is still pretty good. In the end, it might be necessary to have a code nazi to police the code before it gets integrated into the main development branches. The term itself sounds awful, but some people have problems conforming regardless. BTW, we do have code reviews which are helpful in the enforcement process.

                                        1 Reply Last reply
                                        0
                                        • W WilliamFalconerUK

                                          Scott Dorman wrote: Code standards/style is one of those spaces I actually like to play in and have established them at several of the companies I've worked for.

                                          I'm currently working for a company where coding standards are talked about but there has been no agreement on a definitive guideline. The result of this being that each person has their own way of doing things, leading to the problem that the code can be difficult to understand and maintain. It also appears that theres resistance to any move to try to standardise, the reason being that the people involved have their own opinions so we get nowhere further with the discussion. Another excuse given is theres "no time" to sort things like this out. The Question I've got for you is this; when you have implemented such standards in existing development teams, what kind of hurdles have you encountered? and how did you manage to overcome them? I'd like to see if theres an approach that could be taken to get a bunch of developers (and their managers) who are set in their own ways to agree the standard and stick to them (not that I'm in a position currently to push for this, but who knows!) Also, reaching an consensus on the standard vs someone taking responsiblity of the standards, which of these might be a better approach? Any thoughts from anyone on this are appreciated.

                                          Billy. "Duct tape is like the force, it has a light side, a dark side and it holds the universe together!" - Anonymous my holding page..more coming soon!

                                          D Offline
                                          D Offline
                                          dilton_dalton
                                          wrote on last edited by
                                          #81

                                          I'm currently working for a company where coding standards are talked about but there has been no agreement on a definitive guideline. The result of this being that each person has their own way of doing things, leading to the problem that the code can be difficult to understand and maintain. It also appears that theres resistance to any move to try to standardise, the reason being that the people involved have their own opinions so we get nowhere further with the discussion. Another excuse given is theres "no time" to sort things like this out." This is rule by committee (aka mob). Do these people also come and go any time and any day they feel like it or are there core hours for people to be at work? If there are core hours, who set them? The answer is Management. You know: the guys that run the company. Obviously a standard should not be rammed down the throats of the workers but if all else fails, then management has to say, "This is our new coding standard. Follow it." The establishment of a standard doesn't mean it will be followed. That has be be done through the code review process which I assume is part of you development process. Reviewers should not accept code that does not conform to the standard. Peer pressure is a good tool for standards compliance. A coding standard is not a static thing. So start with a standard that doesn't cause too much backlash and then grow it. Basic hygiene issues make a good starting point. If you are using C++, rules against using some of the more dangerous C compatability features are candidates. Basic formatting and naming conventions are candidates. Things that cause problems are candidates for a new entry in the standard. There are lots of coding standards on the Internet so pick one you like, modify it to suit your situation and propose it to management. If that doesn't work, then sedition may. In every organization there is a developer that is looked up to by nearly everyone. Recruit him/her. If he/she starts to use the standard that you produced (with perhaps a few changes) in his/her own work and as a guide for code reviews then its use is likely to spread. Again, peer pressure is a good tool to promote compliance. The first objective of a coding standard is to make all the code look like it came from the same company. The second is to make it easier to read and modify. You can't build a perfect system out of defective parts. But you can keep the testers busy.

                                          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