Morphr – a Morphic GUI in Ruby C I T a M R O F N I F O T N E M T R a P E D E H T T a E C N E I C S R E T U P M
Total Page:16
File Type:pdf, Size:1020Kb
DEGREE PROJECT 2004:PM03 s c i t a m e h t a M d n a s MorphR – a Morphic GUI in Ruby c i t a m r o f n I f o t n e m t r a p e D e h t t a e c n e i c S r e t u p m o Kerstin Lyngfelt C f o n o i s i v i D DEGREE PROJECT University of Trollhättan ⋅ Uddevalla Department of Informatics and Mathematics Degree project for master degree in Software engineering MorphR – a Morphic GUI in Ruby Kerstin Lyngfelt Examiner: Lektor Robert Feldt Department of Computer Science Supervisor: Richard Torkar Department of Computer Science Trollhättan, 2004 2004:PM03 i EXAMENSARBETE MorphR – a Morphic GUI in Ruby Kerstin Lyngfelt Sammanfattning Grafiska användargränssnitt har alltid varit en utmaning att bygga för programvaru- utvecklare. Design mönster har utvecklats för att hjälpa till i det arbetet och ett av dessa mönster är Model-View-Controller (MVC). Även om MVC är det mest använda design mönstret vid användargränssnitts utveckling kan MVC anses lite stelt och har vissa begränsningar. Därför har modifierade versioner av MVC använts vid utvecklandet av grafiska ramverk. Vi kommer att titta på både MVC mönstret och på hur bland andra Morphic, Ion och AppKit har designat sina ramverk utifrån MVC. Målet med analysen är att designa och implementera ett modernt, flexibelt vektorbaserat ramverk i Ruby och använda OpenGL som grafikhanterare. Vi kommer också att titta på hur man kan använda teman för att olika grafiska presentationer av en applikation. Utgivare: Högskolan Trollhättan ⋅ Uddevalla, Institutionen för Informatik och Matematik Box 957, 461 29 Trollhättan Tel: 0520-47 50 00 Fax: 0520-47 50 99 Examinator: Lektor Robert Feldt Handledare: Richard Torkar, HTU Huvudämne: Programvaruteknik Språk: Engelska Nivå: Fördjupningsnivå 2 Poäng: 10 Rapportnr: 2004:PM03 Datum: 2004-05-21 Nyckelord: GUI framework, GUI design ii MorphR – A Morphic GUI in Ruby Innehållsförteckning Sammanfattning .............................................................................................................. ii 1. Introduction .................................................................................................................4 2. Background .................................................................................................................5 2.1. Ruby ...........................................................................................................................................................5 2.2. OpenGL ......................................................................................................................................................5 2.3. Themes .......................................................................................................................................................6 2.4. Model-View-Controller ..............................................................................................................................6 2.5. Morphic ......................................................................................................................................................6 2.6. Ion...............................................................................................................................................................7 2.7. Avalon and XAML.....................................................................................................................................7 3. Method ........................................................................................................................8 4. Analysis of GUI design alternatives............................................................................8 4.1. Design of MVC ..........................................................................................................................................8 4.2. Design of Morphic......................................................................................................................................8 4.3. Design of AppKit........................................................................................................................................9 4.4. Design of Ion ..............................................................................................................................................9 5. Design of MorphR.....................................................................................................10 6. Results.......................................................................................................................11 6.1. Design.......................................................................................................................................................11 6.2. Morphs......................................................................................................................................................11 6.3. Timers.......................................................................................................................................................11 6.4. Themes .....................................................................................................................................................11 7. Discussion .................................................................................................................12 8. Future Work ..............................................................................................................12 9. Conclusion.................................................................................................................12 10. Acknowledgements.................................................................................................12 11. References...............................................................................................................12 3 MorphR – A Morphic GUI in Ruby MorphR – A Morphic GUI in Ruby Kerstin Lyngfelt Department of Computer Science University of Trollhättan/Uddevalla [email protected] Abstract Controller (MVC) pattern is one of the most used patterns in GUI frameworks. Building Graphical User Interfaces (GUI) has GUIs have always been hard to implement due to always been a challenge for software engineers. Many the complexity [2] when text and pictures are used patterns have been developed to help software together to present and visualize the application to the engineers in their work, some patterns with longer users. There is also interaction from the users through lifetime than others. One pattern that has been used the mouse and the keyboard that has to be handled by since the late 1970s is the Model-View-Controller the GUI. (MVC). The MVC pattern has limitations and therefore Technology changes rapidly and with no signs of a modifications to the MVC pattern have been made to slow down, Moore’s law [3] is still valid. GUIs can use suit different purposes. In this study, which aims to more powerful technology, have increased capacity and design and implement a modern, flexible, easily contain more functionality than earlier, which creates extendible vector-based GUI for a dynamic increased GUI requirements from the users at the same programming language, both the MVC pattern and pace as the technology development. other design options like Morphic and Ion were Despite all problems, a picture is still better suited analyzed. This paper initially looks at how MVC has to cross language barriers, so there is much gain in been implemented in different GUI frameworks and finding a method that works for its purpose when it furthermore takes the first step in applying said design comes to GUIs. There have been a number of in a flexible implementation in Ruby. It will also look recommendations on how a user interface should be at how to use themes in order to provide different designed and implemented. graphical options of the same application. A GUI is easier to understand if the user is familiar to the look and feel of it [4]. One way to customize a 1. Introduction GUI is to use themes like in e.g. the Linux window manager KDE [5]. Themes are a way to give a united Mankind has been communicating through pictures impression of the components in an application with long before writing existed [1]. A picture does not have coloring and shaping. to be related to language or country, but is international When it comes to handling graphics, different as few other communication forms. Since approaches are to be considered. In this paper focus communication and interaction between countries have has been on a few different types of GUI approaches. increased, due to improved global communications The traditional Model-View-Controller (MVC), a networks, graphics is an important source of design pattern that separates the model from the view information. and control of it [6] is often used as a base while Even though computer applications have been building GUIs. Morphic [7], the graphical framework around for decades, a GUI is still hard to build in an of Squeak [8] uses a slightly different implementation easy and unified way. For instance standards and of the MVC pattern, while Ion implements the MVC recommendations are not suited for every purpose and pattern using OpenGL as back-end. there are almost as many recommendations as there are This paper aims to design and implement a flexible developers. Design patterns are one way to streamline GUI framework, called MorphR, by using the high- software and reuse experience. The Model-View- level programming language Ruby [9] combined with the low-level graphical