It is very common to see people asking for advice on how to move a command-line-only application that they have already written to a graphical interface, for reasons discussed at the end of the previous chapter, such as ease of use and familiarity.Â
How easy this is to do is largely dependent on the choice of data structure used within the application. If the application's main logic is too intertwined with data collection and storage, then porting can become a nightmare. If you find yourself with a command-line application that you wish to convert, take the time to consider how separable these two pieces are.
If you are not using classes, could you split certain pieces out into small, reusable classes which could then be shared into a new file? Since classes are almost a necessity for building graphical applications...