This is a collection of implementations of standard algorithms and data structures taught at introductory CS courses.
The following principles guided our implementation:
- Maximize comprehensibility.
- Name as many concepts explicitly as possible.
- Do not abbreviate variable or method names.
- Do not use comments to explain what the code does or how. This is better done in source code by choosing intent-revealing names and appropriate structures. Use comments to explain why a specific implementation was used.
- Provide an extensive set of regression tests, preferably by employing Test-Driven Development.
- Favor objects over primitive data types, e.g. use
Integer
instead ofint
and useList
instead of bare arrays. - Minimize duplication.
- Program defensively; the environment may try to corrupt our code. Prevent problems by checking parameters and giving meaningful exception descriptions.
- We try to provide a self-contained code base. Because this is intended for programming novices, we strive for minimizing dependencies to any libraries, be it the language SDK or especially third-party libraries.
- Maximizing comprehensibility requires trading performance and/or memory requirements sometimes.