Crazyloon / Enshrouded-Server-Manager

An easy-to-use server manager for Enshrouded
MIT License
13 stars 2 forks source link

Major UI refactor for testability #47

Closed Crazyloon closed 7 months ago

Crazyloon commented 7 months ago

Merge the UI rework into dev.

The primary reason for this large PR is to decouple user interactions from application behavior to allow for better testability and higher confidence that one minor change will not break something somewhere else.

There are two new patterns introduced in this PR. The primary pattern is Model View Presenter. Each view has an associated presenter class. The presenter class is responsible for listening to events on the view, and telling the view what to do in response to changes in data. The view is passive in the exchange and only exposes properties necessary for interaction with the user. The models are not strictly used to model the view, but in many cases they are used to represent the state of the data in the view.

We're still missing tests for most of the presenters, those should be added as soon as possible. Especially in cases where we have to manually test something often to make sure a small change did not cause a bug.

Secondary to presenters is the service layer that handles the bulk of the work. We have no tests yet for any services, but we should add them in similar cases to presenters, where we find we have to test a feature often to ensure we're comfortable with it not breaking due to added features or changes elsewhere.