Skip to content

Implementation details around data representation should not leak #37

@dancrossnyc

Description

@dancrossnyc

Much of the state of both the BBS and the user session is represented by very low-level details, such as indices into the array of conferences in the conference list. Similarly, the current entry in the user's cflist is a global index into an array. This unnecessarily leaks low-level implementation details about the representation of those data throughout the program, leading to a lot of code that manually tests those indices and indexes into the associated arrays, etc.

Instead, the notion of a "current" conference should be represented by a pointer or non-nullable reference to a well-defined Conference object. Similarly, state in the cflist should be represented by some sort of cursor abstraction. Other relevant data, such as current item, response within the item, etc, similarly. The rest of the code should be written in terms of those abstractions.

An obvious question is, how does one represent the state of not being in a conference at all? (e.g., "noconf"). An answer might be to use the "null-object" pattern: a read-only "noconf" instance of the Conference class can provide reasonable behavior in this case: nop'ing out mutating operations, and returning reasonable data representing the "noconf" state. Similarly with other object types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions