At the college I attend, there is a new computer science teacher who seems not to be as knowledgable as one would expect. She has stated that, prior to joining the faculty, she worked for many years as a computer security consultant and Google. However, many of the techniques she is teaching/advocating are...questionable, to say the least.
The first issue is the way she wants the console window to stay open upon completion of the program assignments (we are using VS 2010): system("pause").
For one assignment, I used cin.ignore(numeric_limits<streamsize>::max(),'\n'),
and she about had a stroke. She deducted a whole letter grade from my assignment grade and scolded me for "not using system("pause"), which is the proper way people keep console windows open."
Beyond her unholy passion for system(), she does not teach in her programming classes; rather, she directs students to thenewboston.com for lessons. (She teaches Java and C++ at my college, so maybe she sees this a one-stop shop for programming tutorials?) I don't mind this so much, because I picked up "C++ Primer Plus" over Winter Break and have been reading that and checking cplusplus.com whenever I had a question or needed confirmation about something, but it's still disconcerting.
The final thing that's troubling me is a conversation I overheard today as I was leaving class: she was telling another student that she had almost entered her credit card info to buy an antivirus program because windows kept opening on her desktop prompting her to buy it. (Okay, this last one may not be an actual problem - I only heard a small part of the whole conversation - but are there any antivirus programs that constantly prompt for credit card info, even when one closes the first such prompt? From what I heard, it sounded like scareware.) I would think that, as a supposed former "computer security consultant," she would know about such widespread scams.
Maybe I'm overreacting and she's still settling in to her new job? Should I tell the division Dean my concerns, just so that someone in authority is aware of the possiblility that something's up? Or should I just leave it alone?
I suppose that 3 implicit questions are also raised:
1) Does system("pause") have any legitimately useful purposes in real world applications?
2) thenewboston.com, good teaching tool or not?
3) antivirus that spam prompts for cc info are never legit, nicht wahr?
In my experience in the collegiate world some teachers differ very greatly from others, and the good ones are easy to tell apart from the bad. It seems to me that you've stumbled across someone who's very closely straddling the line between the two.
Personally, I would go and ask the dean for advice, or better yet, perhaps the instructor herself if she can explain her logic behind using "system" instead of the command that you used, I honestly can't say as I'm just learning as well. At least this way you don't get on the teachers bad side.
However, her behavior is ringing some personal alarm bells. There are a few things that I learned while I was attending college.
1. As a paying student, at the very least, you represent their employer.
It is the burden of the instructor to be as clear as possible when making a point, and why they feel as strongly as they do. And while you don't need to get all high and mighty, and lord it over them, if you ask "Why?" and they respond "Because I said so" doesn't have to cut it. Unless there is a legitimate reason for doing so, they're in the wrong.
2. If you ask her and it doesn't go well, I'd go to the dean or perhaps ask some fellow students or another instructor.
Just tell her everything that she wants to hear until you get out of it what you want. that sounds like bad relationship advice, doesn't it?
While it may be true that your instructor isn't as qualified as you'd like, they still hold your grade in their hands, and I'm assuming that you don't want to pay the extra tuition to retake the class, so if I were you, I wouldn't prod her the wrong way. From what you've posted thus far, I'll assume that you know more C++ than the class will teach you, so my advice is to stick it out, get your A+, and then voice any concerns that you might have to the higher-ups.
* In my college level experience, some instructors can hold a serious grudge.
Just tell her everything that she wants to hear until you get out of it what you want.
that sounds like bad relationship advice, doesn't it?
This is by far the funniest thing I have read/heard all day. Thank you.
And yes, I do know some C++ already; however, I'm still shaky on the STL and MI and other "heavy" stuff. I had planned on taking these courses to get a better understanding of these things, but the past 3 weeks have made me wary. Your idea does make a lot of sense. I think I'll just wait until the semester is over, and if it still seems like it's a problem, I'll voice my concerns to the dean.
@L B: what do you mean by "undefined" for your answer to the second question?
I taught CS in college ten years ago, and I endorse Luc Lieber and roberts. Stick it out. Tell the teacher what she wants to hear. Show that you paid attention to her, rather than textbooks or professionals. Report incompetence when it's no longer affecting you.
I was in a very similar situation last spring, I wasn't as cool headed or mature about it as you are and I definitely didn't ask for anyone's advice before going to class each day specifically to correct her in front of her students.
In the end no harm came from it, but it was a very bad move on my part.
That's why I'm glad we don't have programming classes at school - they just teach language agnostic stuff there, and expect us to learn programming ourselves. May not be ideal for people without prior knowledge, but at least it keeps situations like that away (our programming assignments if we have any usually work on a "if it works, fine, if not - screw you"-policy).
It may just be that She doesn't want to deal with a myriad of different way to stop a console window closing when it is an unimportant thing. If you ask me you should not be putting any code in your program to stop the console close/ hold up your program when it finishes.
Is it fair that she dropped your marks because you did something different? If she said that she wants it doing one way and you do it a different way then yes. You have not done what was asked.
I've never really used system("pause"), but I imagine it's closer to sleep() than to cin.ignore(), isn't it? She could very well be automatically testing them by some external code that launches each student's work one by one. Using cin.ignore() will force her to stick around and press a button. [Then again, why bother pausing?]
Rather than doing it your way and/or complaining, ask for an explanation. If she has her reasons, it'll help you understand, even if you don't agree. If she "says so", then you know she's an idiot. Either case, you should back off. Insisting in case 1 makes you an arrogant prick, insisting in case 2 is useless and will probably get you in more trouble than it's worth.
Whatever you do, do not go above her [unless you have irrefutable proof that she's incompetent, which you probably will never have]. Her boss will side with her (as he should; in 99,9% of cases, complaining (parents of) students are idiots) and you'll get on his/her bad side as well.
Rather than doing it your way and/or complaining, ask for an explanation. If she has her reasons, it'll help you understand, even if you don't agree.
The teacher has us email our assignment solutions to her email, and we attach the .cpp file and a screenshot of the running program. She has us use system("pause") to keep the console open so that we can take the screenshot. Since cin.ignore() and system() have the same effect in this situation, I thought it really wouldn't matter which one I used.
I'm not one to cause unneccessary drama, so I don't intend to "call her out" about any of this. That's why I created this thread; to get some unbiased input on what I should do. Almost all the posts say the same thing: just let it go. So I'm going to take that advice and just get through the semester.
I've never really used system("pause"), but I imagine it's closer to sleep() than to cin.ignore(), isn't it?
No, the system() function runs the program you tell it (in this case, the Windows "pause" command); either in the current working directory, the directory that your executable is in, or any other directory in the system path variable. The pause command on Windows prints the message "Press any key to continue . . ." and then waits until the user presses a key. There is no "pause" command on other platforms (except DOS and OS/2 and maybe some esoteric OSes) so not only is it slow and a security risk (since if there's a "pause.exe" in the working directory or in the same directory as the executable, it will be run instead of the one in the system path), but it's also
Though I agree with Grey Wolf that you ideally wouldn't put anything to hold the console open, if you're going to, it's best to do something like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
class KeepConsoleOpen {
public:
~KeepConsoleOpen()
{
std::cout << "Press ENTER to continue..." << std::endl;
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
}
};
int main()
{
KeepConsoleOpen kco;
return 0;
}
This way, even if there is an exception, the console will always stay open because the destructor for 'kco' has to run before the program exits.
If you really wanted to, you could figure out a way of storing the CPU's instruction counter so that the program would always return to the last instruction when an exception occurred.
Even if your professor is using an automated system to test your programs -- which is, frankly, not feasible unless given very specifically detailed prompt-response instructions -- unless she decided to use the letter 'a' instead of ENTER to respond the the "Press any key" prompt -- which would be even more disconcerting, to say the least -- there should be no difference in how the program runs against the automated test.
Personally, I agree that you will probably get less trouble if you keep your head down.
However, I think it is worth your time to mention your concerns to the department chair. Losing a whole grade point for not using system( "pause" ); is not correct, no matter how you look at it. If your professor pretends to conform to University grading criteria, she cannot do that without at least first warning you against it.
If I were teaching a basic C++ course, I would tell students they will loose grade for using system() at all, outside of specific instruction otherwise.
Do what your professor asks, but don't stand idly by. Bring up the irregularities to the department chair. Be tactful: make sure to mention that you have read some damning information about using system() like that, and you don't feel it was fair to lose a grade point over it, and that you will take it, but you are concerned about this kind of treatment without being able to have a dialogue with and redress from the professor.
@chrisname
While I like the idea a lot, it unfortunately assumes something about the state of the input stream. The constructor cannot assume anything, and must recur to something platform-specific to overcome blocking input or clear the input to really hold the console open.
it unfortunately assumes something about the state of the input stream. The constructor cannot assume anything, and must recur to something platform-specific to overcome blocking input or clear the input to really hold the console open.
@ne555,
Thanks for the correction. Usually I have a catch-all exception handler in main() as well. I guess the purpose of that hack is only to keep it open when the user closes the program themselves, or when it naturally reaches the end of main().
Destructors are not called when you close the console window by any means. This is why you get memory leaks from closing programs that allocate a lot of memory before they can deallocate it.
AFAIK, on any modern OS, a program can only leak memory during its lifetime. Once the program exits or is killed, the OS marks all of its memory as unused, so anything that wasn't deleted manually gets deleted anyway*.
This is just hearsay, but apparently gcc removes calls to free() (or delete, which calls free()) that occur just before the program exits, because it knows the operating system will do it automatically (so it's a waste of time). Unfortunately, that can throw off programs like Valgrind which check for memory leaks.
* this is not an invitation to allocate memory without freeing it; unless you can find one with a garbage collector or something similar, no OS will automatically free memory that a living (for want of a better word) process hasn't explicitly freed itself. Memory leaks can occur while the program is still running.