Skip to content

Design of Nodes #29

@zlmonroe

Description

@zlmonroe

The design of Nodes in the project is bad and does not follow proper OOP (open-closed) principles as pointed out by @JonathanBush. One way to fix this is by making nodes children based on a hashmap system so that the generic parent node could support any layout by default. I.E.

class Node {
     constructor() {
         this.children = {};
     }
}

class NodeChild {
    constructor(leftNode, rightNode) {
         super.children["left"] = leftNode;
         super.children["right"] = rightNode;
    }
}

This would allow, for example a generic iterator to work by getting the keys (positions) with the child node corresponding to it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    back-endCode changes related to the back-enddesignIssues relating to design of the project or interfaces usedenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions