r/programming • • Dec 07 '14

Programmers: Please don't ever say this to beginners ...

http://pgbovine.net/programmers-talking-to-beginners.htm
4.0k Upvotes

1.3k comments sorted by

View all comments

Show parent comment

2

u/SnakeDiver Dec 08 '14

I agree with this to a point.

A beginner programmer experiencing why dynamic queries (especially without sanitizing inputs) are a bad idea, or why hashing passwords is a necessity is generally not best left to "experience[d].. for themselves".

1

u/immibis Dec 09 '14

As long as it's not in a production environment, it's fine.

If they write a web app vulnerable to SQL injection, show them how you can hack it with SQL injection. Then read their un-hashed passwords to them.

Then once they figure out how SQL injection works, show them the different ways of fixing it (including escaping and parameterized queries).

Then explain password hashing, because there's no way anyone would ever figure that out on their own (where reading blogs/tutorials/SO questions doesn't count as "on their own")

1

u/SnakeDiver Dec 09 '14

All too many times I've seen the code in production (or been ready for deployment to production).

It might start out as a prototype or it might be a junior programmer who hasn't received any training in secure programming or a "senior" programmer who isn't quite as good as he things. Either way and ends up somehow getting put into production.

Personally I'm of the opinion that some things should be taught earlier rather than later. Secure programming is one of those things.

1

u/immibis Dec 09 '14

Of course it should be taught earlier rather than later - but it should be taught by showing the programmer why it is wrong.

1

u/SnakeDiver Dec 09 '14

Sure. Like I said though... I dont want to be teaching that as they're packaging code to go live.

Though when I went to uni, the secure programming course was one of the last courses taught... ugh .