jeudi 30 août 2018

Decoupling mode from the GUI

I am working on a project. I have finished the back-end code and now I am trying to get a GUI working, using Swing. I am interested in decoupling the GUI from the code. I have read a lot of posts about the Model-View-Controller pattern, but I cannot seem to be able to apply it. Those examples used getters and setters to do the job.

About my project: it's a banking application (sort of). I am taking into account currencies, monetary indexes, rates, commissions, forfeits, exchange-rate from one currency to another, etc.... All of those are objects, stored in serialized containers (each serialized container contains a bunch of objects of the same type -> think it as a list of objects).

The problem: how am I supposed to pass those objects to the GUI without getters and setters? I know there is an MVC framework built-in into Java (Observer/Observable) but I cannot understand how I can pass objects from a so-called "controller" to GUI.

P.S.: I have already stormed google with searches, but I was unable to find something I can use. P.S.S.: I am still a newcomer to design-patterns, don't hate

Aucun commentaire:

Enregistrer un commentaire