PDA

View Full Version : ui, mainwindow and other classes



mtnbiker66
1st February 2013, 16:53
Good morning, all --

Okay, this question falls into a theoretical category not technical (I've figured that one out). I have a large mainwindow application and up until now I've kept most of the data handling in the slots that I've created in my mainwindow class, but I'm trying to redesign it as I've become more familiar with OOD techniques (and I'm not under a time constraint), so instead of handling both the data and ui aspect of, for instance, creating a new user in Mainwindow::on_NewUserPB_clicked(), I'm having that class call UserManager::CreateNewUser() to handle it.

So, my question is this: should I leave the ui management in my Mainwindow class and have my UserManager class handle only the model processing, or should I have UserManager handle both? I'm leaning strongly toward option one as it separate the two.

Thoughts? Thanks!


Kodi

alizadeh91
1st February 2013, 20:53
i think that your manager class should take care of model processing only and leave the ui management in mainwindow, although you can do some ui managements(like validations) in another class, that your manger class should handle it.

Santosh Reddy
1st February 2013, 21:28
So, my question is this: should I leave the ui management in my Mainwindow class and have my UserManager class handle only the model processing, or should I have UserManager handle both? I'm leaning strongly toward option one as it separate the two.
You have to realize the fact that user management is superficial, all that matter is functionality. Functionality meaning that all that user want to do (not how user does it).

So I will say,

-> All that user wants is core functionality (classes, interfaces, dependency....etc, may be OOP in your terms) should be your main concern.
-> All that user wants to do in a particular way (very often subjective) will form the UI part of the solution.

mtnbiker66
2nd February 2013, 20:38
Sounds like ya'll are confirming what I thought (thankfully, because I've spent hours recoding and separating UI from the model/data management!)

I appreciate the thoughts!

Santosh Reddy
2nd February 2013, 20:45
Don't worry, it will all be paid off, if not for you, than to somebody else.....:)