# MQTT and Tcl/Tk - Reflections

## Reflections

If I learned anything from working on our MQTT application it would be this:  > Learn first, then code.  After reading a number of books, watching numerous videos, and reading as many articles, I have a better understanding of MQTT, its purpose, and how it works behind the scenes.  Through this process, I learned the MQTT application is missing a number of "must-have" and much more "nice to have" features.

I started with a focus to connect to a broker and to publish, subscribe, and unsubscribe from a given topic.  Although successful, initial efforts were predicated on writing the least amount of code to establish a connection and perform subsequent "transactions."  As I continued to learn, I realized there is more to MQTT than simply making a connection.  Understanding the differences between MQTT 3.1.1 and MQTT 5 suggests the MQTT community realized this as well.

## Next Steps

This realization comes with the inevitable "coding" challenge and considerations for features that will benefit our MQTT application including management of:

- Multiple brokers/connections
- Multiple client id's
- Multiple topics
- Multiple brokers
- Last Will & Testament settings
- Quality of Service levels
- Security protocols (Usernames and Passwords)

The above list is sure to grow as the application continues to evolve.  We must take advantage, and be mindful, of Tcl/Tk's language features.  Fortunately, Tcl/Tk makes it easy to develop sophisticated GUI front-end interfaces and simplifies the creation of "complex" object-oriented data structures.

Some would argue that Tcl/Tk is too slow for a large-scale application.  Fortunately, FORTRAN and C (C++) code typically comprise the core "number crunching" aspects of the application and are easily integrated into a Tcl/Tk application.  

## Future Application State

The overarching "main" application will provide features that are outside the scope of the MQTT protocol such as date-time stamping messages, data logging, and the use of data for which the application was written.

Eventually, MQTT will be a single top-level menu item that will enable multiple data sources to work interactively with our main application.
