CSC 282.01, Class 08: Exploring a C Project
Overview
- Preliminaries
- Notes and news
- Upcoming work
- Review of components of a typical project
- Building the Makefile
- Specifying the interface
- Writing tests
- Implementation strategies
- Building libraries
- Writing a utility
News / Etc.
- I would have liked to have seen more of you work on the project (or at least ask questions about it).
- We will continue the project over break. Please have code ready then.
Upcoming work
- Finish the Arbitrarily Large Integers / Arbitrary Precision Integers / Arbitrarily Long Integers project.
- Read about C macros (distributed over break)
Good things to do
- Singers concerts.
- Baseball games.
- Ultimate matches.
Review of components of a typical library project
Makefile- Specifies how to build things.- Documentation
README.md- Overall view of the projectDEVELOPER.md- Internal implementation issuesMANIFEST.md- List of files and purpose
.hfiles - specify interfaces and more- interface: types, procedures, constants, macros
- Black box tests! (Don’t pay attention to internals)
- Primary code for the library
alint.c- All of the library routines oralint-int.c- Parse/unparse integersalint-double.c- Parse/unparse doublealint-string.c- Parse/unparse stringalint-math.c- Guess
- Clear box tests! Get code coverage.
- Sample application built with the library
Critiques
- Don’t add files with
git add .. Add them individually.
Building the Makefile
What should the Makefile look like?
- Settings
- Standard targets
- Additional dependencies
- Anything else of use
Specifying the interface
Question: What does this mean?
typedef struct ALInt ALInt;
We will eventually create a struct called struct ALInt. We want to
use ALInt as an alias for struct ALInt.
Writing tests
Implementation strategies
- Linked list.
- Expandable array.
- Array with size.
- Array with terminator.
Building libraries
- See PMG
Writing a utility
- Calculator (RPN)