仅追加编程

  • Ian Fisher's New Methodology: Adopted a new software development methodology - append-only programming.

    • Rules: Everything in a single C file, new code appended at the end, and existing code not editable.
  • Benefits: Forces interface definition before implementation, encourages small functions, and produces readable source code.
  • Drawbacks: Not the most forgiving. If a subprocedure is wrong, a corrected version must be appended and callers corrected. In some cases, the entire program may need to be retyped.
  • Preferred Editing Method: Use cat >> main.c in the shell instead of a conventional text editor. Set up aliases like edit, show, check, build, checkpoint, and revert.
  • Original Idea: Use C's forward-declaration to write a program incrementally, starting with main function in terms of high-level helpers and working down.
  • Practical Challenges: Real coding doesn't proceed smoothly. Discovering the need to revise high-level functions while writing low-level ones is difficult. Troubleshooting is also challenging, and re-typing an entire function just to add print statements is not efficient.
  • Recommendations: Split out a main.h header file for independent declaration and import appending. Split the program into one file per function and allow overwriting files.
  • Append-only Blogging Suggestion: For those feeling adventurous, consider append-only blogging (similar to Twitter).
阅读 8
0 条评论