您将在哪里记录在许多对象和方法之间传递的标准化复杂数据?

时间:2010-06-14 01:57:19

标签: documentation

我经常发现自己拥有相当复杂的数据,这些数据代表了我的对象将要处理的事情。例如,在任务列表应用程序中,多个对象可能与一组任务一起工作,每个任务都有属性,时态表达式,子任务和子子任务等。

一个对象将从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 个答案:

答案 0 :(得分:1)

我会在定义数据的代码中使用和编写文档。自我文档的一种方法是在事情开始变得复杂时使用具有良好命名属性的类而不是数组或哈希。谨慎使用评论来清理任何不明显的区域。假设它比你聪明,并避免那些混乱的评论。