一句话:提出“软件复活”练习:让学习者在现代平台复活20年前的开源软件,通过修复与反思掌握编程珠玑。
阅读他人编写的程序代码与文档被认为是学习编写可读、可理解且可维护代码的最佳途径之一,但缺乏具体可操作的练习。本文提出“软件复活”练习:要求学习者在现代硬件与软件平台上编译并测试一个维护良好且广泛采用的开源软件的历史版本(如20年前发布的版本),并针对当时无法预见的平台问题开发修复。练习最后要求撰写评论,对维护历史软件的体验进行批判性反思。以20年前发布的SQLite数据库引擎版本为例的实践表明,在软件复活的反思性学习循环中,软件工程原理(即编程珠玑)会自然涌现。该概念有望培养终身探索并从现有代码与文档中学习的意愿。
Reading computer program code and documentation written by others is, we are told, one of the best ways to learn the art of writing readable, intelligible and maintainable code and documentation. The software resurrection exercise, introduced in this paper, requires a motivated learner to compile and test a historical release (e.g. 20 years old) version of a well maintained and widely adopted open source software on a modern hardware and software platform. The learner develops fixes for the issues encountered during compilation and testing of the software on a platform that could not have been foreseen at the time of its release. The exercise concludes by writing a critique which provides an opportunity to critically reflect on the experience of maintaining the historical software. An illustrative example of the software resurrection exercise pursued on a version of the SQLite database engine released 20 years ago shows that software engineering principles (or, programming pearls) emerge during the reflective learning cycle of the software resurrection exercise. The concept of software resurrection has the potential to lay foundations for a lifelong willingness to explore and learn from existing code and documentation.