Article Preview
Buy Now
FEATURE
Refactoring a Controller Module, Part 1
Dividing the medication controller module
Issue: 16.4 (July/August 2018)
Author: JC Cruz
Article Description: n>No description availabl
Article Length (in bytes): 43,731
Starting Page Number: r>
Article Number: 16404
Resource File(s):
project16404.zip Updated: 2018-07-02 22:39:13
Related Link(s): None
Excerpt of article text...
In my last three articles, I extolled the benefits of a model class. I explained how I designed two model classes: one for database data, the other for predicate data. I also showed how I incorporated those models into a controller module.
Now I turn my focus on the controller module. I have already modified one such module (namely,
vitalsLib
). But what if the controller module works with multiple database tables? What if it does more than just manage the data flow between views and models?I shall describe the steps I took in this article.
Readers must have a working knowledge of Xojo, SQLite, and object-oriented design. The updated version of the demo project FooHealth (Mk13) is available from the magazine's website.
Planning The Update
When I updated the controller module
vitalsLib
, I made three key changes. I replaced its properties with instances of the ModelSQL class. I rewrote its entry methods to make use of instances of ModelPredicate and ModelSQL. And I removed those private methods made redundant by ModelSQL.
...End of Excerpt. Please purchase the magazine to read the full article.