Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I've worked with a number of professional teams and it seems that class code structure ranges from highly organized to completely cluttered. I did a project with the State of California recently and they required using specific Regions in my VB code, along with inline XML comments for auto-docs. It was very structured, but in many classes, there was more commenting than code. I'm just curious if there is an industry standard for code structure and commenting.

EDIT

Maybe a more appropriate question would be, what are some good practices to adopt for readability and maintenance and why? I want to set good coding habits early.

share|improve this question
    
consistency is more important than any certain style –  ratchet freak Oct 28 '11 at 20:20

1 Answer 1

up vote 4 down vote accepted

There are no standards that exist across all industries that govern code structure. I would doubt that any industry has industry-wide coding standards that deal with comments, file structure, and project organization.

The closest thing that you might find would be MISRA C, which are guidelines produced by the Motor Industry Software Reliability Association to ensure safe, portable, and reliable code in code that runs in the embedded systems in cars. However, as I don't work in the automotive industry, I've never had to deal with this.

Typically, code structure and guidelines are done at the organizational or project level, not across organizations or within industries. If you want examples of how to write good, clean, readable code, I suggest looking at Steve McConnell's Code Complete, Andy Hunt and Dave Thomas's The Pragmatic Programmer, Diomidis Spinellis's Code Quality: The Open Source Perspective, and Robert "Uncle Bob" Martin's Clean Code: A Handbook of Agile Software Craftsmanship - these are the canonical books on how to write the best code you can, regardless of language or platform. Many languages also have style guidelines, such as Oracle's Code Conventions for the Java Programming Language, which can serve as a foundation for an organization or project's code style rules.

share|improve this answer
    
What are some good practices you've found and why? I'm trying to set some good habits for easy code management and readability, but I don't know what is excessive and what is productive. –  Ken Anderson Oct 28 '11 at 17:45
1  
@KenAnderson I just updated my question with some links. Unfortunately, there's no one-size-fits-all answer. It's often up to the project team to decide how to best solve the problem. –  Thomas Owens Oct 28 '11 at 17:50
    
Also Clean Code by Uncle Bob. –  Eric Wilson Oct 28 '11 at 17:53
    
@Thomas Thank you...that is exactly the direction I was looking for. Many of those books available on the Army's eLearning platform for free. I'm definitely checking them out. –  Ken Anderson Oct 28 '11 at 17:53
    
@EricWilson I've never read Clean Code, but I've heard other people recommend it. I'll add it as well. –  Thomas Owens Oct 28 '11 at 17:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.