Skip to content

Consider removing MenuItem classes #7

@ReplicaObscura

Description

@ReplicaObscura

MenuItem might be overkill.

The Menu class serves a purpose in referencing a MenuRenderer, containing settings and meta information about a menu, and containing the menu items themselves.

The MenuItem classes, however, really only contain properties about a menu item and a reference to a MenuItemRenderer.

Perhaps it would be better for application performance if a MenuItem was simply an array of properties (containing at least a 'title' and 'url' property, an option 'renderer' property, and potentially others depending on the renderer you're using.).

The class doesn't do anything other than create an inheritance tree and allow MenuItemRenderers to only render certain types of MenuItems. This can be done just as easily with a check for a required property in the array.

But would the performance benefits of eliminating that entire class tree outweigh the potential clarity and extensibility of keeping them as classes serving a specific purpose instead of generic array items?

Metadata

Metadata

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