4 ms·
I am a firm believer that example code that serves as a reference should illustrate the absolute best practices. "mkdir -p" is the best practice to create a dir
by mrb 10y ago
I am a firm believer that example code that serves as a reference should illustrate the absolute best practices. "mkdir -p" is the best practice to create a dir that may or may not already exist, therefore this is a bad example (you are teaching some devs who don't know "mkdir -p" a bad practice). If you want to demonstrate the file_exists function, pick a better example.
This is the same reason why I dislike, for example, seeing the documentation of a library showing how to perform actions X, Y, and Z, but a footnote says "by the way, there is no error checking in this example". Well then, why use this code as an example?
Anyway, sorry for the rant. ShutIt does seem interesting :)
- zwischenzug 10y agoI know what you mean, but I couldn't think of a better example that would not have involved explaining something else that would have distracted from the point. I wasn't comfortable doing it, but at the same time, couldn't think of anything better. Actually, I have similar problems when teaching - I'm writing a git course at the moment, and it's hard to illustrate concepts in a realistic way without hopelessly artificial repos.
- rickycook 10y agothere's another file_exists for the git directory that seems to be an even more complete example :)