The Model View Controller concept is a bit hard to grasp at first, but trust me 
once you learned it, it will be your prefered method. You will never regret 
learning it.

As for your programming ability, it will improve by time, by setting new 
challenges you will learn and improve much faster, but you will likely feel 
that you are no good. The more often you face a problem, the quicker you can 
solve it. By trying to find always different problems to solve, you increase 
the chances of meeting a problem you already solved. So, don't be afraid of 
challenges, they'll be teaching you the most. 

What I would suggest is that you try to design your programs in a modular way 
so that you can later easily extend it, and if you know that you will have to 
add something in the future, try to accommodate it as early as possible. By 
that I mean make it easy to add. Otherwise there is always the possibility of 
refactoring.  

Regards Kris

PS.: I think I suck at programming, but I think I suck much less than a year 
ago, so I guess I have improved. ;) 

On Thu Jul 10 2014 16:19:10 GMT+0100 (BST), Chris Walker wrote:
> On Thu, 10 Jul 2014 15:45:08 +0100
> Krisztian Olah <fasza2mob...@gmail.com> wrote:
> 
> > First off, you should place each class to its own heeader and source
> > file to reduce future compile time. When you change only one class
> >  you won't have to recompile everything thus it's easier to find the
> > classes.
> > 
> > You should use one of the Qt Sql Model classes:
> > http://qt-project.org/doc/qt-4.8/sql-model.html
> > 
> > something like:
> > 
> > logic <-------> qml
> > logic <-------> databaseManager
> > databaseManager <-------> databaseModel
> > view <-------> databaseModel
> > 
> > logic has a member function/slot to return a pointer to the model that
> > qml displays in a view.
> > 
> > logic also has a function/slot that takes the required data from qml
> > that is needed to add  a new entry in the database. This function
> > invokes a member function of databaseManager that does the real work,
> > hence only databaseManager touches the database the view will
> > interact with the model to which it has a pointer from logic which in
> > turn asks  for the pointer from databaseManager. When a new entry is
> > added databaseManager updates its model that emits the needed signals
> > that informs any connected views about the changes.
> 
> What you describe is exactly what I would like to achieve with the next
> version of the program but one which uses 2 databases, one provided
> by an organisation called CAMRA - www.camra.org.uk and my own to record
> any visits to pubs and the beers I drink there.
> 
> But that's some way away as I my programming ability needs to improve
> considerably before I can do such things! When you get to my age, these
> things don't come easily. Certainly they don't for me.
> 
> Perhaps I should leave things as they are on this program and
> concentrate on the new one!
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
>
_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Reply via email to