How To Overcome GUI Spaghetti Code?

I’m currently in the process of producing a Design Doc for what is rapidly becoming a monster of a project.

At the moment I’m thinking about GUI and the best way to overcome Spaghetti code when it comes to UI layout, Menus, buttons, etc…

There’s a treasure trove of information on GUI embracing the OOP design pattern, in fact it seems to be fundamentally based on the principle. So it got me thinking what would be the best way to go about this with Corona, in particular to avoid the necessity of positioning elements, listener functions and generally getting into a bit of a mess.

So I’m seeking opinions as to whether anybody has tried to tackle this and what would be the best way. I’ve been reading through this article (http://rivermanmedia.com/object-oriented-game-programming-the-gui-stack/) and appreciate the idea behind it.

I put all my button names in a table then I setup button in a for loop set id to button name use math for positions all buttons go to one function that has a table of functions like this

function onBtnRelease(event) local fnct={} function.play() ...... end fnct[event.target.id]() end

My soon to be release appLog module demos this where I build several menus with diff. Color buttons labels actions all created and controlled by one newButton function and one release function

I put all my button names in a table then I setup button in a for loop set id to button name use math for positions all buttons go to one function that has a table of functions like this

function onBtnRelease(event) local fnct={} function.play() ...... end fnct[event.target.id]() end

My soon to be release appLog module demos this where I build several menus with diff. Color buttons labels actions all created and controlled by one newButton function and one release function