Skip to content

Pass objects instead of ID's #70

@CommanderCero

Description

@CommanderCero

We currently have a lot of functions that accept an ID, instead of the corresponding object. For example instead of passing around an entityTypeID we should pass around an EntityType&.

First of all, ID's are just integers, it's easy to pass the wrong ID to a function because with all the ID's floating around one will get confused at some point. If you instead pass the object there is no way you can mess up.

Second, by passing around an object we force the user to first lookup the object themselves. Why is this beneficial you ask? If you lookup a wrong ID the code will fail in the users code, with our current implementation it will fail in our code. Additionally, by passing around ID's everywhere we have to lookup the same object much more often than if the user just reuses the same object. Not only does this make the point of failure clearer, it also saves performance.

Lastly it's s also better to use the object directly for compatibility. The reason for this is simple, nobody has to know that we use only the ID of the object. This allows us to use more info if necessarry without anyone noticing, and we can change datatypes of ID's easier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions