@
RealGiganitris
Hi, my 1 groat worth :+)
Apart from the excellent link
JLBorges provided:
Perhaps you could do some rubber-duck debugging for your problem: Post some code which you think is really bad; tell us what you don't like about it.
I know that is small scale (there are lots of bigger issues like the interface for example), but it could be helpful nonetheless.
Perhaps one concept of understanding might be that code should be
reasonably understandable by someone who has a decent grasp of science and mathematics. For example, if someone is doing something involving a lot of math, provide links to the documentation in the code as comments, paste formulae into comments, provide comments about what C++ functions do. Imagine looking at code which implements the math in chapter 5 of this document, without those things:
http://www.icsm.gov.au/gda/gda-v_2.4.pdf It's all very well to translate code into a math formulae - but what does it mean, and why? Note that is all independent of the person reading the code having great ability and knowledge of C++, or their very high level of education. It would be embarrassing for whoever wrote the code, to have someone of great ability looking at it and thinking: what the? If they are having trouble how are the rest of us going to fare?
That part about
why is important - there may be several ways of doing something -
why is it being done this way? Someone else might have a better way.
I quite often post a link to one of
Norm Gunderson 's excellent posts, which shows in a comical way how using meaningful names can make the code read like telling a story of what is happening :
http://www.cplusplus.com/forum/lounge/176684/#msg872881 Again, that is small scale - but still helpful.
Regards :+)
Edit: I should say that obviously one doesn't want to go too far with this: don't turn the code into some kind of tutorial - just give the reader a reasonable chance of being able to comprehend it.