Do everything in Java…

Russel Winder via Digitalmars-d digitalmars-d at puremagic.com
Sat Dec 6 07:09:21 PST 2014


On Fri, 2014-12-05 at 12:44 -0800, Walter Bright via Digitalmars-d wrote:
> On 12/5/2014 5:41 AM, H. S. Teoh via Digitalmars-d wrote:
> > As for GUI code, I've always been of the opinion that it should be 
> > coded in such a way as to be fully scriptable. GUI's that can only 
> > operate when given real user input has failed from the start IMO, 
> > because not being scriptable also means it's non-automatable 
> > (crippled, in my book), but more importantly, it's not auto-
> > testable; you have to hire humans to sit all day repeating the 
> > same sequence of mouse clicks just to make sure the latest dev 
> > build is still working properly. That's grossly inefficient and a 
> > waste of money spent hiring the employee.

You actually need both. Scripting end-to-end tests, systems tests, 
etc. is important but most systems also needs humans to try things out.

> A complementary approach is to have the UI code call "semantic" 
> routines that
> are in non-UI code, and those semantic routines do all the semantic 
> work. That
> minimizes the UI code, and hence the testing problem.

The usual model is that GUI code only has GUI code and uses a Mediator 
and/or Façade to access any other code. Similarly separate business 
rules from database access (DAO, etc.). Separation of Concerns, Three 
Tier Model, MVC, MVP, there are masses of labels for the fundamental 
architecture, but it is all about modularization and testability.

> Most GUI apps I've seen mixed up all that code together.

You haven't seen many then :-), and most of them have been crap and 
should have had the incantation "rm -rf *" applied.

--
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder



More information about the Digitalmars-d mailing list