Visual Programming - University of Cape Town

Download Report

Transcript Visual Programming - University of Cape Town

Designing usable programming languages
University of Cape Town
Gary Marsden
Slide 1
End user programming
• Look at the need to provide “graphical interface”
programming languages for novice programmer
• Many reasons why this is important
– 40% of homes have computers
–
University of Cape Town
Gary Marsden
Slide 2
Current tools
• We shall call these RAD (Rapid Application
Development) tools
University of Cape Town
Gary Marsden
Slide 3
Problems
• Simplifications are made, which turn out to be
“complexifications”
• Computer scientists don’t seem to care
University of Cape Town
Gary Marsden
Slide 4
Previous end user languages
• BASIC
–
–
–
–
Did not need to be crippled; hardware was simple
Encouraging
Extensible (PEEK, POKE)
Teaching language
University of Cape Town
Gary Marsden
Slide 5
Current Systems
• Passive
– Toolkits
– Components
• Active
–
–
–
–
–
–
“Zero” functionality
Graphically aided
Interface builders
RAD
Visual Language
Interface spec systems
University of Cape Town
Gary Marsden
Slide 6
Favourites
• HyperCard
– free from Apple,
– Graphics program to which was added language
– Most popular on Macintosh
• Visual Basic
– Comes in VBA and full flavours
– Windows / Office language of choice
– Language to which was added graphics
University of Cape Town
Gary Marsden
Slide 7
Learning Curve
University of Cape Town
Gary Marsden
Slide 8
Modes
• Design and execute modes
University of Cape Town
Gary Marsden
Slide 9
Mode Solutions
• Should not be modes
• If modes are to be used
– Provide adequate feedback on mode
– Not conflict with previous use
– Reflect real world metaphor
University of Cape Town
Gary Marsden
Slide 10
Screw solution
University of Cape Town
Gary Marsden
Slide 11
Translation
• Compile on demand
– Full program need not be written before a part can be
run
– Compile errors only reported by sub-program
– Should be possible to do full compilation
University of Cape Town
Gary Marsden
Slide 12
Adding widgets
– HyperCard - methods only
– Visual Basic - attributes only
– Should allow widgets to be
added as first class citizens
(data type completeness)
– Full interface should be available
(object browser)
University of Cape Town
Gary Marsden
Slide 13
Editors
• Detect syntax
errors
• Automatic
indentation
(essential for HC)
• Statement
colouring
• Mixed mode
University of Cape Town
Gary Marsden
Slide 14
Customisation
• Re-use IDE features
• Hierarchy of widget
methods/properties
• Interface structure reflect
code structure
University of Cape Town
Gary Marsden
Slide 15
Structure
•
•
•
•
Object based
“Reflexive interaction paradigm”
Object instantiation through “cut” and “paste”
Ability to create own objects
University of Cape Town
Gary Marsden
Slide 16
Syntax
• No ambiguities - either visual or natural language
• Ideally, syntax should resemble “real” language
University of Cape Town
Gary Marsden
Slide 17
Data Types
• Coercion
– Typeless, auto. Coercion, Mixed mode (integer ~ real),
Pseudostrong, Strong
•
•
•
•
Multimedia
Dynamic binding (visual binding, “me, this”)
Allow strong typing
Semantically equivalent objects should be treated
identically
University of Cape Town
Gary Marsden
Slide 18
Data Structures
•
•
•
•
HC has none, VB has no dynamic ones
Persistent
Multimedia (universe of discourse)
References
– Form1.text1 = “Hello”
– Set card field “1” of card “1” to “Hello”
University of Cape Town
Gary Marsden
Slide 19
Integration
• Language reflect interface concepts
• Universe of discourse
– Use of widgets in IDE not available to programmer
– Control of widgets different from language and IDE
• Self implementation
– Compilers written in own language -> IDE written in
script language (reflection)
University of Cape Town
Gary Marsden
Slide 20
Programmer needs
• Instant gratification
• Pleasantness
• Low viscosity and low premature commitment
University of Cape Town
Gary Marsden
Slide 21
Paradigm
• Functional / Declarative
• Visual Languages
• Programming By Example
University of Cape Town
Gary Marsden
Slide 22
Programming by Example
• Great for getting
people stared, but
there comes a limit
to the inference
engine and we bring
a step into the
learning curve
University of Cape Town
Gary Marsden
Slide 23
Functional / Declarative
• State destination, not journey
• Referential transparency
• Recursion not so good
– poor transferable skill
• “Functional languages are unnatural to use”
– demand premature commitment
– role expressive, but highly viscose
University of Cape Town
Gary Marsden
Slide 24
Declarative IO
• Fudgets
• Monads / Continuation
• Unique types
– one reference at a time
– fac 1 = 1
– fac n = n * (fac(n-1))
• Stick with OO for now (possibly ABC or Turing)
University of Cape Town
Gary Marsden
Slide 25
Representing Widgets
• How do you talk about widgets in a language?
– Find fundamental widget “particle”
– Align language semantics to widget semantics
• If you can do this,
– focus on problem domain
– increase language role expressiveness
University of Cape Town
Gary Marsden
Slide 26
Fundamental widget
• Are all widgets just a subclass of button?
University of Cape Town
Gary Marsden
Slide 27
Language isomorphism's
• Labels and text box are easy
University of Cape Town
Gary Marsden
Slide 28
Radio and check buttons
• Radio is easy - enumerated type
• Check boxes need a new, variant enumerated
– style = (plain|(bold,italic,underline)
University of Cape Town
Gary Marsden
Slide 29
Radio and Checkboxes visulaised
University of Cape Town
Gary Marsden
Slide 30
Pizza
University of Cape Town
Gary Marsden
Slide 31
Range Selection
• Widgets to select values can be classified as
follows:
–
–
–
–
One from a small range
Several from discrete
Single from continuous
Sub-range from range
University of Cape Town
Gary Marsden
Slide 32
Range variables
•
•
•
•
A = [5<-|->20]
B = [5<-|-|->20]
C = [5<-7->20]
D = [5<-7-13->20]
University of Cape Town
Gary Marsden
Slide 33
Buttons
• These turn out to be hard as they are verbs
rather than nouns
• Settled for objects which contained event
handlers for mouse input
University of Cape Town
Gary Marsden
Slide 34
Prototype
• Some of this has been implemented in Java
University of Cape Town
Gary Marsden
Slide 35