Projects and assignments are each valuable in a variety of scenarios. Before choosing whether to use one format over the other, it's important to first compare the features of each type to your coursework requirements:
If the above doesn't make your choice easier, consider the benefits of using each format for different types of coursework:
Assignments are especially useful when an instructor wants to focus on memorization and knowledge of basic programming concepts.
Projects are an ideal format for practicing and iterating on concepts learned in class. We recommend introducing your students - especially those new to programming - to the IDE in class before assigning a project that requires an IDE for homework.
Assignments are an ideal coursework type for a quiz, since they can test a student's knowledge using a variety of question types including code questions (using one or more files), multiple choice, checkbox, short answer, and long answer. Read about quiz mode here.
Projects are also a useful medium for quizzes, especially in the case where an instructor wants to evaluate students' ability to apply their knowledge of a concept.
Much like in the case of quizzes, assignments are well suited for exams due to their various question types.
A project can be a good choice for an exam where an instructor wants to test for a specific takeaway or skill learned in the course.
Tip: For the most robust testing option, you might assign a two part exam using both coursework types.