beautiful code...

Course description

ORC. Motivated by problems that arise in a variety of disciplines, this course examines concepts and develops skills in solving computational problems. Topics covered include abstraction (how to hide details), modularity (how to decompose problems), data structures (how to efficiently organize data), and algorithms (procedures for solving problems). Laboratory assignments are implemented using object-oriented programming techniques.

Prerequisite. CS 1, Engineering Sciences 20, or placement through AP or local placement exam.

Who, when, where

(Note: all times are Eastern time zone)
Instructor
Tim Pierson | 222 ECSC
office hours: most weeks Tues and Thurs. 1:20 pm - 2:10 pm (confirm via Canvas calendar), and by appointment.
Graduate teaching assistant
Yitao Jiang
Section Leaders
Aneesh Patnaik, Audrey Olmstead, Ava Weinrot, Dickson Alexander, Dung Tran, Eren Saglam, Helen Cui, Isabelle Han, Jaysen Quan, Jeffery Song, Krittin Hirunchupong, Nand Patel, Prisha Aggarwal, Renata Hoh, Warren Shappard, and Zac Rosca-Halmagean.
Lectures
12-hour | MWF 12:50 pm - 1:55 pm | Cummings 100
  2-hour | MWF  2:10 pm - 3:15 pm | Cummings 200
Except for the week of the Martin Luther King holiday, I do not plan to regularly use x-hours, but I may also use them for missed classes, to catch up on material, or for optional, informal sessions to work through examples. Make sure to keep this time slot free in case we need to use it.

One of the primary benefits of lectures, as opposed to books and videos, is the opportunity to interact. We will all enjoy the experience more, and everyone will learn more, if you do ask questions. It can of course be intimidating, but chances are that if you have a question, then at least one other student — and possibly many more — has the same question. You're doing the other students a favor by asking!

Laptops and phones are distracting, not just to you, but to everyone around you (it's human nature to wonder what's up over there). There is recent research that attests to the negative impacts of learning and retention when multitasking. It has also been shown that writing notes by hand rather than on a laptop engages different cognitive processes and has direct (positive) consequences for learning. Since class notes are made available anyway, there's really no need to type. I recognize that there can be some value in following along with the examples right in front of you, so I won't ban laptops entirely, but I will strongly encourage you to try to abstain for those 3 hours a week.

Section meetings (recitation)
These are required weekly small-group meetings with Section Leaders (undergraduates who have already taken CS10) to review lecture material, discuss questions, go over homeworks, etc. They also provide an opportunity, "programming drills", to practice the concepts. Bring your laptop so you can do the drills. Groups and times will be posted on Canvas. If you have a conflict and you have to miss a section meeting, find an alternate section and arrange the make up in advance with both Section Leaders.
Section Leader office hours
Each Section Leader will hold a total of 3 hours of office hours per week (times and locations maintained on Canvas). These will be spread out to encourage you to start early and ask conceptual questions as you dive in, while still providing some help with debugging closer to assignment due dates. Slack (below) is the way to get help any time.
Help: Slack
Click on the Slack link on Canvas to be added. I encourage you to ask and answer questions there. Make sure you abide by the honor code described below! Do *not* post code on Slack!
You can DM me on Slack, but unless I happen to be sitting at my computer when you do, I won't get your message until Slack sends me an email at some point in the future. You're better off emailing me directly rather than DM'ing me on Slack. Please don't message me via Canvas!
Announcements
Monitor Canvas for periodic course-wide announcements.
Textbook
Data Structures and Algorithms in Java, 6th edition, by Michael T. Goodrich, Roberto Tamassia, and Michael H. Goldwasser. Available in paperback or as an e-book (the e-book is much cheaper). The textbook is not strictly required; I'll provide all of the information you'll need for the course. The book, however, takes a deeper dive on some subjects and is an excellent resource to see what professional Java code looks like. Many students have found the book helpful.

Coursework

All homework (short assignments and problem sets) for this class is to be submitted electronically via Canvas before class. Even when an assignment has some written exercises, you are required to either type in a file or scan your written work and submit it electronically. To submit output from your program, submit a copy-pasted file in plain text format and/or a screenshot, as appropriate. For plain text, you can use a program like TextEdit, NotePad, or Emacs, or even Word, but be sure to save as plain text. For a screen shot, you can use Preview on Mac (under the "File" menu) or the PrntScrn button on Windows.

Requirements for code submissions:

Assessment summary
Homework Percentage
Section meeting programming drills 5%
Short assignments 10%
Problem sets 25%
Homework total 40%
Exams Percentage
Midterm 1 20%
Midterm 2 20%
Final exam 20%
Exams total 60%
Section meeting programming drills (5%)
During the weekly meeting with your Section Leader (see Section meetings above), you will get practice solving object oriented problems and will get feedback to aid your understanding of the basic course material. You will be graded as follows:
Grading
2 (correct and efficient), 1 (needs work), or 0 (nothing of substance).
Lowest grade will be dropped.
Late policy
Only available at the section meeting; bring your laptop! If you miss a programming drill, you are encouraged to complete the problem to solidify your knowledge, but it will not receive credit.
Short assignments (10%)
Short programming or written exercises to practice the concepts from one class before the next class. Short assignments are to be done individually (e.g., no partner).
Grading
2 (correct and efficient), 1 (needs work), or 0 (nothing of substance).
A solution receiving a 1 may be revised and resubmitted once, before the next regular class period after it is returned, for a possible upgrade to 2.
Late policy
Due via Canvas on the date and time noted on Canvas assignment. No credit for late submissions.
Problem sets (25%)
A mixture of written and in-depth programming exercises, challenging you to use the ideas we study in class to solve new problems. You may work with one partner on these assignments (see Collaboration below); each partner should upload the same solution. You are not required to work with a partner.
Grading
Specific grading rubrics will be provided for each problem set, covering correctness (solving the assigned problem), structure (organization, use of techniques covered, efficiency), style (readability of code, clarity of documentation), and testing (your demonstration of correctness).
Late policy
Due via Canvas on the date and time noted on the Canvas assignment. Late penalties:
  • < 8 hours: 10%
  • < 24 hours: 20%
  • < 48 hours: 40%
  • more: no credit.
You are allowed at most one late submission (up to 48 hours) with no penalty; no excuse required. The purpose of this 48-hour extension is to cover unusual events that may occur during the term, not to provide additional time if you get behind. Sometimes students use their extension early in the term because they want more time on an assignment, then later something unexpected arises and they ask for a second extension. It would not be fair if some students get multiple extensions while others do not. Use your extension wisely; I will not grant multiple extensions. Indicate in your submission that you are electing to use your extension; no undoing the choice. This cannot be combined with a penalty (e.g., you can't take an 8-hour penalty on top of the 48-hour extension). If you are working with a partner, this counts as the extension for both of you.
Midterms and final exam (60%)
There will be two midterms and a final exam, each worth 20% of the final grade (total = 60%). You are allowed to use one 8.5 x 11 inch note page for each of the exams, but you may only include information provided by the instructor or from the course web page. Including other information on your note page is a violation of the Honor Principle. You can use both sides of the page and it does not have to be handwritten. You may only use a note page that you create yourself. You may not use a note page created by someone else or created in conjunction with someone else (e.g., you and your friend cannot create one page that you both print and use). The midterms will be in the evening to allow more time than the hour scheduled for class. If you have an academic conflict and need to schedule a make-up midterm, or if you have an accommodation, you must let me know at least a week in advance of the scheduled exam. I suggest you check for conflicts with other classes during the first week of the term. The final exam is scheduled by the Registrar so that there will be no conflicts; thus an alternate schedule is possible only in the case of a documented illness. Do not schedule travel before the final exam dates/times are confirmed by the Registrar!

If you have questions about your exam score, or would like a question re-graded, see your Section Leader within one week from the date that the exam was returned. If you request a re-grade of a particular question, we reserve the right to re-grade your entire exam.

Extra credit
Some homeworks have specific extra-credit problems; you may suggest other extensions for possible extra credit; any exceptionally clever, creative, or insightful work may likewise be awarded extra credit points. As its name suggests, extra credit is always optional, and you should never feel that you have to do extra credit problems. Extra credit points are recorded separately from other grades, and may be used to help make borderline letter grade assignments at the end of the term (those with substantial extra credit would get the higher grade if their grade is on the borderline). Extra credit points can only help, never hurt, your final grade, regardless how much or how little extra credit you or your classmates choose to do. You should not, however, view extra credit as a substitute for doing good and thorough work on your assignments, and should not attempt it until you have completed the main assignment, as it will only be used in rounding borderline letter grades.

Extra credit will also be considered for frequent good contributors to Slack (both asking and answering questions).

Letter grades
There is not a fixed scale, as it is impossible to pre-calibrate exam difficulty that precisely. The course median tends to be a B to B+, but that is not guaranteed. The lowest passing grade is normally 60%.

Collaboration

Much of the learning in this course comes from doing the programming exercises. Sometimes learning can happen more effectively when you can hash things out with someone else, so working with a partner will be allowed when so stated on the assignment. In such cases, you may work jointly with one other person. No more than two people may work together on a given problem set. If you choose to work with a partner, you and your partner must each submit a the same joint assignment with both names on it, and you must work with the same person for the entire assignment (you cannot work with one person for some parts of an assignment and a different person for other parts).

If you work with a partner, you are still responsible for understanding the entire assignment. That means that splitting the coding into two halves, doing your half, and never looking at your partner's half is not a good idea. You can learn a lot by reading your partner's code and figuring out how it works, whether it is correct, and how it might be improved. You can also catch things like poor or missing comments that could cost you style points when the assignment is graded.

When working with a partner, I suggest that you borrow a practice from Extreme Programming, a method of writing code that many businesses find quite effective. One person (the driver) sits at the keyboard. The other person (the navigator) looks at the screen as the driver types, asking questions, making suggestions, and catching errors. You can do this over Zoom with the driver sharing the screen. Both of you will understand the code better if you discuss it as it is written than if you just write it (or read it) by yourself. Regularly trade off who is driver and who is navigator.

The usual reaction to this idea is, "that will take twice as long!" In practice it is usually faster than each person programming alone. The reason is that errors are caught earlier, and the amount of time are saved when debugging more than makes up for the lack of parallelism in code writing. Also, the code tends to be better written. These are the reasons that this idea has been adopted in industry.

Honor Principle

Dartmouth's Academic Honor Principle applies to this course, and academic misconduct policies will be strictly enforced. I will report suspected cases of cheating to the Undergraduate Judicial Affairs Officer. I will assign zero points for an assignment or an exam if I conclude that the honor principle has been violated. If the Committee on Standards finds that you violated the honor principle I will assign a failing grade for the entire course. If you have questions, ask!

Elaboration (thanks to many CS 1 and 10 instructors over the years)

  1. On exams, all work must be your own.
  2. You will work on short assignments individually. Programs that you turn in should be created, typed, and documented, and the output generated, by you yourself.
  3. For the problem sets, you may work with a partner as discussed above. You may also consult freely with other classmates during the phase of designing solutions, but you should then work individually (or with your partner) when creating your programs—typing, documenting, and generating output. During the debugging stage you may discuss your problems with others in the class, but you should not copy code to "fix" bugs. To do otherwise is a violation of the Academic Honor Principle.
  4. We will use Slack as a shared help system. Your public posts (questions and replies) must not reveal solutions (or even partial solutions) to the problems. As illustrated below, asking and answering questions in English is generally acceptable, while using Java as your language of communication is not. This might seem to make it harder to debug, but the act of phrasing a good question without just dumping your code can actually be very helpful to you.
  5. If you are working on a computer that is not yours or that someone else in the course might use, you should be very careful to remove your code from the computer when you are all done. You should probably email your code to yourself before you remove the code. Why do we tell you to do this? Because if you leave your code on a computer, and someone else can see it, then they can copy it and hand it in. If that happens, then we have a bad situation involving you (the copy-ee) and the other person (the copy-er), and it's difficult, if not impossible, to tell who was the copy-ee and who was the copy-er. By removing your code from the computer when you're done, you can avoid getting yourself into that situation.
  6. You should attribute the proper source in anything that you submit that you did not write yourself. This includes code that you take from outside references, for example a book other than the course text. It even includes code that you take from the class examples, textbook, or assignments, other than the code given for that particular assignment. (I agree that may be tedious to attribute the source in code that we have given you, but we want you to be in the habit of attributing your sources.) Note also that proper respect for copyright laws as it applies to printed and software products is part of the Computing Code of Ethics. This requirement also applies to code created or debugged by AI-based code generators (see below for more details about AI-based code generators).
  7. Whenever we ask you to turn in sample runs of your program, the runs you turn in must be the result of actually running your program. It is a violation of the Academic Honor Principle to falsely represent output as coming from your program if it did not. If you change your program, make sure to generate output from the version of the program that you hand in. It's amazing how a seemingly minor change to the code can cause a big change to the output of a program. Also, make sure that when you are running a program, that it is your program; it is easier than you might think on a public Mac to run a program that someone else had left on the machine.
  8. In the past, we have had a few incidents in which students turned in output that did not come from the program handed in. In each case, it turned out that the student had made a foolish mistake (in not rerunning the program or handing in an old version of the program or the output) and had not intended to misrepresent the work. Yet it caused many an uncomfortable moment for the student and also for the student's Section Leader and for the instructor as well. Verify that you're handing in output that comes from the very program you're handing in.
  9. It is not easy to come up with good homework problems that help you learn a concept, are interesting, and require an appropriate amount of work. Over the years we have developed and refined a number of homework problems, and I plan to reuse, often with modification, some of them for this class. You should not look at any solutions to homeworks assigned in previous terms, including sample solutions, or solutions written by other students.
  10. We will be running powerful software tools that detect suspicious similarities in software. These tools are quite sensitive, even to the obvious tricks that are often used such as changing variable names, spacing, comments, orders of code fragments, etc. It could take much more work to fool the software than it would just to do the assignment.
  11. We have had some uncomfortable situations occur in the past, and I want to make the policy clear. Two students, Alice and Ralph, who are not working as formal partners, discuss an assignment and design their basic approach together. That is fine. But then they decide that since their programs would be so similar, they might as well have Alice type in the code, have Ralph make his own copy of the file containing the code, and then have Ralph make his own minor changes. This is a violation of the Academic Honor Principle. Although you may discuss and design with others, the code you hand in must be entirely your own.
  12. Here's another situation that occurred. Tracy and Ed (neither are working with a partner) start working independently on a program. Tracy finishes and has a working version. Ed has trouble with his. Tracy helps Ed debug. That is fine (but Ed should note Tracy's help in a comment in his code). But then Tracy realizes that Ed has a section of code that is all wrong and the program she wrote has just the right code for that section. She shows Ed her program. That is a violation of the Academic Honor Principle. Or worse, she gives Ed an electronic copy of her program so that he can just paste in the correct code. That is also a violation.
  13. Another unfortunate situation involved Elsa looking at Ebenezer's code (not partners) to see how he'd gotten it working, in order to better understand the approach and figure out where she'd gone wrong. Similarly, Ziggy found a former student's code on-line and thought that by studying that code, he'd learn how things should really work, beyond just the descriptions and pseudocode in the assignment write-up and in the textbook. These are violations of the Academic Honor Principle. They undercut your own learning, as a key part of problem solving with computer science is being able to start with high-level descriptions (as provided) and figure out how to correctly implement them using suitable data structures and programming constructs.
  14. I realize that it can be hard to decide when you might be violating the Academic Honor Principle, so here is a good rule of thumb. If you are talking in normal English (or Chinese or German or some other natural language) you are probably OK. If you find yourself talking in Java code, you have crossed the line. So saying, "Your program runs forever because you have the wrong condition in the while loop" is OK. But saying, "Change while (x == 0) to while (x > 0)" is not.
  15. If you have any questions about whether what you're doing is within the Academic Honor Principle, do not hesitate to check with me. If it's late and you can't get hold of me, you're better off erring on the side of caution.
  16. Most violations of the Academic Honor Principle come down to failure to cite work that is not yours. If your code benefited from your friend Elvira's code (or an AI's code, see below), but you did not indicate that and represented it as your work alone, then you either intended to deceive or were careless about citing. Either case is a violation of the Academic Honor Principle. If you copy your entire program from Elvira but include the comment, "This code was copied in its entirety from Elvira," then you cited properly, though you didn't actually do the work. In this latter case, I would not report a violation of the Academic Honor Principle, though your grade on the assignment would be 0. But that would be far preferable to a Committee On Standards hearing.
  17. The same goes for code that you find in some other book or on the Internet. You are in violation of the Academic Honor Principle if you fail to attribute your sources.
  18. In addition to avoiding code on the Internet, do not post your own solutions to the assignments or exams on public websites such as github. I realize you may want to show your code to potential employers. In that case, post your code to a private repo and grant the potential employers access to your code on a short-term basis.
Special note on Artificial Intelligence-based code generators
AI-based tools such as ChatGPT, CoPilot, Code Llama, and others can generate code for you based on natural language prompts that you provide. For this class, I do not consider it to be an honor principle violation for you to use these tools to create or debug your short assignment or problem set solutions. However, I strongly urge you to write the solutions yourself, rather than relying on these tools. Most of the true mastery of this course's material happens from striving to create correct and efficient code yourself, not from simply reading and copying an AI-based tool's code. Additionally, these tools will not be available on the midterms and final, so you'll need to fully understand the course material to succeed.
If you choose to use an AI-based tool you must:
  • Cite the tool you used for each method (function) created or debugged with one of these tools, even if you modify the tool-produced code
  • Be able to explain every line of code in your solution; specifically what the line does and why you included it.
If you choose to use an AI-based tool you must not:
  • Share the prompts you used with anyone (other than your partner, where partners are permitted)
  • Share the tool's output with anyone (other than your partner, where partners are permitted). Other students must use the tool themselves and must evaluate the tool's output relative to their solution
  • Use Java-provided classes or methods that we have not discussed in class. For example, if an AI-based tool suggests you use a class such as a Set, but we haven't covered Sets yet, you may not use them until we cover them. Once we've covered a concept in class, you may use Java-provided code unless specifically instructed not to use it.
Remember: because code compiles and runs does not mean it is correct or efficient. Also, be aware that these tools typically store and analyze your prompts, potentially building a profile of you.

Attendance

You are expected to attend class in person unless you have made alternative arrangements due to illness, medical reasons, or the need to isolate due to COVID-19. For the health and safety of our class community, please: do not attend class when you are sick, nor when you have been instructed by Student Health Services to stay home. You will be able to view recordings of class in Canvas if you are unable to attend due to illness.

Accessibility Needs

Students requesting disability-related accommodations and services for this course are required to register with Student Accessibility Services (SAS; Apply for Services webpage; student.accessibility.services@dartmouth.edu; 1-603-646-9900) and to request that an accommodation email be sent to me in advance of the need for an accommodation. Then, students should schedule a follow-up meeting with me to determine relevant details such as what role SAS or its Testing Center may play in accommodation implementation. This process works best for everyone when completed as early in the quarter as possible. If students have questions about whether they are eligible for accommodations or have concerns about the implementation of their accommodations, they should contact the SAS office. All inquiries and discussions will remain confidential.

Mental Health

The academic environment at Dartmouth is challenging, our terms are intensive, and classes are not the only demanding part of your life. There are a number of resources available to you on campus to support your wellness, including your undergraduate dean, Counseling and Human Development, and the Student Wellness Center.

Religious Observances

Dartmouth has a deep commitment to support students’ religious observances and diverse faith practices. Some students may wish to take part in religious observances that occur during this academic term. If you have a religious observance that conflicts with your participation in the course, please meet with me as soon as possible—before the end of the second week of the term at the latest—to discuss appropriate course adjustments. To assist with calendar planning and awareness of our diverse religious and spiritual community, please refer to the Tucker Center for Spiritual and Ethical Life’s holy day calendar. The list represents major holy days which may impact campus events in general, as well as student course attendance, exams, Commencement, and participation in activities in the coming year. If you have any questions about these dates or other concerns, please contact Rev. Nancy Vogele, chaplain and director of the Tucker Center.

Acknowledgment

This course is based upon a course originally developed by Professor Chris Bailey-Kellogg. I am deeply indebted to him for all of his hard work. Also, special thanks to Ethan Chen '24, Pratim Chowdhary '25, and Bill Zheng '26 for their insightful comments and code contributions.