每当我开始从事足够复杂的项目时,我无法一次全部记住,我喜欢概述应用程序应该如何工作......我通常在文本编辑器中破解类似这样的内容:
# Program is run
# check to see if database exists
# create database
# complain on error, exit
# ensure database is writable
# complain to user, exit
# check to see if we have stored user credentials
# present dialog asking for credentials
# verify credentials and reshow dialog if they're invalid
# show currently stored data
# start up background thread to check for new data
# update displayed data if new data becomes available
# ...
#
# Background service
# Every 15min update data from server
# Every 24 hours do a full sync w/ server
等等(注意:这是注释所以 SO 不会解析它,不是因为我将它作为注释包含在代码中)。
我想知道你们是怎么做到的。是否有任何工具可以概述程序的流程?您如何描述复杂的项目,以便在编写代码时可以专注于代码而不是所有小块的设计/架构?