good programming practice

OogyWaWa

Senior member
Jan 20, 2009
623
0
71
i can program, a bit, but i'm not afraid to admit that i doubt i have very good programming practices. obviously there are things like good comments, clean code, good documentation (if needed), version control, etc. but, i've never been formally taught these things and i'm curious as to where i should start.

basically i just want to develop proper practices and learn about how complex programs are developed in teams and what not.

anyone know of some good guides/videos? also, any links to some simplistic projects with easy to understand source code would be helpful.

also, i'm interested in getting in on some kind of development team to get some hands on with this. obviously it can't be any too complex like OS, audio software, etc. any help in this department would also be appreciated :)
 

tatteredpotato

Diamond Member
Jul 23, 2006
3,934
0
76
You might just want to start poking around some open source project and trying to get involved. Talk with the guys active with it and let them know about your capabilities and see if they have somewhere for you to fit in.
 

OogyWaWa

Senior member
Jan 20, 2009
623
0
71
Originally posted by: ObscureCaucasian
You might just want to start poking around some open source project and trying to get involved. Talk with the guys active with it and let them know about your capabilities and see if they have somewhere for you to fit in.

any ideas on some more simplistic projects? i'm thinking i might be able to help code a plugin or some small insignificant portion of a larger project... doubt I could help with anything too complex :p
 

tatteredpotato

Diamond Member
Jul 23, 2006
3,934
0
76

Kirby

Lifer
Apr 10, 2006
12,028
2
0
Originally posted by: ObscureCaucasian
Originally posted by: degibson
One thing you can do is follow a style guide. Personally, I follow this one as close as I can:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml

You can find a lot more here:
http://www.chris-lott.org/resources/cstyle/

One thing I'm not clear on is they discourage, if I interpret correctly, a statement like

using namespace std;

So what is the "correct" way of doing this... at least according to google?

std::cout<<"Like this perhaps?";
 

degibson

Golden Member
Mar 21, 2008
1,389
0
0
Originally posted by: nkgreen
Originally posted by: ObscureCaucasian
Originally posted by: degibson
One thing you can do is follow a style guide. Personally, I follow this one as close as I can:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml

You can find a lot more here:
http://www.chris-lott.org/resources/cstyle/

One thing I'm not clear on is they discourage, if I interpret correctly, a statement like

using namespace std;

So what is the "correct" way of doing this... at least according to google?

std::cout<<"Like this perhaps?";

This happens to be one thing Google and I disagree on.
using namespace ftw;
 

Cogman

Lifer
Sep 19, 2000
10,286
147
106
Originally posted by: ObscureCaucasian
Originally posted by: degibson
One thing you can do is follow a style guide. Personally, I follow this one as close as I can:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml

You can find a lot more here:
http://www.chris-lott.org/resources/cstyle/

One thing I'm not clear on is they discourage, if I interpret correctly, a statement like

using namespace std;

So what is the "correct" way of doing this... at least according to google?

I think it depends on where the namespace is declared. For example, I'm completely opposed to putting a using namespace declaration in a header file. It almost completely destroys the reason for having namespaces in the first place. However, at a more local level, I see no problem with using the using namespace declaration.
 

slugg

Diamond Member
Feb 17, 2002
4,723
80
91
What you need is a good software engineering book. Style guides are just helpful for actually programming. On huge projects, you actually spend a lot less time programming than anything else. Most of the time is spent on design and documentation, which have little to nothing to do with the programming language being used.

There are many aspects to an ideal software project. There's definitely too many for me to list here in this post... But I will say that the one that REALLY stuck with me is that all software must be designed FOR TESTING. Every unit of software must be testable, complete with a test plan and even in-house testing tools. Robust, fault tolerant, and error-correcting code is also a big one.

I highly recommend this book. Sure it's a bit expensive, but you'll really open your eyes to a LOT. It's totally worth the 50 bucks!
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
How much "process" is appropriate depends on the size of the project and the size of the team.

With a small project and 1-2 people you might just need WiinZip as your version control system.

With a small team and rapid / iterative development doubling or tripling your development time to make every bit of code testable may not be practical.

As projects and teams get larger, better version control and automated testing pay off more and more, as does enforced coding styles so anyone can easily read anyone else's code.
 
Oct 27, 2007
17,009
5
0
Two words: Code Complete

This is the definitive book on best practices and it will make you a better programmer. Absolutely highly recommended, one of the best programming books I've read.
 

JACKDRUID

Senior member
Nov 28, 2007
729
0
0
teach yourself oop

create body part objects, then put it together as a human.

good little project.
 

chronodekar

Senior member
Nov 2, 2008
721
1
0
Originally posted by: slugg
But I will say that the one that REALLY stuck with me is that all software must be designed FOR TESTING. Every unit of software must be testable, complete with a test plan and even in-house testing tools. Robust, fault tolerant, and error-correcting code is also a big one.

I vouch for this methodology. You have no idea how many projects I've been involved in that got delayed just because of this issue !!