

Global Variables Considered - fogus
http://www.cs.uni.edu/~wallingf/blog/archives/monthly/2011-03.html#e2011-03-29T20_13_25.htm

======
ggchappell
There is a side to this particular issue that the writer does not touch on:
the _pedagogical_ side.

When I read this article, I find myself wanting to know something: was the
student _told_ not to use global variables? If so, then the answer to why the
grade was reduced, is easy: the student did not follow instructions.

Not long ago, I spent a number of years teaching a 4th-semester university
programming class. I required my students to follow a _relatively_ detailed
(for a class, anyway) set of coding standards. These standards were not
necessarily the best they could have been; however, I made no apology for
them, because I was trying to help my students learn to build software within
externally imposed constraints.

After all, anyone who works on a sizable software project -- other than the
person running the project -- will almost certainly have to adhere to
standards they did not write. There is a good chance that some of these will
be standards they are not fond of. That's just the way large projects are. And
giving students practice in dealing with this, is, I think, a good goal for a
software development curriculum to have.

So, is it reasonable to downgrade a student's work severely for including a
global variable? That's debatable. But it is _definitely_ reasonable to
downgrade for blatant failure to follow instructions. Furthermore, "use no
global variables" is, if not the best rule in the world, certainly not a
terribly unreasonable one.

