From: sinkwitz@ifi.unizh.ch (Rainer Sinkwitz)
Subject: Re: X: User simplicity vs code complexity
Organization: University of Zurich, Department of Computer Science
Date: Tue, 28 Jul 92 14:34:41 GMT


In article <TPAQUETTE.92Jul23134924@gumby.ita.lgc.com>, tpaquette@ita.lgc.com (Trevor Paquette) writes:
> 
>    I was talking to a cohort at work and we got to the subject of X and how
>  many lines of code it takes to do things in X etc..
> 
>    I came up with "X is the perfect example of User simplicity is directly
>  proportional to code complexity." Do you agree/disagree with this statement
>  and why?
> 
>  To open up a window, create a button, attach a callback to that button
>  when pushed, released and held, while tracking the mouse, takes up a alot
>  of lines of code. (Granted that will take alot of lines in any GFX system
>  but most likely more in X then any other)
> 
>    To know X and all the in/outs of it takes about 8 700 page manuals (O'Reilly
>  & Associate) to learn. Is there ANYONE out there who knows EVERYTHING in
>  these manuals? X is difficult to learn to program with, basically because
>  you don't know where to start!! There are many calls that do basically the
>  same thing (XAllocColor vs XAllocColorCells).
> 
>    How big is X going to get? When will it stop getting bigger? Who created
>  this monster in the first place? Oh well.. back to those manuals..
> 

If you compare the Xlib and IRIS GL on Silicon Graphics you see that 
many things can be done a lot easier.

IRIS GL heavily relies on defaults and most of the function calls 
only specify what has not been specified before. 

The following opens two windows and draws two different triangles in them:
If you compare Xlib : -------------------------------

	XPoint points[3]; 

	dpy = XOpenDisplay( (char *) NULL );	/* Initialization */
	screen_num = DefaultScreen(display);
	win1 = XCreateSimpleWindow(display, RootWindow(display,screen_num),
                  x1, y1, width1, height1, border_width, BlackPixel(display,
                  screen_num), WhitePixel(display,screen_num));
	win2 = XCreateSimpleWindow(display, RootWindow(display,screen_num),
                  x2, y2, width2, height2, border_width, BlackPixel(display,
                  screen_num), WhitePixel(display,screen_num));
        gc = DefaultGC(dpy, screen_num);
        .......
        points[0].x = 0;		points[0].y = height-1;   /* Redraw */
        points[1].x = (width-1)/2;	points[1].y = 0;
        points[2].x = width-1;		points[2].y = height-1;
        XDrawLines(dpy, win1, gc, points, 3, CoordModeOrigin);
        
        points[0].x = 0;		points[0].y = 0;
        points[1].x = (width-1)/2;	points[1].y = height-1;
        points[2].x = width-1;		points[2].y = 0;
        XDrawLines(dpy, win3, gc, points, 3, CoordModeOrigin);
        
... with IRIS GL  : -------------------------------
	
	prefposition(x1, y1);		/* Initialization */
	prefsize(width1, height1);
	win1 = winopen(window_name1);
	
	prefposition(x2, y2);
	prefsize(width2, height2);
	win2 = winopen(window_name2);
	.......
	winset(win1);			/* Redraw */
	bgnclosedline();
	v2i(0, 0);
	v2i((width-1)/2, height-1);
	v2i(width-1, 0);
	endclosedline();
	
	winset(win2);
	bgnclosedline();
	v2i(0, height-1);
	v2i((width-1)/2, 0);
	v2i(width-1, height-1);
	endclosedline();
	
... you see that IRIS GL is concise and Xlib is not. This mostly also
applies to the rest of the X world as long as the language is C (XView
probably excluded).

Desperately waiting for the OpenGL extension... :-)

-- 
oooooo    oooo  Rainer Sinkwitz, Multimedia Lab         sinkwitz@ifi.unizh.ch
 $   $   $   "  University of Zurich, Switzerland        VOICE +41-1-257-4346
 $"$$    """"$  Inst.f.Informatik, Winterthurerstr. 190   FAX +41-1-363-00-35
o$o "$o  $ooo"  CH-8057-Z\"urich