Coding GUI's-formatting

1 view (last 30 days)
Dean
Dean on 27 Apr 2013
I am writing a pretty involved GUI to calculate skier projectiles and landing impacts. At this moment, most of the code I have written is external to the GUI--I'm making sure everything is running properly before I throw the code into the GUI. I have created all my functions in separate script files which reference each other. When it's time to transfer the code into the GUI is it a bad idea to have all these reference script files? Should I try to keep the GUI self contained by nesting all my functions?

Answers (1)

per isakson
per isakson on 27 Apr 2013
Edited: per isakson on 28 Apr 2013
I assume your "script files" define functions.
"I'm making sure everything is running properly before I throw the code into the GUI." Hopefully you have kept the code, which you used for testing. You might need to repeat some tests.
You do not mention GUIDE. I like that. I never use it.
" by nesting all my functions" Are you saying nested functions?
There is a "design pattern" for making gui-applications, which use nested functions. See GUI Examples using Nested Functions. I relied on that pattern for several years. (That was before Matlabs new OOP-support.) However, your "domain-specific" functions should not be included in the "GUI-functions".
IMO it is a really bad idea not to keep the tested functions as they are. Try to have them separated from the GUI (View) and keep exactly as they are. Invoke them from the callback-functions. Try to make the GUI "thin/dumb/humble".

Categories

Find more on Software Development Tools in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!