Coding GUI's-formatting

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?

답변 (1개)

per isakson
per isakson 2013년 4월 27일
편집: per isakson 2013년 4월 28일

0 개 추천

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".

카테고리

도움말 센터File Exchange에서 Performance and Memory에 대해 자세히 알아보기

질문:

2013년 4월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by