Why do college computer science classes promote 'using namespace std'?

633 views Asked by At

I've taken 2 classes on C++ so far, one each at a different school, and both of them have used 'using namespace std;' to teach basic programming. It may be a coincidence but I had to go out of my way to find out it's not a good practice to do so.

2

There are 2 answers

0
utnapistim On

Because best practices when writing sample code are not necessarily best practices when writing large projects.

In a C++ course, you write mainly small programs (up to a few hundred lines of code) that have to solve a relatively small problem. This means little to no focus on future maintenance (and avoiding sources of confusion for future maintainers).

Because many teachers simply do not have coding experience in large projects, the problem doesn't even get acknowledged (let alone discussed) in most C++ courses.

6
Neil Kirk On

Because college computer science professors do not necessarily know how to write good code.