Spring 20116.813/6.831 User Interface Design and Implementation1 Lecture 9: UI Software Architecture RS1 (for 6.831G), PS1 (for 6.813U) released today,

Slides:



Advertisements
Similar presentations
Computer and Communication Fundamental Basic web programming Lecture 8 Rina Zviel-Girshin.
Advertisements

The Web Warrior Guide to Web Design Technologies
Spring /6.831 User Interface Design and Implementation1 Lecture 10: Layout.
OOP Design Patterns Chapters Design Patterns The main idea behind design patterns is to extract the high level interactions between objects and.
A graphical user interface (GUI) is a pictorial interface to a program. A good GUI can make programs easier to use by providing them with a consistent.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
Automating Tasks With Macros
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Graphical User Interface (GUI) Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 3-1 of…
Graphical User Interface (GUI) Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
0 CS 160: Design Process: Implement Event-based UI Programming, Model-View-Controller, and the Web Jeffrey Nichols IBM Almaden Research Center
Object-Oriented Analysis and Design
Chapter 7 Improving the User Interface
User Interface Toolkits Professor: Tapan Parikh TA: Eun Kyoung Choe
Stanford hci group / cs376 research topics in human-computer interaction UI Software Tools Scott Klemmer 27 October 2005.
Spring /6.831 User Interface Design and Implementation1 Lecture 8: Generating Designs.
Printing and Page Formatting ITSW 1401, Intro to Word Processing Instructor: Glenda H. Easter.
Slide 1 Chapter 2 Visual Basic Interface. Slide 2 Chapter 2 Windows GUI  A GUI is a graphical user interface.  The interface is what appears on the.
Visual Basic Chapter 1 Mr. Wangler.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
MVC and MVP. References enter.html enter.html
Spring /6.831 User Interface Design and Implementation1 Lecture 3: Visibility.
Model View Controller (MVC) Rick Mercer with a wide variety of others 1.
Java Programming, 3e Concepts and Techniques Chapter 3 Section 65 – Manipulating Data Using Methods – Java Applet.
Execution Environment for JavaScript " Java Script Window object represents the window in which the browser displays documents. " The Window object provides.
© 2000 – All Rights Reserved - Page 1 Introduction to JavaScript Programming Part Two.
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
© 2006 Lawrenceville Press Slide 1 Chapter 3 Visual Basic Interface.
Introduction to Matlab & Data Analysis
Java Software Solutions Lewis and Loftus Chapter 10 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Graphical User Interfaces --
Fall UI Design and Implementation1 Lecture 9: Declarative UI.
GUI development with Matlab: GUI Front Panel Components 1 GUI front panel components In this section, we will look at -GUI front panel components -Programming.
GUI Widgets Jeff Offutt SWE 432 Design and Implementation of Software for the Web.
Object Oriented Software Development 9. Creating Graphical User Interfaces.
JavaScript - A Web Script Language Fred Durao
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Concurrent Programming and Threads Threads Blocking a User Interface.
Lecture 10 JavaScript: DOM and Dynamic HTML Boriana Koleva Room: C54
Model View Controller A Pattern that Many People Think They Understand, But Has A Couple Meanings.
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
Java Applets: GUI Components, Events, Etc. Ralph Westfall June, 2010.
Interactive Programs Java API. Terminology Event—an action or occurrence, not part of a program, detected by the program. Events can be Event—an action.
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
SEEM3460 Tutorial GUI in Java. Some Basic GUI Terms Component (Control in some languages) the basic GUI unit something visible something that user can.
May 12, 1998CS102-01Lecture 7-3 Building GUIs in Java I CS Lecture 7-3 A picture's worth a thousand words.
Fall UI Design and Implementation1 Lecture 17: Toolkits.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 14 Event-Driven Programming with Graphical User Interfaces.
Java - hello world example public class HelloWorld { public static void main (String args[]) { System.out.println("Hello World"); }
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
Interstage BPM v11.2 1Copyright © 2010 FUJITSU LIMITED FORMS.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Presented by Alexey Vedishchev Developing Web-applications with Grails framework American University of Nigeria, 2016 Intro To MVC Architecture.
Programming Logic and Design Seventh Edition Chapter 12 Event-Driven GUI Programming, Multithreading, and Animation.
Chapter Topics 15.1 Graphical User Interfaces
Prototyping.
Chap 7. Building Java Graphical User Interfaces
Accessibility & UI Arch.
Web Development Using ASP .NET
Chapter 15: GUI Applications & Event-Driven Programming
Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.
A picture's worth a thousand words
Presentation transcript:

Spring /6.831 User Interface Design and Implementation1 Lecture 9: UI Software Architecture RS1 (for 6.831G), PS1 (for 6.813U) released today, due Sunday

UI Hall of Fame or Shame? Spring /6.831 User Interface Design and Implementation2

UI Hall of Fame or Shame? Spring /6.831 User Interface Design and Implementation3

Nanoquiz closed book, closed notes submit before time is up (paper or web) we’ll show a timer for the last 20 seconds Spring /6.831 User Interface Design and Implementation

1.Suppose a user buying a laptop can choose one of 5 different colors for Its case. Which of the following are bad ways to offer this choice to the user? (choose all bad answers) A. 5 radio buttons B. 5 checkboxes C. a textbox D. a drop-down menu 2.Which of the following is likely to be involved in a storyboard? (choose all good answers) A. scenario B. user interface toolkit C. persona D. sketches 3.Which of the following are widely-accepted good practices in early stages of user interface design? (choose all good answers) A. Drawing by hand on paper B. Coming up with ideas independently before group discussion C. Getting feedback from users Spring /6.831 User Interface Design and Implementation

Today’s Topics Design patterns for GUIs –View tree –Listener –Widget –Model-view-controller Approaches to GUI programming –Procedural –Declarative –Direct manipulation Web UI at lightning speed –HTML –Javascript –jQuery Spring /6.831 User Interface Design and Implementation6

View Tree A GUI is structured as a tree of views –A view is an object that displays itself on a region of the screen 6.813/6.831 User Interface Design and Implementation main panel toolbar palette drawing area Spring splitter

How the View Tree Is Used Output –GUIs change their output by mutating the view tree –A redraw algorithm automatically redraws the affected views Input –GUIs receive keyboard and mouse input by attaching listeners to views (more on this in a bit) Layout –Automatic layout algorithm traverses the tree to calculate positions and sizes of views 6.813/6.831 User Interface Design and ImplementationSpring 20118

Input Handling Input handlers are associated with views –Also called listeners, event handlers, subscribers, observers 6.813/6.831 User Interface Design and Implementation click listener drag listener Spring main panel toolbar palette drawing area splitter

Listener Pattern GUI input handling is an example of the Listener pattern –aka Publish-Subscribe, Event, Observer An event source generates a stream of discrete events –e.g., mouse events Listeners register interest in events from the source –Can often register only for specific events – e.g., only want mouse events occurring inside a view’s bounds –Listeners can unsubscribe when they no longer want events When an event occurs, the event source distributes it to all interested listeners 6.813/6.831 User Interface Design and ImplementationSpring

Separating Frontend from Backend We’ve seen how to separate input and output in GUIs –Output is represented by the view tree –Input is handled by listeners attached to views Missing piece is the backend of the system –Backend (aka model) represents the actual data that the user interface is showing and editing –Why do we want to separate this from the user interface? 6.813/6.831 User Interface Design and ImplementationSpring

Model-View-Controller Pattern Spring /6.831 User Interface Design and Implementation12 Model View Controller Model maintains application state implements state-changing behavior sends change events to views Controller handles input listens for input events on the view tree calls mutators on model or view View handles output gets data from the model to display it listens for model changes and updates display get() & set() methods get() methods change events input events get() & set() methods

Advantages of Model-View-Controller Separation of responsibilities –Each module is responsible for just one feature Model: data View: output Controller: input Decoupling –View and model are decoupled from each other, so they can be changed independently –Model can be reused with other views –Multiple views can simultaneously share the same model –Views can be reused for other models, as long as the model implements an interface 6.813/6.831 User Interface Design and ImplementationSpring

A Small MVC Example: Textbox Spring /6.831 User Interface Design and Implementation14 DocumentJTextField KeyListener Document represents a mutable string of characters move cursor get text text change events keypress events edit text JTextField is a Component that can be added to a view tree KeyListener is a listener for keyboard events

A Larger MVC Example 6.813/6.831 User Interface Design and Implementation Filesystem KeyListener FilesystemTree Model View Controller observer methods (e.g. getRootFolder(), getFiles()) mutator methods (e.g. deleteFile()) keyPressed() change events (e.g. fileDeleted()) Spring

Hard to Separate Controller and View Controller often needs output –View must provide affordances for controller (e.g. scrollbar thumb) –View must also provide feedback about controller state (e.g., depressed button) State shared between controller and view: Who manages the selection? –Must be displayed by the view (as blinking text cursor or highlight) –Must be updated and used by the controller –Should selection be in model? Generally not Some views need independent selections (e.g. two windows on the same document) Other views need synchronized selections (e.g. table view & chart view) Spring /6.831 User Interface Design and Implementation16

Widget: Tightly Coupled View & Controller The MVC idea has largely been superseded by an MV (Model-View) idea A widget is a reusable view object that manages both its output and its input –Widgets are sometimes called components (Java, Flex) or controls (Windows) Examples: scrollbar, button, menubar Spring /6.831 User Interface Design and Implementation17

A Different Perspective on MVC Spring /6.831 User Interface Design and Implementation18 Model View Controller Model maintains application state implements state-changing behavior sends change events to controller Controller mediates between model & view listens for input events on the view and change events on the model calls mutators on model or view View handles output & low-level input sends high-level events to the controller get() & set() methods change events input events get() & set() methods

GUI Implementation Approaches Procedural programming –Code that says how to get what you want (flow of control) Declarative programming –Code that says what you want (no explicit flow of control) Direct manipulation –Creating what you want in a direct manipulation interface Spring /6.831 User Interface Design and Implementation19 Declarative A tower of 3 blocks. Procedural 1. Put down block A. 2. Put block B on block A. 3. Put block C on block B. Direct Manipulation

Markup Languages HTML declaratively specifies a view tree What are you doing now? Send sign out Spring /6.831 User Interface Design and Implementation20 text text text

HTML Syntax Spring /6.831 User Interface Design and Implementation21

Important HTML Elements for UI Design Layout Box Grid,, Text Font & color Widgets Hyperlink Button Textbox Multiline text Rich text Drop-down Listbox Checkbox Radiobutton Spring /6.831 User Interface Design and Implementation22 Pixel output Stroke output (Firefox, Safari) Javascript code CSS style sheets

View Tree Manipulation Javascript can procedurally mutate a view tree var doc = document var div1 = doc.createElement("div") div1.appendChild(doc.createTextNode("What are you doing now?”) … var div3 = doc.createElement("div") var button = doc.createElement("button") button.appendChild(doc.createTextNode("Send")) div3.appendChild(button) var a = doc.createElement("a") a.setAttribute("href", "#") a.appendChild(doc.createTextNode("sign out")) div3.appendChild(a) Spring /6.831 User Interface Design and Implementation23

Javascript in One Slide Like Java… expressions hyp = Math.sqrt(a*a + b*b) console.log(“Hello” + “, world”); statements if (a < b) { return a } else { return b } comments /* this is a comment */ // and so is this Like Python… no declared types var x = 5; for (var i = 0; i < 10; ++i) {…} objects and arrays are dynamic var obj = { x: 5, y: -1 }; obj.z = 8; var list = [“a”, “b”]; list[2] = “c”; functions are first-class function square(x) { return x*x; } var double = function(a) { return 2*a; } Spring /6.831 User Interface Design and Implementation24

jQuery in One Slide Select nodes $(“#send”) $(“.toolbar”) $(“button”) Create nodes $(‘ ’) Act on nodes $(“#send”).text() // returns “Send” $(“#send”).text(“Tweet”) // changes button label $(“.toolbar”).attr(“disabled”, “true”) $(“#send”).click(function() { … }) $(“#textarea”).val() $(“#mainPanel”).html(“ Press Me ”) Spring /6.831 User Interface Design and Implementation25 Send

Mixing Declarative and Procedural Code What are you doing now? Send Sent messages appear here. $(function() { $(“#send”).click(function() { var msg = $(“#msg”).val() }) Spring /6.831 User Interface Design and Implementation26 var sent = $("#sent").html() sent += " " + msg + " ” $("#sent").html(sent) var sent = $("#sent").html() sent += " " + msg + " ” $("#sent").html(sent) var div = $(" ”).text(msg) $("#sent").append(div) var div = $(" ”).text(msg) $("#sent").append(div)

Advantages & Disadvantages of Declarative UI Usually more compact Programmer only has to know how to say what, not how –Automatic algorithms are responsible for figuring out how May be harder to debug –Can ’ t set breakpoints, single-step, print in a declarative specification –Debugging may be more trial-and-error Authoring tools are possible –Declarative spec can be loaded and saved by a tool; procedural specs generally can ’ t Spring /6.831 User Interface Design and Implementation27

Summary Design patterns –View tree is the primary structuring pattern for GUIs, used for output, input, and layout –Listener is used for input and model-view communication –Model-view-controller decouples backend from GUI Approaches to GUI programming –Procedural, declarative, direct manipulation –HTML, Javascript, jQuery Spring /6.831 User Interface Design and Implementation28

UI Hall of Fame or Shame? Spring /6.831 User Interface Design and Implementation29