1 Lecture 5: Other Output Models: Structured Graphics; Object-Oriented Techniques Brad Myers 05-830 Advanced User Interface Software.

Slides:



Advertisements
Similar presentations
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
Advertisements

Lecture 10: Part 1: OO Issues CS 540 George Mason University.
Chapter 3: Modules, Hierarchy Charts, and Documentation
Portability and Safety Mahdi Milani Fard Dec, 2006 Java.
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
Georgia Institute of Technology Workshop for CS-AP Teachers Chapter 3 Advanced Object-Oriented Concepts.
Lecture 12: Interactive Tools: Prototypers (HyperCard, Director, Visual Basic), Interface Builders, Sketching Tools Brad Myers Advanced User Interface.
1 Lecture 9: Software Organization: Lexical-Syntax- Semantics, Seeheim Model, MVC, Object-Oriented Programming for UIs Brad Myers Advanced User.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
Objects and Classes David Walker CS 320. Advanced Languages advanced programming features –ML data types, exceptions, modules, objects, concurrency,...
Programming Language Paradigms: summary. Object-oriented programming Objects are the fundamental building blocks of a program. Interaction is structured.
The Procedure Abstraction Part IV: Run-time Structures for OOLs Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Students.
Object-Oriented Databases
Context-sensitive Analysis, II Ad-hoc syntax-directed translation, Symbol Tables, andTypes.
Data Abstraction and Object- Oriented Programming CS351 – Programming Paradigms.
The Composite Pattern.. Composite Pattern Intent –Compose objects into tree structures to represent part-whole hierarchies. –Composite lets clients treat.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
1 Lecture 4: Output Models, Structured Graphics & Display PostScript Brad Myers Advanced User Interface Software.
Object-oriented design CS 345 September 20,2002. Unavoidable Complexity Many software systems are very complex: –Many developers –Ongoing lifespan –Large.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Abstraction: Polymorphism, pt. 1 Abstracting Objects.
CSCI-383 Object-Oriented Programming & Design Lecture 15.
CSSE501 Object-Oriented Development
1 Lecture 9: Deep Dive: Selecting and Creating Objects across Different Kinds of Views Brad Myers A/05-499A: Interaction Techniques Spring, 2014.
Written by Liron Blecher
A First Program Using C#
C++ Programming. Table of Contents History What is C++? Development of C++ Standardized C++ What are the features of C++? What is Object Orientation?
OOPs Object oriented programming. Based on ADT principles  Representation of type and operations in a single unit  Available for other units to create.
1 Lecture 3: Other Output Models: Structured Graphics; Object-Oriented Techniques Brad Myers Advanced User Interface Software © Brad Myers.
1 Chapter 10: Data Abstraction and Object Orientation Aaron Bloomfield CS 415 Fall 2005.
CSCI-383 Object-Oriented Programming & Design Lecture 13.
The Procedure Abstraction, Part V: Support for OOLs Comp 412 Copyright 2010, Keith D. Cooper & Linda Torczon, all rights reserved. Students enrolled in.
PowerBuilder Online Courses - by Prasad Bodepudi
Chapter 18 Object Database Management Systems. McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Outline Motivation for object.
More on Hierarchies 1. When an object of a subclass is instantiated, is memory allocated for only the data members of the subclass or also for the members.
COP4020 Programming Languages Names, Scopes, and Bindings Prof. Xin Yuan.
Lecture 10: Toolkits: Intrinsics, Callbacks, Resources, Widget hierarchies, Geometry management Brad Myers Advanced User Interface Software 1© 2013.
1 Lecture 2: Overview of UI Software and Tools Brad Myers Advanced User Interface Software.
Chapter 10 Classes and Objects In-Depth. Chapter 10 A class provides the foundation for creating specific objects, each of which shares the general attributes,
Introduction to c++ programming - object oriented programming concepts - Structured Vs OOP. Classes and objects - class definition - Objects - class scope.
CSCI-383 Object-Oriented Programming & Design Lecture 10.
Chapter 12 Support for Object-Oriented Programming.
 Objects versus Class  Three main concepts of OOP ◦ Encapsulation ◦ Inheritance ◦ Polymorphism  Method ◦ Parameterized ◦ Value-Returning.
(1) ICS 313: Programming Language Theory Chapter 12: Object Oriented Programming.
OOPs Object oriented programming. Abstract data types  Representationof type and operations in a single unit  Available for other units to create variables.
Copyright © 2005 Elsevier Object-Oriented Programming Control or PROCESS abstraction is a very old idea (subroutines!), though few languages provide it.
1 Lecture 5: Interactive Tools: Prototypers (HyperCard, Director, Visual Basic), Interface Builders Brad Myers Advanced User Interface Software.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Java Programming, Second Edition Chapter Twelve Advanced Inheritance Concepts.
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
Chapter 18 Object Database Management Systems. Outline Motivation for object database management Object-oriented principles Architectures for object database.
Basic Organization of UI Software. 2 The User Interface n Typically want to think of “UI” as only one component of an overall system – The part that “deals.
CSCI-383 Object-Oriented Programming & Design Lecture 17.
Object Oriented Programming in Java Habib Rostami Lecture 2.
CSCI 383 Object-Oriented Programming & Design Lecture 15 Martin van Bommel.
Chapter 5 Introduction to Defining Classes Fundamentals of Java.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Brad Myers Advanced User Interface Software, 2017
Andy Wang Object Oriented Programming in C++ COP 3330
Object-Oriented Database Management System (ODBMS)
Programming Language Concepts (CIS 635)
Inheritance, Polymorphism and the Object Memory Model
Computer Programming.
Topic 8: (Last two papers)
Design Patterns A Case Study: Designing a Document Editor
The Procedure Abstraction Part V: Run-time Structures for OOLs
Support for Object-Oriented Programming
Introduction to Data Structure
Programming Languages and Paradigms
Brad Myers : Interaction Techniques Spring, 2019
Presentation transcript:

1 Lecture 5: Other Output Models: Structured Graphics; Object-Oriented Techniques Brad Myers Advanced User Interface Software

2 Structured Graphics Saves a list of all the graphical objects Edit the screen by editing the saved list Also called "display list" or "retained object model" Provided by many toolkits and graphics packages early vector displays CORE (~1977), GKS (1985), PHIGS (1988) Optional in InterViews, CLIM, etc. Required in Amulet, Garnet, Rendezvous, etc.

3 Structured Graphics, cont. Advantages: Simpler to program with: don't call "draw" and "erase" Automatic refresh of windows when uncovered, etc. Automatic redisplay of objects when change and also of other overlapping objects

4 Structured Graphics Can Support Ability to support: high-level behaviors like move, grow, cut/copy/paste, etc. high-level widgets like selection handles constraints among objects automatic layout grouping: "Groups" in Garnet automatic PostScript printing tutors and monitors external scripting,...

5 Structured Graphics Disadvantages Disadvantages: Significant space penalties objects take up to 1000 bytes each imagine a scene with 40,000 dots (200x200 fat bits) Time penalties Redisplay doesn't take advantage of special properties of data:  regularity  non-overlapping

6 Redisplay Algorithms Redisplay everything each time Most appropriate for small numbers of objects, and if drawing is really quick compared to computation Used on the Macintosh and many others Used by Amulet Used by homework 2 May add clipping region and/or double-buffering

7 Redisplay only the affected areas of the screen Requires computing what areas are affected Garnet: 1.keep track of objects that change any "interesting" slot 2.compute the bounding box of all these changed objects in their old and new locations 3.assert this as the clipping region (must not self-intersect; Garnet uses 2 regions) 4.erase the area 5.go through objects from top-to-bottom, back to front draw those which overlap the bounding box for step 4: goes through all top level aggregates, and any children of the aggregates that intersect (recursively) Other techniques: quad trees

8 Issue: Anti-Aliasing and special effects Drop shadows, highlights, other special effects Can’t assume clipping regions will work Can draw outside of the bounding boxes Mac OS X uses anti-aliasing and seems to redraw lots of windows

9 Optimizing Redraw Special additions in Garnet; not in Amulet "Fast-redraws" declared by the programmer objects drawn with XOR on top of other objects those that have a solid color behind them (nothing in front) so can be erased with a rectangle or by redrawing with the background color When change, have to be erased using old values No bounding boxes, no intersections, etc. "Virtual aggregates" only pretend to allocate storage for elements provide table and arbitrary layouts

10 Optimizing Redraw “Glyphs” in InterViews Calder, P.R. and Linton, M.A. “Glyphs: Flyweight Objects for User Interfaces,” in Proceedings UIST'90: ACM SIGGRAPH Symposium on User Interface Software and Technology Snowbird, Utah: pp Don't include position information, etc. so very small Much of the layout retained by the aggregate (computed as needed) Object can be reused in many places: e.g.: the letter "a" Used for a text editor Issue: why is location special? What about red vs. blue "a"s?

11 Object-Oriented Techniques Motivation Became popular along with GUIs, Direct Manipulation Icons, graphics seem like objects: have internal state, persistance OO was originally developed (SmallTalk) and became popular (C++) mostly due to GUIs.

12 Object Oriented As a UI technique: Same as GUI, Direct Manipulation = icons, graphical objects, widgets Here, as a programming paradigm (often in a language) A form of "data abstraction" "Classes" describe the basic structure of the data Also, the methods that can be called Usually no direct access to the data, only the methods

13 OO Create "instances" of the classes local copy of data may also be class data shares all methods "Inheritance": create a new class "like" the superclass by default has all the same methods and data can add new data and methods and re-program inherited methods Example: graphical_object.draw... circle.draw

14 OO New style of programming; thinking about the problem Many books about how to do it right. OO design; getting the classes and protocols right So subclasses don't have extra, wasted data space Methods make sense to all sub-classes So external classes don't need to know inside description. Also OO databases, etc. Implementation: object in memory, starts with pointer to table of methods, etc. lots of tricks and extra declarations in C++ etc. to avoid overhead of lookups ("virtual", "pure virtual")

15 Multiple inheritance Class has multiple parent classes Combine all the methods and data of all Special rules for when conflict (same method, same name of data with different types, etc.) Example: circle inherits from graphical-object and moveable-object Complex so often not used even when available Amulet uses constraints to provide flexible copying of values instead Java, etc. use “interfaces” No inheritance of implementations, but ability to have arbitrary “mix-ins”

16 Prototype-Instance model Instead of the class-instance model All objects are instances Can use any object as a prototype for other objects Inherits all slots it doesn't override (= instance variables, member variables, fields, attributes). Methods are just a value in a slot Dynamic changing of methods Easy to implement using structures. Usually, changing prototype data also changes all instances that do not override it.

17 Prototype-Instance model

18 Prototype-Instance model May provide adding and removing of slots dynamically to any instance Simpler model, easy to implement But much less efficient Can't usually compile slot accesses into structure access; may need a search Type checking on slots Methods looked up at run-time Space for names of slots, extra pointers, etc.

19 Examples of OO Systems OO in SmallTalk First "pure" example Everything is an object (numbers, strings, etc.) Single inheritance Methods dispatched on a single parameter 3 + "4.5" different from "4.5" + 3 Dynamic method lookup at run-time => "Message not understood" Smalltalk 72 had strange syntax with special characters Whole environment (windows, browsers, MVC, etc.)

20 Examples of OO Systems OO in C++ Numbers, strings, etc. not objects Lots of mess to make it fit with C Statically (compile-time) determine types, methods Originally a pre-processor (new syntax) Multiple-inheritance

21 Examples of OO Systems OO in CLOS (Common-Lisp Object System) Add-on to language Special feature: method dispatch on all parameters +(int int) +(int str) +(str int) +(str str) Methods not as tightly coupled with objects

22 Examples of OO Systems OO in MacApp Because OO so natural for UIs, invented their own language: Object Pascal with help from Niklaus Werth (inventor of Pascal) Used in MacApp SmallTalk model, but more compile-time checkable Eventually abandoned in favor of Objective C

23 Examples of OO Systems OO in Andrew and Motif Invented their own object systems in C "Intrinsics" Mainly is a method and inheritance protocol Andrew: (ATK) pre-processor for header files single inheritance "_" = new syntax: class_method(xxx) dynamic loading of object implementations querying an object's class at run-time Andrew converted to C++ Now defunct Motif just a set of conventions; no preprocessor not "real" inheritance, overriding Before C++ was popular, available

24 Examples of OO Systems Amulet provides a prototype-instance object system embedded in C++ Java C# Objective C Javascript & ActionScript

25 Amulet and Garnet Videos Brad A. Myers, Dario Giuse, Andrew Mickish, Brad Vander Zanden, David Kosbie, Richard McDaniel, James Landay, Matthew Goldberg, and Rajan Parthasarathy. “The Garnet User Interface Development Environment.” Technical Video Program of the CHI'94 conference. SIGGRAPH Video Review, Issue 97, no. 13. ACM, ISBN Brad A. Myers, Richard G. McDaniel, Robert C. Miller, Alan Ferrency, Ellen Borison, Andrew Faulring, Andy Mickish, Patrick Doane, and Alex Klimovitski, “The Amulet User Interface Development Environment”. 8 minute video. Technical Video Program of the CHI'97 conference. ACM, OpenVideo version