Final Report
Total Page:16
File Type:pdf, Size:1020Kb
SKETCHI - FROM SKETCHES TO GUIS Johnathan Tunnicliffe Supervisor: Dr Simon Colton Individual Project Report for MEng Computing, Imperial College London [email protected] June 2009 ABSTRACT Despite the dominance of Graphical User Interfaces (GUIs) in both consumer and business applications, there is still no simple, straightforward way of producing them. Manual coding requires a programmer to do a designer’s job whilst drag-and-drop tools produce verbose, difficult-to-read code. Various tools and techniques have been created over the years to aid developers in producing GUIs whilst reducing some of the prerequisite knowledge required. However, there is still a wealth of expertise needed regarding the specific widget toolkit to use these tools and produce a good quality interface for an end user. This report discusses a new, more natural tool that developers can use to build GUIs particularly for Swing in Java. We explore transforming sketches and natural input into the code for user interfaces. We have implemented a new GUI design tool that removes the learning curve in creating GUIs, produces concise code and requires minimal user intervention and prior toolkit knowledge. The results show that we can produce quality GUIs from natural input with minimal widget toolkit knowledge. Furthermore, the code created is more concise and of a higher quality than existing tools. The final finding is that we can abstract the toolkit so a single GUI sketch can produce code for multiple toolkits and programming languages. 1 ACKNOWLEDGEMENTS I would firstly like to thank my supervisor Dr Simon Colton for his excellent project idea as well as his help throughout the duration of the project. I would also like to thank my family, girlfriend and friends for helping me through university and pushing me over the finish line after four long years. 2 TABLE OF CONTENTS 1 INTRODUCTION ...............................................................................................6 1.1 MOTIVATION ......................................................................................... 6 1.1.1 Knowledge Barrier.....................................................................................6 1.1.2 Achieving Good Layout............................................................................7 1.1.3 Quality of Generated Code.......................................................................7 1.2 CONTRIBUTIONS ..................................................................................... 8 1.3 REPORT STRUCTURE ................................................................................ 9 2 BACKGROUND .............................................................................................. 10 2.1 GUI BASICS ........................................................................................ 10 2.1.1 What is a GUI?..........................................................................................10 2.1.2 Human Interface Guidelines ..................................................................11 2.1.3 GUI Toolkits..............................................................................................11 2.2 CURRENT GUI BUILDING METHODS............................................................ 15 2.2.1 Coding by Hand.......................................................................................15 2.2.2 GUI Builders: WYSIWYG .......................................................................15 2.2.3 Using a Markup Language to Specify GUIs.........................................21 2.3 INPUT RECOGNITION.............................................................................. 26 2.3.1 Artificial Neural Networks.....................................................................26 2.3.2 Pixel Overlay.............................................................................................30 2.3.3 Receptors ...................................................................................................31 2.3.4 Case-Based Reasoning.............................................................................34 2.4 LAYOUT MANAGEMENT .......................................................................... 36 2.4.1 Basic Layout Techniques.........................................................................36 2.4.2 The Dark Art of Java Layout Management ..........................................38 2.4.3 Inferring Correct Layout .........................................................................42 3 DESIGN CONSIDERATIONS........................................................................... 44 3.1 AIMS................................................................................................. 44 3.2 CRITIQUE OF EXISTING TECHNIQUES ........................................................... 44 3.2.1 Problems with Manual Coding..............................................................44 3.2.2 Problems with Current GUI Builders....................................................45 3.2.3 Problems with Specifying in Markup Languages ...............................47 3.2.4 Conclusion of Criticisms .........................................................................47 3.3 DESIGN.............................................................................................. 47 3.3.1 High Level Architecture..........................................................................48 3.3.2 Implementation Choices .........................................................................48 3.3.3 Application Components........................................................................49 3.3.4 Application States ....................................................................................51 3.3.5 Component Interaction ...........................................................................52 3 3.3.6 Sketchi Flexibility .....................................................................................53 4 INPUT DETECTION & CLASSIFICATION ....................................................... 54 4.1 DETECTION......................................................................................... 54 4.2 CLASSIFICATION ................................................................................... 55 4.2.1 Case-Based Reasoning.............................................................................57 4.2.2 Receptor Patterns .....................................................................................59 4.2.3 Suggesting a Classification .....................................................................61 4.2.4 Enhancing the Receptor Encoding.........................................................62 4.2.5 Incorporating Other Features.................................................................63 4.2.6 Learning From the User ..........................................................................67 4.3 SUMMARY OF INPUT DETECTION AND CLASSIFICATION .................................... 67 5 AUTOMATED LAYOUT GENERATION ........................................................... 68 5.1 LAYOUT GENERATOR ARCHITECTURE.......................................................... 68 5.2 MIGLAYOUT ........................................................................................ 70 5.2.1 Inferring Columns & Rows.....................................................................72 5.2.2 Adding Component Constraints ...........................................................74 5.3 SUMMARY OF AUTOMATED LAYOUT GENERATION .......................................... 75 6 CODE GENERATION..................................................................................... 76 6.1 MODELLING THE GUI............................................................................. 76 6.2 ABSTRACT CODE GENERATION ................................................................. 77 6.3 SUMMARY OF CODE GENERATION .............................................................. 81 7 EXPERIMENTAL DESIGN ............................................................................... 82 7.1 INPUT RECOGNITION RATES ..................................................................... 82 7.2 LAYOUT GENERATION FLEXIBILITY ............................................................. 83 7.3 QUALITY OF CODE GENERATION ............................................................... 83 7.4 PROJECT BRIEF ASSIGNMENT .................................................................... 84 7.5 USABILITY TESTING ............................................................................... 84 7.5.1 End-user Testing ......................................................................................84 7.5.2 Nielsen’s Usability Heuristics ................................................................86 7.6 PERFORMANCE TESTING.......................................................................... 86 7.7 ROBUSTNESS & STABILITY ....................................................................... 87 7.7.1 Monkey Testing........................................................................................87 7.7.2 Stress Testing ............................................................................................88 8 RESULTS & ANALYSIS.................................................................................. 89 8.1 INPUT RECOGNITION RATES ..................................................................... 89 8.2 LAYOUT GENERATION FLEXIBILITY ............................................................. 91 8.3 QUALITY OF CODE GENERATION ..............................................................