49

My best practice would be to provide students with test cases and require them to submit additional test cases with their code. Then run everyone's test cases against everyone's code. Let the students know that they will get extra credit if their tests break anyone's code. That will put them in a mindset of creating tough tests and writing bullet-proof code, ...


19

Rules like this are generally instituted because the teacher is attempting to teach a concept made moot by one of these constructs. For example, as a teacher, if you're teaching bitwise operators and ask students to implement absolute value, it simply makes no sense to permit the students to use whatever library function does absolute value. You're teaching ...


18

I've always released a number of test cases for the purposes of clarity. I do have to double- and triple-check that my unpublished test cases are nevertheless unambiguously specified in the documentation I provided. However, I am a computer science teacher, not a mystery novelist. It would never occur to me to deduct points for test cases that are not ...


10

TL;DR: If there's no special reason against it, release them before the assignments are done. If you'd like to keep them secret to the students while developing, I would still recommend releasing them after the assignment for the students to help them to evaluate their mistakes. I think whether and when the test cases should be released depends on a few ...


9

Where it stems from is, of course, because the lab is not the thing that the instructors want solved. After all, the lab problem is not an unsolved problem, and it will only be unique (if at all) in some surface way. This is the source of the feeling that people have that the restrictions are unreasonable: they feel like solving the lab is somehow the ...


8

Homework problems in algorithms classes often involve finding clever tricks that the professors find elegant or interesting That seems like a strange way of teaching algorithms. It shouldn't involve trying to make the students recreate brilliant ideas from scratch (most people won't re-invent Dijkstra's algorithm when asked to find the shortest path through ...


6

I had zero experience with algorithms when I started. Here are a couple of things I wish had been done differently. Let Students Make Mistakes My TAs and professors always tried to guide me to the best answer, show me the right "trick", or stop me from making a mistake before I actually made it. Whenever I'm helping someone out with CS now, I usually let ...


6

Actually, life isn't so simple as to choose one or the other here. Code needs to be well structured and it needs to be correct. Given that students are learning, you can't really expect that they will be perfect on either of these and so you need to take both in to account. A program could, be well designed and built but have some, as yet undiscovered, flaw ...


6

Something I wasn't sure about when I was reading your post was if the problem is whether the issue is if students lack motivation or if they lack the ability to succeed in your course. If 30% of your students are consistently failing your course, then I genuinely do have to wonder if the latter is the case. If so, I'm not sure this is a problem you can ...


6

I think that the answer of thesecretmaster is correct but let me add a bit of advice to an instructor who would do this. Just as you, the OP, wonder yourself, the rule doesn't seem to make a lot of sense and it won't make sense to students either. It may cause resentment. So, if an instructor wants to use a rule like this then, I think that a general rule ...


5

Give credit where credit is due. Don't give credit for doing the minimum (handing in on time). Instead deduct credit for being late. They should feel lucky to get anything if they don't get it in on time. Intrinsic Motivation There have been a lot of studies on motivation (most of the ones that I am aware of are industry based, but that is because I spent ...


5

The other answers are already very good, but I wanted to offer another suggestion: Students need to start smaller, and work in smaller increments. To oversimplify: students should start in Pong. Their first homework should be to make a simple change to Pong. You need to make sure every student understood the setup, expectations, and processes involved in ...


5

The only time I would not provide them, is if you are asking the students to derive test cases. You should not be testing to see if they can guess the test cases. Success criteria, should always be made available. Exceptions, have most test cases available to pupils, but have one or two extra, but ensure that there is enough info in the question to derive ...


5

Yes, Absolutely Test cases are necessary to communicate what you expect the student's program to do. Usually, instructors create 3-5 test cases and make at least 2 visible to the students. That way, students know what is expected but can't tailor their solution to just those test cases as they still need to accommodate for the hidden ones. Test cases must ...


4

Test cases are a great tool for students relatively new to the discipline. Since I teach CS50 AP, my students have access to the command-line tool check50, which they can run for nearly all the programs they write at the beginning of the year. For my students who are new to the discipline, this helps them understand the need to read the problem ...


4

Whether this is a good plan or not depends on some things, most especially the nature of your students. However, it seems a bit too unstructured. If you have a general mix of student ability it could cause problems unless you incorporate the questions from the site(s) more formally into your teaching. There are a lot of questions available, I would guess ...


4

I have seen two approaches that work: Unplugged: Leave the computer, and design the algorithm. Use white boards, acting, puppets, physical objects, etc. (This method is best used when you don't yet know what you are trying to achieve.) Use Test Driven Development with Transformation Priority. (This method is best used when you know what you are trying ...


4

I can offer two ideas here. The first is to try, whenever possible, to use some real world metaphor for the technical problem at hand. Railway sidings, card shuffling, etc. Some instructors use these as a matter of course in introducing a new algorithmic concept. But if you want a thorough study of how to approach and develop algorithms, get a copy of: ...


4

Create an object that creates a new file and writes in to it over several method invocations (not just one). Assure that the object has been deleted before continuing (Make the object go out of scope on the stack or delete a reference and let the reference go out of scope.) You need to assure that he file was closed. The destructor is the proper place to ...


3

I agree with Buffy, the question would be perfect for cseducators SE. But still, I try to give an answer which might be generalized to other disciplines as well: Of course, this is absolutely ok - but it affects your teaching style and goal. If you want the students to be 100% perfect, this is the way to go. It's a hard lesson, but in real world scenarios ...


3

There are 2 good examples of patterns where the destuctor is a key. This way you can teach a couple of useful patterns on the way. RAII - Resource Acquisition Is Initiation Rule of 3/5/0 It's easy to give a RAII assignment, just any C style handle that can be released in the end (Like a File handle, windows handle, etc). If they are more advanced, you ...


3

I agree very much with ctrl-alt-delor that the level of "total novice" might be rather early to introduce larger-scale meta-design techniques into coursework. The work being done at that level simply does not require (at a cognitive level) such deep planning to execute properly. Since the need is not self-apparent, efforts to bring it into their work will ...


3

I'm worried that you may be diagnosing the problem incorrectly. Of course, I don't know the exact situation you have and am trying so recommend based on incomplete information. But you give a few hints. I think the most important one is that the course is for upper level graduate students. You don't, however, say whether many of them are involved in research ...


2

I never explicitly assign homework. It's easier on everyone, and I don't think that they're getting that much out of homework anyway. We spend a majority of our in class time working on labs and projects. What I noticed is that most confusion can be cleared up with a 30 second conversation with me or another student. If the same thing came up at home it ...


2

My students are already slammed with homework, so when possible, I try not to add to their misery. I have done some formal polling of my students several years back, so I have used real data to balance my own approach. Of course, as of this writing, I cannot find those numbers any more, so I will be working from rough memory here: I mentally aim for 50% ...


2

I would say that all test cases don't need to be given, as long as the tests are not the only grading component. If a teacher gives clear instructions for what a program should and should not do without specific test cases, students have to be able to come up with their own test cases which is good experience. Programming for test cases is never a good idea,...


2

I think you should release test cases which test all of the functionality you want, but have private tests which test different different but similar inputs. This ensures students have not just poked their code until exactly the tests have passed and then stopped. However, I find that when students are not given a test for functionality in advance they will ...


2

(1) not fully internalizing what tools are available to them (e.g., String methods like charAt, length) [...] The first problem seems easy enough (encourage students to write a glossary of tools we learn with examples - we only require knowledge of a handful of methods), but students rarely do it. I don't blame them. It can be very hard for ...


2

The 'external view' is important as it ensures the submission is correct. These tests should be similar to Acceptance Testing since you are checking whether the submission meets the 'business' requirements i.e. the requirements laid out in your question. I highly recommend automating this process with unit tests or console based tests (check output matches ...


2

In addition to the good reasons given in the other answers: Sometimes students find code on the Internet that they can just copy into the assignment without understanding. In a coding class it seems reasonable to require students to understand the code they submit. As an instructor I would consider telling students that if they use techniques not covered ...


Only top voted, non community-wiki answers of a minimum length are eligible