Last updated on

Week 10 Debrief: tips for the unguided lab

Congrats on completing your 10th week of CS-214! Here is a round-up of interesting questions, tips for exercises and labs, and general notes about the course.

Administrivia

Interesting Ed questions

Unguided lab updates

Our advice for this week

Now that you know what you’re going to build, it’s time to start working on the implementation. This week, we recommend that:

  1. You set up the repository;
  2. You brainstorm the architecture and identify the smallest possible prototype that captures your idea;
  3. You complete a minimal prototype.

Read on for why starting small matters.

Software engineering tips

Plan ahead, identify intermediate milestones, and start small!

The best way to be successful in the webapp lab is to apply two techniques:

  1. Plan ahead: mistakes that force you to redo everything from scratch are very time consuming. Take the time, as a team, to talk through the implementation, which features you’re going to start with, what will be difficult, and what might take time.

  2. Release early and often: planning in advance is good, but it’s very hard to plan a complete app and implement all of it in one go. Instead, you should start with a minimal working prototype: just the essence of your app, oversimplified, so that it takes just a few hours to get it to work. Once you have that, you can confidently add features one by one on a working base. This makes debugging very easy: any time you find a problem, it will be in the small component that you just added.

Avoid implementing all features together at all costs. Have a working, extremely simple prototype working as early as possible, and refine from there. Feel free to ask us (in person!) if you’re unsure how to choose a minimal working prototype.

Consider writing tests first

Your tests will be a mix of:

You can define integration tests even before you write the code: they won’t pass (of course) until you write the code, but they can help you define what your code should do.

For example, consider a tic-tac-toe app. Even if I don’t know what the state representation is, if I have a view that is either Finished(winner: UserId) or InProgress(…), I know that the sequence of events where user "a" plays at positions (0, 0), then (0, 1), then (0, 2) should lead to a state that once projected yields Finished(winner = "a"). Note that I don’t need to know anything about the State type to write such a test.

Consider pair-programming!

Early on in the project, it may be very useful to write some code in pairs — a practice called pair programming. If you do so, have one person code while the other looks over, comments, and suggests implementation choices or improvements, and switch roles regularly (every time a non-trivial function is complete, for example).

Remember: you may deviate from your proposal!

You will not be judged on whether your final product matches your proposal. You may be asked to explain why you deviated, but if you build something reasonable, we will not penalize you for adjusting your proposal.