February 22, 2019
For Today:
1) Read Head First C Chapter 4
2) Finish Homework 3
3) Work on your project.
Today:
1) Project proposals and next steps
2) Passing pointers as parameters
3) HFC Chapter 4
4) Team standups
For next time:
1) Start Homework 4
2) Read Think OS Chapter 5 and do the reading quiz
3) Prepare for a quiz (here's last year's quiz for practice)
Generally off to a good start!
Good variety of topics, all seem appropriate for your learning goals.
Most of you have identified resources that should get you off to a good start. If you found something I should include in my list for future classes, email it to me, please.
In some cases, the Trello boards are a little sparse, and many cards don't have a good definition of done.
For example, if you have a card that says "Do the tutorial", consider:
1) Add a link to the tutorial.
2) If there are multiple steps in the tutorial, make multiple cards.
3) If every member of the team is doing something, add a check list.
4) Add a review activity you will do when everyone is done.
At the end of class today, please update your boards, add details to cards, including definitions of done.
Next steps:
1) Keep all team members making steady progress. Schedule at least one hour per week to work together, and at least one hour to work individually.
2) Make sure all team members make individual contributions that are visible on Trello and GitHub. This will be a grading criterion for the next two rounds.
3) Create the update document now and update it as you go. (Project 1 Update due March 12)
When possible, I will leave the last 5 minutes of class for team standups:
1) What have to completed since last time?
2) What are you working on?
3) What help do you need?
After a standup is a good time to update your board.
Pull from upstream to get today's examples.
Open ExercisesInC/examples/strsplit.c
1) Hey, I learned something (see strsplit5).
2) When you see char * think of it as a string object, not a pointer.
3) It turns out that strtok modifies the string! But we can avoid that by using strdup.
BTW, strdup is the only function in string.h that allocates space. It uses malloc, so the new string is in the heap.
4) Remember that changing parameters doesn't affect the caller (see strsplit6)
5) If you want to change what string the caller points to, you have to pass a char **, which you should think of as passing a string by reference (see strsplit7).
6) Let's do Question 3 from last year's quiz. Open ExercisesInC/examples/modf.c and fill in the missing functions.
Did anyone notice anything wrong with the examples on pages 158-159?
Wrong: integers are for small things, floats are for big things.
Right: integers are for counting, floats are for measuring
If you need more control over the sizes of thing, you can use the "new" fixed width integer types.
Separating declarations from definitions is a pain, and a maintenance headache.
For small programs, you can usually put the functions in order and avoid declarations, as Skeptical Girl suggests on page 172.
For larger files, put the declarations in the header file, and include the header file in BOTH files that use and files that define.
Development process:
1) Write and test functions in one module, until the API stabilizes.
2) Copy foo.c into foo.h and then delete the bodies of functions.
3) Add the include line to foo.c.
4) Move the test code out of the module into a unit test.
What's the difference between including <foo.h> and "foo.h"?
Yay, make!