Potentially Ignorant CompSci Professor Making Student's Life Miserable
However, my student is struggling and the nature of the professor's restrictions on how their projects are constructed as well as the strictly outlined structure of the code makes it impossible for them to: 1. Learn to write their code in a structured and safe fashion 2. Write code that doesn't develop subtle behaviors and problems due to a lack of understanding of pointers.
Amongst the sundry other restrictions choking off their ability to complete the coursework in a timely fashion is the inability to ever use global variables. They are outright banned. While I am fully aware of how those can turn ugly, utilizing extern + static properly largely invalidates these problems.
The exact structure of the functions and their arguments, prototypes, and definitions are outlined for the students and deviating from this poorly thought out structure leads to a reduction in grade much like if you were to use global variables.
I'm doing my best to help the student, but I cannot do their homework for them, and I'm having to remedially explain basic C programming concepts like how scanf works as well as how pointers && reference/dereference operators behave.
I sent an email to the professor mentioned above (with my name censored, as much as I trust you guys), and I'm including it below. Please do not castigate me over the email, I know it's likely inflammatory, but I spent from 8 pm to 6 am last night trying to give a crash course in C to a distressed and confused student who couldn't put together the homework assignment in a fashion that didn't develop bugs, or otherwise not function outright.
I'd like your guys thoughts, and if anyone wants more information I can provide it as I'll be eyeballing the comments.
BEGIN EMAIL
Hello, my name is C A and I'm tutoring one of your students who is taking a C Programming (200 something) class under you. The project that was due today (Wednesday), named Project 3, brought to my attention some concerns I had.
On the slightly more trivial side: While I've seen professors require that the code be no more 80 columns wide (fairly reasonable request since a lot of people still use vi/vim or pico/nano for code editing), Your request that the indentation be made out of spaces rather than proper tab characters was baffling. Not only does this break indentation control in a wide variety of IDEs and editors, it makes the indentation non-trivially mutable and otherwise static.
If it's your desire that the code have a certain appearance, I'm certain that whatever environment you observe code in is capable of setting the tab character size to any arbitrary size you prefer. As the case may be, 4 spaces if you like.
And then on the more serious side: You de facto disallow all use of global variables. I will for the sake of clarity assume that this means no use of extern to access external variables as well. This particular requirement (on penalty of a reduction in grade) left me quite speechless. Have you ever read K&R C? The very people behind the creation of C and Unix made use of global variables at will whenever it was appropriate, while using static for scope control.
My mention of static here is critical. If it's your concern that global variables can make a multi-file project develop unpredictable behavior, then I would point out static variables.
Your ban of global variables forces the students to (ab)use passing locals by reference and turn the program unnecessarily into a pointer filled mess. What compounds this problem is that some of your students are not computer science students and only have the faintest grasp of how pointers, reference/dereference operators and the like behave.
This turns a potentially useful project into a monster that takes a considerable amount of time. I spent from 8 pm until 6 am last night helping the student I've been tutoring
1. Dispel some strange habits that were by and large a cargo cult since they have no rational justification and were only being followed out of ignorance. (Like putting void in the arguments of functions.)
Believe it or not, the compiler has the faculties for understanding that the absence of arguments does truly mean an absence. It's unnecessary and non-standard to put void into the arguments of a function where no other arguments exist.
2. I spent a considerable amount of time developing analogies to assist in explaining how pointers, the reference operator, and the dereference operator affect variable behavior and data access. Said student didn't even grasp how scanf worked, they were just copying code that they saw you put up.
You're creating cargo cult programmers, regardless of intended vocation, this is not a means of educating or training people in the craft of programming. They're following patterns and copying code they barely understand the function of. What worsens this matter is that C is the first programming language said student has ever encountered.
Whilst I first became serious about programming while learning C, it's hardly an optimal choice given the alternatives available. (Utilizing the pseudo-code wonder Python would be a rather flexible and engaging choice.)
The concerns I would have about using C as a first programming language for teaching someone are brought to full fruition in the current situation with the abundant confusion regarding pointer variables and in the ignorance of how the library functions work.
This part exacerbates the problems above, you define very strictly the layout and structure of the code by outlining the functions and arguments they are to have. This is obscene. This brings the cargo cult to an immeasurable extremity. There is no rational justification that I can muster this that doesn't somehow imply that the students would be incapable of constructing a good program without following this particular structure you've laid out.
You also, for reasons that are unjustifiable, you don't allow breaks or continues, which turns flow control into a painful and far more complex matter than is necessary. My only guess here is that you took Edsger Dijkstra far FAR too literally. I recommend reading Knuth's essay on GOTO as well as noting the use of breaks and continues in production-grade code in the Linux Kernel.
In the case of project 3, we see that you've forced them to create a function called getInput() which calls out to three other functions. There is no reason for this function to exist and all it does is further complicate passing the local variables by reference for the students. Was it really worth eliminating two lines of code in order to make your students' lives that much more painful? Really?
The abuse of passing by reference turns code that could've been elegant, simple, stable, and predictable into a cumbersome and brittle bastard that has run-time crashes due to bad pointer manipulation.
This is a 150-350 LOC project. And it has run-time errors. I've written similarly complex x86 assembly with fewer problems than what your student suffers from under your restrictions.
There remain only a few possibilities to my mind, save any information I'm not aware of and absent you taking up the opportunity to let me know why you're subjecting your students to this.
1. You're completely unaware of static/extern, you were taught long ago that global vars are evil, and like the cargo cult you've inculcating in your students, you accepted it blindly. The evil of what you were taught is perpetuating itself.
2. You sincerely hate college students and want everyone to hate the programming, let alone the C programming language.
3. You're some kind of universal evil incarnated in the form of a professor that is antithetical to rational decisions.
4. You've got a hell of a story to tell me.
I look forward to hearing from you so that I may understand where exactly it is you're coming from.
--- C A
P.S. What saddens me most is that the student I am tutoring loves programming and would love to do it as a hobby, but is struggling for various reasons external to their own mental faculties.
END EMAIL
Cheers guys. Also, all hail Erlang. :P