Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #2967 > unrolled thread
| Started by | "jasoncorbett" <jasoncorbett@THRWHITE.remove-dii-this> |
|---|---|
| First post | 2011-04-27 15:42 +0000 |
| Last post | 2011-04-27 15:42 +0000 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.java.gui
Good design and practice "jasoncorbett" <jasoncorbett@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
Re: Good design and pract "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
Re: Good design and pract "Karsten Lentzsch" <karsten.lentzsch@THRWHITE.remove-dii-this> - 2011-04-27 15:42 +0000
| From | "jasoncorbett" <jasoncorbett@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:42 +0000 |
| Subject | Good design and practice |
| Message-ID | <29de809c-7075-4135-94cd-1d71258fa162@l1g2000hsa.googlegroups.com> |
To: comp.lang.java.gui I've mostly programmed backend servers, and enjoy Java a great deal. I've gotten to a point where I have to write some GUI for my backend machines. I dislike most gui code I've seen (not that much) because it appears to me to be a complete mess. I used a gui designer and it produced a huge java file that I would be embarrassed to put my name on. Is their a good method to writing nicely coded gui's. I'm not so concerned with what the ui should look like (there is a lot of good info about that), mostly about how to design and code a gui in a good manner. I've read a lot on MVC, but I rarely see code that reflects what I think good MVC should be. Is this a common problem, am I going about this all wrong? Jason --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [next] | [standalone]
| From | "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:42 +0000 |
| Subject | Re: Good design and pract |
| Message-ID | <7fnqn3dchrmktofc63s35ml8a5t7tm6hb5@4ax.com> |
| In reply to | #2967 |
To: comp.lang.java.gui On Thu, 3 Jan 2008 11:34:33 -0800 (PST), jasoncorbett@gmail.com wrote, quoted or indirectly quoted someone who said : > I dislike most gui code I've seen (not that much) because >it appears to me to be a complete mess When I first saw GUI code, for a prototype MacIntosh on the Lisa, I said, "You have got to be kidding. Nobody is going to go to all this fuss for a simple app. I was wrong." It has not improved that much. Some things you can do. 1. Subclass components to put in all your standard tweakings. That way you can change your "style" in one place and reduce the clutter. We need something the equivalent of CSS style sheets for Java GUIs to hide the details of layout and look. That goes much further than just subclassing. 2. use nested panels. 3. separate the allocation and field attributes from the layout. Keep business logic separate from both. 4. make great use of the "extract constant" feature to parameterise your code with named constants. It is a lot easier to maintain a named constant that dig in the code for multiple places to change something. 5. keep your attribute setting methods is a standard order. -- Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Karsten Lentzsch" <karsten.lentzsch@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:42 +0000 |
| Subject | Re: Good design and pract |
| Message-ID | <flkse6$ogk$02$1@news.t-online.com> |
| In reply to | #2967 |
To: comp.lang.java.gui jasoncorbett@gmail.com wrote: > [...] > Is their a good method to writing nicely coded gui's. I'm not so > concerned with what the ui should look like (there is a lot of good > info about that), mostly about how to design and code a gui in a good > manner. > > I've read a lot on MVC, but I rarely see code that reflects what I > think good MVC should be. Is this a common problem, am I going about > this all wrong? I recommend other patterns than MVC. For me MVC is good as a component pattern, for applications there are better patterns. 1) As with MVC, separate the domain from the rest. 2) Almost always separate the GUI construction, configuration, layout, and fine grained events (e.g. mouse over) from the presentation logic; hence, use an MVP variant or "Presentation Model". The choice between MVP and "Presentation Model" depends on the toolkit, associated binding support, etc. For Swing, I favor to follow the "Presentation Model" pattern, because several Swing core components already use this pattern. I provide a free presentation regarding Java desktop patterns that presents and compares MVC, MVP, and Presentation Model, see http://www.jgoodies.com/articles/ I also provide a free binding library that assists in using the Presentation Model pattern, see http://www.jgoodies.com/downloads/libraries.html Just as a side note. I recommend to favor flat over nested panels for editor that are perceived as a single sheet. Nesting in Swing means loosing layout constraints, grid information, and hence ends up often in unaligned, arbitrary component positions. -Karsten --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.gui
csiph-web