So I just finished Programming I at school (made 101% if you're intrested), and the biggest complaint my teacher had was about my coding 'style.' Nothing really specific got mentioned just overall. So that made me wonder what is good coding style?
"Style"What is good coding style
Page 1 of 1
8 Replies - 1032 Views - Last Post: 04 May 2008 - 07:34 PM
Replies To: "Style"
#2
Re: "Style"
Posted 01 May 2008 - 10:47 PM
I'm not sure if this is considered "style", but I prefer to indent correctly & comment whenever common sense says I should. It makes it easier for #2pencil (or anyone else) 2 years from now that might need to work on the code again, to actually be able to read the code.
If you have sloppy code, it makes reading your code much much harder.
If you have sloppy code, it makes reading your code much much harder.
#3
Re: "Style"
Posted 01 May 2008 - 11:40 PM
You should ask your instructor. They've actually seen your code, and can explain what they meant specifically.
For me, good coding style largely means fitting in with the team. You do things that help the team, you don't assert your way over the team's way, and so on. Sure, there's room to suggest things to help the team out, but by fitting in, you help others help the product.
For me, good coding style largely means fitting in with the team. You do things that help the team, you don't assert your way over the team's way, and so on. Sure, there's room to suggest things to help the team out, but by fitting in, you help others help the product.
#4
Re: "Style"
Posted 02 May 2008 - 03:06 AM
i just find indenting the code and giving each part a title (by comment) so that later on if i have to do anything to it, it is easy to find what i am looking for.
#5
Re: "Style"
Posted 02 May 2008 - 04:10 AM
Everyone has an opinion of which styles are best, but good programming style is universal: consistency. Everything must be consistent. If it's consistent you can tell whats happening from one point to the next, even if you don't like the style the programmer uses. Another element that's considered universally good; variable names that mean something.
As no2pencil noted, what's fresh and obvious today won't be in the passage of time. If you program so others can at least follow along it will help you greatly when you haven't looked at it for so long that you're the other.
As no2pencil noted, what's fresh and obvious today won't be in the passage of time. If you program so others can at least follow along it will help you greatly when you haven't looked at it for so long that you're the other.
#6
Re: "Style"
Posted 03 May 2008 - 07:44 AM
Just keeping your code well organized; easy to follow; well documented/commented. What is considered good "style" can really depend on the person though.
#7
Re: "Style"
Posted 03 May 2008 - 09:37 AM
JasonMcAuley, on 3 May, 2008 - 07:44 AM, said:
What is considered good "style" can really depend on the person though.
#8
Re: "Style"
Posted 04 May 2008 - 02:23 PM
I agree that style is arbitrary, though my interpretation of good style is code that is as concise as possible and as easy to follow as possible. This can include how you go about solving your problems presented, comments, structure, identifiers, indentation, anything.
Second on no2pencil, if i didn't comment and indent, i couldn't understand my code 2 hours from now (no joke).
BTW: My style sucks, kudos for you (not literally)
PS: for those of you who have seen any of my questions, you see my impossible to follow logic (w/o comments, i can't follow my own logic). Man i'm jealous.
Second on no2pencil, if i didn't comment and indent, i couldn't understand my code 2 hours from now (no joke).
BTW: My style sucks, kudos for you (not literally)
PS: for those of you who have seen any of my questions, you see my impossible to follow logic (w/o comments, i can't follow my own logic). Man i'm jealous.
This post has been edited by polymath: 04 May 2008 - 02:24 PM
#9
Re: "Style"
Posted 04 May 2008 - 07:34 PM
polymath, on 4 May, 2008 - 02:23 PM, said:
I agree that style is arbitrary, though my interpretation of good style is code that is as concise as possible and as easy to follow as possible. This can include how you go about solving your problems presented, comments, structure, identifiers, indentation, anything.
Some teams try to enforce implementation requirements; using anonymous global namespaces instead of statics, for instance; or using exceptions or not. these vague admonitions generally have reasons based on some requirements of the architecture. For example, the memory manager can't handle exceptions, or an analysis tool gets sick when there are too many static variables.
Beyond that, I've never worked on a team that did any real enforcement for implementation rationale. It would be an interesting experiment--it would seem like it wouldn't result in any productivity gain, though, does it?
Page 1 of 1
|
|

New Topic/Question
Reply


MultiQuote







|