cs338-l2 - college of computing & informatics · page 4 cs 338: graphical user interfaces....

8
Page 1 1 CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. Lecture 2: Design & Implementation CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 2 Human-computer interaction is a discipline concerned with the design, implementation, and evaluation of interactive systems for human use and with the study of the major phenomena surrounding them. The HCI lifecycle is an iterative cycle that involves designing and evaluating with “users” as much as possible. Design Prototype Evaluate Human-computer interaction CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 3 Users and limitations Before getting to implementation, let’s look just one more time at users and their limitations… <clips> CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 4 Building user interfaces Much of this process is smart, good ol’ software engineering applicable to the GUI parts of the system applicable to non-GUI parts of the system This course focuses on the implementation of the GUI parts BUT... We always keep in mind the other aspects of the process, particularly design

Upload: others

Post on 14-Aug-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: cs338-l2 - College of Computing & Informatics · Page 4 CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 13 Why are good GUIs hard to build? • Multiprocessing:

Page 1

1 CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University.

Lecture 2: Design & Implementation

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 2

•  Human-computer interaction is a discipline concerned with the design, implementation, and evaluation of interactive systems for human use and with the study of the major phenomena surrounding them.

•  The HCI lifecycle is an iterative cycle that involves designing and evaluating with “users” as much as possible.

Design Prototype

Evaluate

Human-computer interaction

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 3

Users and limitations

•  Before getting to implementation, let’s look just one more time at users and their limitations…

•  <clips>

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 4

Building user interfaces

•  Much of this process is smart, good ol’ software engineering –  applicable to the GUI parts of the system –  applicable to non-GUI parts of the system

•  This course focuses on the implementation of the GUI parts

•  BUT... We always keep in mind the other aspects of the process, particularly design

Page 2: cs338-l2 - College of Computing & Informatics · Page 4 CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 13 Why are good GUIs hard to build? • Multiprocessing:

Page 2

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 5

Mental & implementation models

•  Implementation models describe how we, as programmers, think about the system –  there are many levels to these models –  e.g., when you write “x++”, we increment x –  but what happens in the processor? cache? ...

•  Mental models describe how the user thinks about the system –  not the same as the implementation model! –  e.g., saving changes (Word file vs. file system) –  e.g., movie/film projection –  e.g., household electricity

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 6

Designing for the mental model

•  Computer Science people build systems. Not surprisingly, then, most systems conform to implementation models.

•  Book example: Windows file system –  drag file within drive (e.g., C->C drive)

-> file moves to new location –  drag file to another drive (e.g., C->D drive)

-> file is copied to new location –  why? implementation of file system –  this puts the burden of understanding low-level

file system details on the user

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 7

•  Another example: Word references –  link number to other part of the document –  mental model: this stays linked –  implementation model: link gets broken, but

software doesn’t correct — makes you do it!

Designing for the mental model

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 8

New technology & mental models

•  Sometimes, new technology warrants breaking old mental models — carefully!

•  Example: the good ol’ calendar

“Significant change must be significantly better.”

Page 3: cs338-l2 - College of Computing & Informatics · Page 4 CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 13 Why are good GUIs hard to build? • Multiprocessing:

Page 3

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 9

Design & implementation: Summary

•  Good, clean implementations facilitate good, clean user interfaces. –  efficient code leads to faster response –  well structured code leads to simple interfaces

(and simple is good! -- easy to learn, remember) –  robust code doesn’t crash

•  Good implementation doesn’t make up for bad design, and good design doesn’t help a bad implementation.

•  Implementation & design go hand-in-hand!

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 10

Design & implementation tradeoffs

•  Example: Mac OS X launcher –  design issues? –  implementation issues?

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 11

Design & implementation

•  Example: Two web-based input interfaces –  design issues? –  implementation issues?

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 12

When GUIs work well...

•  Shorter training time -> lower costs •  Fewer errors -> less hassle, lower costs •  Less maintenance -> less hassle, lower costs •  High transfer -> lower future costs

•  In other words: Good design saves time. Good design saves money.

Page 4: cs338-l2 - College of Computing & Informatics · Page 4 CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 13 Why are good GUIs hard to build? • Multiprocessing:

Page 4

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 13

Why are good GUIs hard to build?

•  Multiprocessing: UIs are inherently concurrent! –  multiple inputs, redraws –  synchronization, deadlock prevention

•  Must deal with abort, undo, redo anytime (this requires lots of state info to be kept)

•  Real-time requirements •  Must be robust (users do lots of odd things!)

Thanks to Scott MacKenzie @ York U for the next few slides!!

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 14

Why are good GUIs hard to build?

•  API & UI logic complexity •  Reactive instead of proactive: the user

dictates what the system should do •  Hard to modularize (OOP interface design) •  Exhaustive testing of UIs is hard – how to

ensure robustness? •  Evaluation with users is time consuming •  And more...

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 15

Research Question of the Day

•  We’ll spend lots of time worrying about the user interface part of an application.

•  What’s the big deal? How important is this when implementing an application?

•  Specifically, how much programming in a typical system is devoted to the interface?

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 16

Research Question of the Day

•  Myers & Rosson (1992) conducted this survey •  They analyzed 74 systems of various flavors

Myers, B.A., & Rosson, M. B. (1992). Survey on user interface programming. In Human Factors in Computing Systems: Proceedings of SIGCHI’92 (pp. 195-202). New York: ACM Press.

Page 5: cs338-l2 - College of Computing & Informatics · Page 4 CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 13 Why are good GUIs hard to build? • Multiprocessing:

Page 5

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 17

Research Question of the Day

•  Result: User interface required... –  44.8% of design time –  50.1% of implementation time –  37.0% of maintenance time

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 18

Research Question of the Day

•  Interesting point: although UI = 50% of code on average, this varied greatly per system...

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 19

Research Question of the Day

•  Other interesting points –  prototypes & evaluation

•  46% built running prototypes •  17% used paper-based designs

–  use of graphics •  70% 2D graphics, 14% 3D graphics

–  use of programming languages •  69% used C •  others used many (>10) other languages •  58% used multiple languages in the same system!

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 20

How do we implement GUIs?

•  For many programs in CS coursework…

•  For typical GUI applications…

•  This leads to a very different style of design and implementation!

args files

stdout, files program user user

user

input (mouse, keys, etc.)

program output

(text, images, etc.)

Page 6: cs338-l2 - College of Computing & Informatics · Page 4 CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 13 Why are good GUIs hard to build? • Multiprocessing:

Page 6

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 21

History of Java

•  Has its beginnings as a way to create interaction / animation on the Web

•  Its big selling point: Portability –  “works everywhere” (citing Sun) –  interpreted

•  Other selling points (citing Sun again) –  simple (?) –  object-oriented –  robust –  high performance (?)

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 22

public class Animal {

public String foo () { return "Animal"; }

}

public class Platypus extends Animal

{ public String foo () { return "Platypus"; }

}

public static void main (String[] args) {

Animal x = new Animal (); System.out.println (x.foo());

}

Java Classes & Inheritance

•  What is this program’s output?

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 23

public class Animal {

public String foo () { return "Animal"; }

}

public class Platypus extends Animal

{ public String foo () { return "Platypus"; }

}

public static void main (String[] args) {

Platypus x = new Platypus (); System.out.println (x.foo());

}

Java Classes & Inheritance

•  How about this program?

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 24

public class Animal {

public String foo () { return "Animal"; }

}

public class Platypus extends Animal

{ public String foo () { return "Platypus"; }

}

public static void main (String[] args) {

Animal x = new Platypus (); System.out.println (x.foo());

}

Java Classes & Inheritance

•  How about this program?

Page 7: cs338-l2 - College of Computing & Informatics · Page 4 CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 13 Why are good GUIs hard to build? • Multiprocessing:

Page 7

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 25

Java Interfaces

•  An interface with a single method:

•  We implement the interface as follows:

•  Q: How is an interface different from a class?

public interface ActionListener { void actionPerformed (ActionEvent e); }

public class MyClassThatListens … implements ActionListener { … public void actionPerformed (ActionEvent e) { … } … }

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 26

Java Exceptions

•  If a called method throws an exception, the caller needs to catch the exception

public class <SomeIOClass> {

public void <SomeIOMethod> { … <if error> throw new IOException (); … }

}

public static void main (String[] args) {

try { <SomeIOMethod> (); } catch (IOException e) { <handle the error> }

}

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 27

Java and GUIs

•  Platform independence for GUI applications has been notoriously hard

•  Java’s first foray: AWT (Abstract Window Toolkit) –  provided common code for widgets —

components such as windows, buttons, menus, … –  good first start, but platform independence

wasn’t quite there •  AWT relied on windowing code on native machine

–  so in practice, somewhat flaky

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 28

Java and GUIs

•  Current Java 2: integrated JFC & Swing •  Swing

–  GUI component toolkit, including all widgets –  no native windowing code, to improve on AWT

•  JFC (Java Foundation Classes) –  includes Swing components –  includes other software such as…

•  “pluggable look and feel” •  accessibility support for disabled

•  AWT still there, but we can mostly ignore it

Page 8: cs338-l2 - College of Computing & Informatics · Page 4 CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 13 Why are good GUIs hard to build? • Multiprocessing:

Page 8

CS 338: Graphical User Interfaces. Dario Salvucci, Drexel University. 29

Advantages of Java for our course

•  Short(er) learning time •  Portability across platforms (with caveats) •  Breadth of built-in components •  Extensibility to Web applications

•  And more generally… Basic concepts of GUIs are the same no matter what language you’re using