The programming puzzle starts to come together

Really interesting topic. My current learning project is to develop the “choose your own story” game from the 2D course and, without realising it, I was implementing the “MVC” model. When I then upgraded the UI/Control from “check for button press in Update” to events triggered by buttons I started to move the code into MVP. This caused a mess (currently). However, this explanation of MVP has given me insight into how to do it profes…umm…less amateurishly.

My only critique is of the MVVM description. In my head I got “it’s very similar but it uses magic”. I’m guessing the relative brevity was due to it being out of scope for the course, so maybe that should be clarified. As in “for completeness, this is MVVM, but this is out of scope for the course, if interested find more out here…”.

Yeah, I did rush over the MVVM. Basically, the “magic” isn’t done by your code but by some external library code. So it’s out of scope because we aren’t using such code.

I didn’t see how model view and view don’t have direct dependencies when they are using two way bindings. seems like thats a direct dependency by definition.

The bindings are one way. The LevelPresenter subscribes to the Level class and the HealthPresenter subscribes to the Health class. When the health changes, it calls the OnHealthChanges, it has no idea what classes have subscribed. It’s not in any way dependent on HealthPresenter. The same with the Level and LevelPresenter.

Oh I meant in the MVVM situation sorry.

Privacy & Terms