skip to main content
article
Free Access

Graphics for free

Published:01 June 1999Publication History
Skip Abstract Section

Abstract

Students find computer graphics one of the most interesting topics in computer science. Unfortunately, writing programs with graphics requires understanding concepts that are usually beyond the scope of an introductory computer science course. For example, in Windows 95, a program that uses graphics must have an event loop that dispatches messages to the appropriate handler. Event loops, messages, and handlers are well beyond the grasp of someone just learning about variables! Consequently, programming assignments for introductory courses tend to use no graphics, or simple ANSI graphics (see, e.g. Feldman and Koffman [1]). These programs compare unfavorably to the graphics of games most students are accustomed to using, and motivation to program in an introductory course may be lost.Ideally, we would like to be able to have students write programs that have more appealing interfaces, yet do not require a large amount of additional conceptual complexity. In fact, the best case would be to have the student write a program as if it were a simple text-based program, and have the compiler automatically add a graphical interface. Languages that provide overloading, such as Ada 95, allow us to accomplish precisely that.This paper describes a library, Graphics_110 (named in honor of our introductory course, CS 110), which, using overloading, replaces the standard I/O libraries in Ada 95 (Ada.Text_IO, Ada.Float_Text_IO, and Ada.Integer_Tex_IO). By following a simple contract and replacing calls to the standard libraries with calls to Graphics_110, the student obtains a program with a Windows-style interface without ever having to worry about the implementation details. Although we use Ada 95 for this paper, the ideas extend to any programming language that provides subtypes and overloading.The next section describes the "contract" the programmer must follow to use the library and the third section describes the implementation of Graphics_110. In each section, we describe how we used Graphics_110 with a battleship game implemented in our introductory course. The final section presents conclusions and ideas for future work.

References

  1. Feldman, M. and Koffman, E. Ada 95: Problem Solving and Program Design, Second Edition. Addison-Wesley, Reading, Mass., 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Ousterhout, J. Tcl and the Tk Toolkit, Addison-Wesley, Reading, Mass., 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Westley, T. TASH: A Free Platform-Independent Graphical User Interface Development Toolkit for Ada. In Proceedings of Tri-Ada '96. (1996), 165-178. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

(auto-classified)
  1. Graphics for free

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGCSE Bulletin
        ACM SIGCSE Bulletin  Volume 31, Issue 2
        June 1999
        93 pages
        ISSN:0097-8418
        DOI:10.1145/571535
        Issue’s Table of Contents

        Copyright © 1999 Author

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 1 June 1999

        Check for updates

        Qualifiers

        • article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!