提问人:Eli 提问时间:6/14/2010 最后编辑:Brian Tompsett - 汤莱恩Eli 更新时间:1/18/2016 访问量:56
您将在哪里记录在许多对象和方法之间传递的标准化复杂数据?[关闭]
Where would you document standardized complex data that is passed between many objects and methods? [closed]
问:
我经常发现自己有相当复杂的数据,这些数据代表了我的对象将要处理的东西。例如,在任务列表应用中,多个对象可能使用一组任务,每个任务都有属性、时态表达式、子任务和子子任务等。
一个对象将从 Web 表单中收集数据,将其标准化为可由将它们保存到数据库的类使用的格式,另一个对象将从数据库中提取它们,将它们放入标准格式并将它们传递给显示对象或更新对象,等等。
数据本身可以成为一系列相当复杂的数组和子数组,代表一个“任务”或任务列表。
例如,下面可能是任务列表中的一个条目,其格式可由将处理该列表的各种对象使用。通常,我只是将其记录在带有示例的文件中。但是,我正在考虑将其添加到 PHPDoc 或其他标准文档系统的最佳方法。
您将在哪里记录应用程序中许多或所有对象/方法的可消费数据格式?
Array
(
[Meta] => Array
(
//etc.
)
[Sched] => Array
(
[SchedID] => 32
[OwnerID] => 2
[StatusID] => 1
[DateFirstTask] => 2011-02-28
[DateLastTask] =>
[MarginMonths] => 3
)
[TemporalExpressions] => Array
(
[0] => Array
(
[type] => dw
[TemporalExpID] => 3
[ord] => 2
[day] => 6
[month] => 4
)
[1] => Array
(
[type] => dm
[TemporalExpID] => 32
[day] => 28
[month] => 2
)
)
[Task] => Array
(
[SchedTaskID] => 32
[SchedID] => 32
[OwnerID] => 2
[UserID] => 5
[ClientID] => 9
[Title] => Close Prior Year
[Body] =>
[DueTime] =>
)
[SubTasks] => Array
(
[101] => Array
(
[SchedSubTaskID] => 101
[ParentST] =>
[RootT] => 32
[UserID] => 2
[Title] => Review Profit and Loss by Class
[Body] =>
[DueDiff] => 0
)
[102] => Array
(
[SchedSubTaskID] => 102
[ParentST] =>
[RootT] => 32
[UserID] => 2
[Title] => Review Balance Sheet
[Body] =>
[DueDiff] => 0
)
[103] => Array
(
[SchedSubTaskID] => 103
[ParentST] =>
[RootT] => 32
[UserID] => 2
[Title] => Review Current Year for Prior Year Expenses to Accrue
[Body] => Look at Journal Entries that are templates as well.
[DueDiff] => 0
)
[104] => Array
(
[SchedSubTaskID] => 104
[ParentST] =>
[RootT] => 32
[UserID] => 2
[Title] => Review Prior Year Membership from 11/1 - 12/31 to Accrue to Current Year
[Body] =>
[DueDiff] => 0
)
[105] => Array
(
[SchedSubTaskID] => 105
[ParentST] =>
[RootT] => 32
[UserID] => 2
[Title] => Enter Vacation Accrual
[Body] =>
[DueDiff] => 0
)
[106] => Array
(
[SchedSubTaskID] => 106
[ParentST] => 105
[RootT] => 32
[UserID] => 2
[Title] => Email Peter requesting Vacation Status of Employees at Year End
[Body] => We need Employee Name, Rate and Days of Vacation left to use.
We also need to know if the employee used any of the prior year's vacation.
[DueDiff] => 43
)
[107] => Array
(
[SchedSubTaskID] => 107
[ParentST] =>
[RootT] => 32
[UserID] => 2
[Title] => Grants Receivable at Year End
[Body] =>
[DueDiff] => 0
)
[108] => Array
(
[SchedSubTaskID] => 108
[ParentST] => 107
[RootT] => 32
[UserID] => 2
[Title] => Email Peter Requesting if there were and Grants Receivable at year end
[Body] =>
[DueDiff] => 43
)
)
)
答:
1赞
Khorkrak
#1
我会用定义数据的代码进行记录。自我记录的一种方法是,当事情开始变得复杂时,使用具有良好命名属性的类,而不是数组或哈希。只需谨慎使用评论即可清除任何不明显的区域。假设他们比你更聪明,并避免发表弄得一团糟的评论。
评论