Download presentation
Presentation is loading. Please wait.
Published byArnold Townsend Modified over 8 years ago
1
What’s New in Computer Science Education? A Report on the 2005 ACM/SIGCSE Meeting
2
ACM/SIGCSE Meeting Where: St. Louis When: February 23-26, 2005 Papers: http://db.grinnell.edu/sigcse/sigcse2005/Program/program.asp
3
Major Themes Women in computing Image processing Writing game software Robotics Approaches to introductory programming
4
Women and Computing A panel on experiences at different colleges A session with four papers A keynote address by Maria Klawe, past president of the ACM and Dean of Engineering at Princeton
5
Image Processing In secondary school (Scion) For training teachers in Georgia (Georgia Tech) In CS1 (Swarthmore)
6
Writing Game Software Games and CS education A concentration within the CS curriculum
7
Robotics A session with four papers A workshop on LEGO Mindstorms
8
Introductory Programming Debate on objects early Rigor (algorithms)-first approach The use of environments, microworlds, and toolkits The ACM Java Task Force
9
Created in 2004 to study problems with teaching Java in intro courses Solicited toolkits as proposed solutions or learning aides Published a draft of a report on the problems and a tentative synthesis or distillation of solutions
10
Problems With Teaching Java High-level issues –Scale –Instability –Execution speed –Textbooks and environments
11
Problems With Teaching Java Language issues –public static void main(String[] args) –Exceptions –Separation of interface and implementation –Wrapper classes –Parameterized classes –Enumerated types –Coding preconditions –Iterator syntax
12
Problems With Teaching Java API issues –Simple input mechanism –Graphics model –GUI model –Event model
13
Solutions Packages for –console I/O –modal dialog I/O –graphics A program package for writing applications/applets using these three I/O styles
14
Console I/O The package acm.io includes an IOConsole class that supports input and output of basic data types It can be used with or without the acm.program package
15
import acm.io.*; import java.awt.*; import javax.swing.*; public class CircleArea{ public static void main(String[] args){ JFrame frame = new JFrame(); IOConsole console = new IOConsole(); frame.getContentPane().add("Center", console); frame.setSize(500, 300); frame.setVisible(true); console.println("This program displays the area of a circle"); int radius = console.readInt("Enter the radius: "); double area = radius * radius * Math.PI; console.println("The area is " + area); } Example with IOConsole
16
import acm.io.*; import java.awt.*; import javax.swing.*; public class CircleArea{ public static void main(String[] args){ IODialog dialog = new IODialog(); dialog.println("This program displays the area of a circle"); int radius = dialog.readInt("Enter the radius"); double area = radius * radius * Math.PI; dialog.println("The area is " + area); } Example with IODialog
17
Graphics The package acm.graphics includes –double-valued coordinates –A hierarchy of shapes that reflect the options available in the Graphics class but that maintain their state –A canvas that refreshes automatically
18
acm.graphics Hierarchy GCanvasGCanvasMenuBar GObject GTurtle GCompound GArc GPPen GDimensionGRectangle GImageGLabelGLineGOvalGRectGPolygon GPoint All GObject s accept mouse listeners
19
import acm.graphics.*; import java.awt.*; import javax.swing.*; public class HelloWorld extends JFrame { public HelloWorld(){ GCanvas gc = new GCanvas(); GLabel label = new GLabel("Hello world!"); label.setFont("Helvetica-bold-72"); label.setColor(Color.red); gc.add(label, 50, 100); getContentPane().add("Center", gc); setSize(500, 300); } public static void main(String[] args){ new HelloWorld().setVisible(true); } Example With Graphics
20
The Output
21
acm.program Package Encapsulates the main method so it’s not a distraction Can run a program as an application or an applet with no changes Backwards compatible with JDK 1.1 for older browsers Includes standard menus for printing an interaction and accepting input from files
22
acm.program Hierarchy Program ConsoleProgramDialogProgramGraphicsProgram java.applet.Applet
23
import acm.io.*; import java.awt.*; import javax.swing.*; public class CircleArea{ public static void main(String[] args){ JFrame frame = new JFrame(); IOConsole console = new IOConsole(); frame.getContentPane().add("Center", console); frame.setSize(500, 300); frame.setVisible(true); console.println("This program displays the area of a circle"); int radius = console.readInt("Enter the radius: "); double area = radius * radius * Math.PI; console.println("The area is " + area); } Example with IOConsole
24
import acm.program.*; public class CircleArea extends Program{ public static void main(String[] args){ new CircleArea().start(args); } public void run(){ println("This program displays the area of a circle"); int radius = readInt("Enter the radius: "); double area = radius * radius * Math.PI; println("The area is " + area); } Example with Program Uses the host system’s terminal
25
import acm.program.*; public class CircleArea extends Program{ public void run(){ println("This program displays the area of a circle"); int radius = readInt("Enter the radius: "); double area = radius * radius * Math.PI; println("The area is " + area); } Example with Program Omit main method to simplify
26
import acm.program.*; public class CircleArea extends ConsoleProgram{ public void run(){ println("This program displays the area of a circle"); int radius = readInt("Enter the radius: "); double area = radius * radius * Math.PI; println("The area is " + area); } Example with ConsoleProgram Extend ConsoleProgram to get a console window with File and Edit menus
27
import acm.program.*; public class CircleArea extends DialogProgram{ public void run(){ println("This program displays the area of a circle"); int radius = readInt("Enter the radius: "); double area = radius * radius * Math.PI; println("The area is " + area); } Example with DialogProgram Extend DialogProgram to get I/O with modal dialogs
28
import acm.program.*; public class CircleArea extends DialogProgram{ public void run(){ IOModel io = this.getConsole(); io.println("This program displays the area of a circle"); int radius = io.readInt("Enter the radius: "); double area = radius * radius * Math.PI; io.println("The area is " + area); } Make It More Oopy-Like Both IOConsole and IODialog implement IOModel
29
import acm.graphics.*; import java.awt.*; import javax.swing.*; public class HelloWorld extends JFrame{ public HelloWorld(){ GCanvas gc = new GCanvas(); GLabel label = new GLabel("Hello world!"); label.setFont("Helvetica-bold-72"); label.setColor(Color.red); gc.add(label, 50, 100); getContentPane().add("Center", gc); setSize(500, 300); } public static void main(String[] args){ new HelloWorld().setVisible(true); } Example With Graphics
30
import acm.graphics.*; import acm.program.*; public class HelloWorld extends GraphicsProgram{ public void run(){ GLabel label = new GLabel("Hello world!"); label.setFont("Helvetica-bold-72"); label.setColor(RED); double x = (getWidth() - label.getWidth()) / 2; double y = (getHeight() - label.getAscent()) / 2; add(label, x, y); } Example With GraphicsProgram
31
import acm.graphics.*; import acm.program.*; public class DrawTurtleFlower extends GraphicsProgram{ public void run(){ GTurtle turtle = new GTurtle(); add(turtle, getWidth() / 2, getHeight() / 2); turtle.penDown(); for (int i = 0; i < 36; i++){ for (int j = 0; j < 4; j++){ turtle.forward(100); turtle.left(90); } turtle.left(10); } Turtle Graphics Example Can be decomposed with methods or by subclassing
32
Ouput
33
GUI Programs? The task force could not agree on a common framework Recommends using a toolkit like BreezySwing But it would be nice to have a standard GUIProgram class
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.