I've always felt that teaching 'don't do that, cause it's bad' sticks rather poorly - unless something that obviously dangerous is involved, making your own mistakes is much more educational than memorizing a set of best practices and never even peeking into those blind alleys or pitfalls. You can do that and have good habits, but you'll have a dogmatic rather than a fundamental grasp of the knowledge, and this will constrict further development.
It would be nice to provide links to articles and books on why one should use snprintf instead of sprintf or what is integer overflow and how do you deal with it and other topics for writing secure code.
However, as a beginner, it will simply not register since I'm more worried about having used a period instead of an arrow to access a struct member.
Perhaps, instead of writing a beginner C book, an advanced C book is needed more.
Might as well put Lance Armstrong on a bicycle in front of a 5 year old and expect them to learn how to ride a bicycle by watching Lance go in a circle.
I can reinforce each lesson/problem you're describing one by one through the exercises, but a new person simply wouldn't know good code if it slapped them in the face.
Confer with Learn Python the Hard Way to get a feel for the aesthetic and technique I'm working towards.
I don't want to write bulletproof code, I want to teach them how and why to write bulletproof code.
I'm not qualified to meet that kind of lofty standard anyway.
I can reinforce each lesson/problem you're describing one by one through the exercises, but a new person simply wouldn't know good code if it slapped them in the face.
that is my point: your readers might not understand everything you're doing, so they're just going to copy and paste parts of it into their new projects. if you give them sloppy code to learn from, they're going to copy that sloppiness into their code that makes its way into the real world.
there are a lot of things in c that new programmers have to be especially careful about that aren't relevant to python.
Retracted.
This confuses me. How can you teach someone to do something if you won't do it yourself? Reading your statement literally, you are effectively going to say, "This is how and why to write bulletproof code, but I'm not going to." The whole point of LxTHW is to learn by doing. If you're doing it wrong, they're learning it wrong.
> I'm not qualified to meet that kind of lofty standard anyway.
Then you shouldn't write the book. Honestly. I know you intend to do some good and to be productive, but serving as a teacher and a reference point in an area that you're not qualified in is actually counterproductive.
I'm not saying don't write the book. Get qualified first.
Further, the aim is to teach people how and why to write bulletproof code, not to demonstrate bulletproof CString tutorials.
No such thing as a perfect program, startup, relationship, or book.
Not being perfect is not the same as going in the wrong direction.
if there are any buffer overflows, integer overflows, off-by-one's, signedness issues, failure to check return values of everything, use of typically insecure things like sprintf instead of snprintf, all of these problems will just carry over into your readers' code. please do us all a favor and stress the importance of writing secure code from the ground up and not as an afterthought or something only done just before releasing it.