Hi!

*TL;DR: GUI applications seems pretty hard to structure the code in a 
readable way. Can anyone recommend any patterns/layout or suggestions to 
structuring such a codebase and keeping it readable?*

I wrote a GUI application in Go late at night once (using gotk3). I tried 
to keep it readable by functionally decomposing methods, keeping as much 
private as possible, and keeping different dialogs/windows etc in different 
packages (each dialog/window was mapped to a struct).

Despite this, each struct quickly turned into existential spaghetti, with 
10-20 fields on each struct and over a dozen methods, with quite high 
coupling.

I thought about trying to break down pieces into smaller components (like a 
struct for a subset of fields on the page), but that seemed like more 
boilerplate with still quite a bit of coupling.

So my question is this: How do you structure Go GUI programs? What patterns 
work? Anything well-written & open-source I can learn from?

GUI programs seems particularly heinous compared to server or system 
programs, which (at least to me) seem a lot easier to tease out parts & 
keep them simple-looking.

Thanks & love,
Tom

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to