# Tips for success in 3110
1. Expect programming assignments to take substantially longer to
complete than they did in CS 2110—maybe two to three times longer.
Much more of the design and implementation is up to you in CS 3110,
because it is an advanced programming course. Put another way,
we deliberately provide less [scaffolding][] in CS 3110 (indeed, less
and less as the semester unfolds) as part of the process of
advancing your college education as a programmer.
1. [Read every word][read-all-the-words] of an assignment writeup
before beginning any program design or implementation. If there are words,
sentences, or ideas you don't quite follow, go back to the course notes or visit
a consultant in office hours for help. Have a clear vision in your mind
of the end result before you begin writing any code, otherwise you might
find yourself having to rewrite and rewrite.
1. Work through examples on paper, including examples provided in a
writeup as well as new examples you invent yourself. These will clarify
your vision, and later they can become good test cases.
1. Strive for independence. When it comes exam time, you won't be able
to turn to friends or consultants for help. But never be afraid to ask for
help! A good rule of thumb: If you've been struggling with some programming
task for more than 20 minutes, walk away from it for awhile, clear your head,
think positive thoughts, [workout][cornell-gym], [listen to some music][3110radio],
[watch a video][camel-dancing],
and come back an hour or a day later. At that point
if you still are struggling, ask for help.
1. Go to office hours with a *purpose* when you're stuck on an assignment,
rather than hanging out and hoping inspiration will strike.
Do your best to identify in advance where you think you are having trouble.
Here's a list of places where people commonly get stuck; help the consultant out
by telling them up front which place you are:
* Requirements: understanding a particular small part of the writeup.
* Design: understanding what data types or functions you want to create.
* Specification: writing comments that precisely specify what a piece
of code means or does.
* Test case: writing a test case that a function should pass after
it has been implemented.
* Implementation: developing a piece of code that will compile.
* Debugging: getting a piece of code to pass a test case.
1. ECTL: Edit, Compile, Test, Loop. Keep the body of this loop small by
editing only a little code at a time. For example, write only one case of a
pattern-match or one branch if an if-expression at a time, leaving the rest
unimplemented, then test the small part of code you just wrote. (Filling in the
unimplemented part with an exception like `raise TODO` is helpful.) This
methodology will keep your code compiling (nearly) all the time and will help
you identify small unit tests to add to your suite.
1. It's okay to do some quick testing in utop—in fact, it can feel
quite rewarding. Right after that, you should capture your tests as part of an
OUnit test suite. The latter requires a bit more work—and might
feel less fun—but pays great rewards by ensuring that old bugs
do not resurface unnoticed.
1. Practice *duck debugging*: when you get stuck debugging, explain your
problem out loud to a [rubber duck][rubber-duck]. It's a [surprisingly
effective][piaget] technique.
1. Sleep! There comes a point in an
all-nighter at which your productivity becomes negative: you begin writing code
that is so buggy you'll have to spend so much more time debugging it than
if you had just gone to sleep and started afresh the next day. Programming
is a difficult cognitive task, so take care of your brain.
1. As a final step before uploading an assignment to CMS,
double check that your solution is passing any provided test
cases. Doing this can head off so many unfortunate or disastrous situations.
It's always better for your grade to take an additional day's late penalty
than to submit code that doesn't compile or that fails all the provided tests.
1. When studying for exams, try (re-)solving lab problems on paper without
looking up any information. This method closely approximates real exams and
is recommended even more than looking at the old sample exams that will
be posted in CMS.
[scaffolding]: https://en.wikipedia.org/wiki/Instructional_scaffolding
[read-all-the-words]: resources/images/readAllTheWords.jpg
[3110radio]: https://open.spotify.com/user/clarksmr/playlist/4zqMxl4g3t9sQtI5XeQtiT
[camel-dancing]: https://www.youtube.com/results?search_query=camel+dancing
[cornell-gym]: http://recreation.athletics.cornell.edu/fitness
[rubber-duck]: https://www.google.com/search?tbm=isch&q=rubber+duck
[piaget]: http://pressupinc.com/blog/2014/06/psychology-underlying-power-rubber-duck-debugging/