You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Bilgin Ibryam <bi...@iguanait.com> on 2008/12/09 11:24:26 UTC

Re: Discussion: Screen Widget Java Code Cleanup



Adrian Crum-2 wrote:
> 
> --- On Wed, 11/26/08, David E Jones <da...@hotwaxmedia.com> wrote:
>> Do you have any specific bits of messy code in mind? I
>> don't mean to imply that I don't believe this might
>> help, but how does moving the code from one class to another
>> clean up the code?
> 
> I didn't want to go into specifics because I didn't want to hurt any
> feelings or step on any toes. But here goes - using the current
> ModelScreenWidget.java as an example:
> 
> 1. Line 797, 899, 1236 - HTML specific code inserted into model widget.
> 2. Lines 972 to 986 - lost indirection.
> 3. Line 1072 - non thread-safe code. Btw, after I make my proposed
> changes, code like that won't even compile.
> 4. Any method whose name starts with "set" - these classes are supposed to
> be immutable.
> 5. Any method that pushes and pops the context MapStack - that's a
> rendering detail the model widget shouldn't be concerned with.
> 6. Any method that makes multiple calls to the ScreenStringRenderer
> interface - the model class is trying to force a rendering sequence. This
> was a problem for me a couple of years ago when I tried to do some work on
> the tree widget.
> 
> 

I think using some design patterns in widget code may help committers to
decide what should go in the project and what not. Also may help to people
who are familiar with this patters, easily understand the widget code.

Just my 2 cents.
Bilgin

PS: In OFBIZ-1935, I added methods to ModelWidget which use globalContext.
Do you think that this breaks any design pattern used already in widgets?
-- 
View this message in context: http://www.nabble.com/Discussion%3A-Screen-Widget-Java-Code-Cleanup-tp20712463p20912034.html
Sent from the OFBiz - Dev mailing list archive at Nabble.com.