vendredi 29 janvier 2016

JavaFX application - design of main class

I'm currently trying to develop application using JavaFX and I'm stuck just at the beginning. I want to use MVC pattern in this implementation and also make this implementation as reusable as possible. Basic description of the app:

1) It uses configuration file in which all database connections parameters (passes, logins) and other parameters used by the app are stored.

2) It's all about configuring of workflow of other application so it has to store two database object to two different databases and make operations through them in databases.

3) The design assumes that there are few views, every one has it's own controller and different functionalities can be done through them but all can trigger operations on database or configuration file.

4) The goals is also to remember the state of previous view while changing between views during usage.

That's why I have this questions:

1) While I start the application I test the connections to the database and if successful I connect to them. Is it ok that I do this in the Main class or should I have some other class in which I store all these db objects in case of referring to them in this class? Is it ok that every controller will use an instance of the Main class just because it has to access these db objects (assuming I decided to not use other class in which I do all the connections)?

2) What is the role of the main class? Should it be used as a main view (as in MVC) and should it only launch the application and pass the further responsibility to, for example, LoginController/View...?

I would be greatefull for some clear answer which could enlighten me this problem a bit.

There are no stupid questions, they say... :D

Aucun commentaire:

Enregistrer un commentaire