First BlueJ Day Houston, 2006 David J. Barnes University of Kent.

Slides:



Advertisements
Similar presentations
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 2 Getting Started with Java.
Advertisements

Review pages for the AP CS Exam
I/O Basics 12 January 2014Smitha N. Pai, CSE Dept.1.
Chapter 16 Graphical User Interfaces
Chapter 13 Graphics classes Bjarne Stroustrup
1 Classes and Objects in Java Basics of Classes in Java.
Basic Java Constructs and Data Types – Nuts and Bolts
1 Inheritance Classes and Subclasses Or Extending a Class.
1 Packages: Putting Classes Together. 2 Introduction The main feature of OOP is its ability to support the reuse of code: Extending the classes (via inheritance)
1 Graphical User Interface (GUI) Applications Abstract Windowing Toolkit (AWT) Events Handling Applets.
1 Applets Programming Enabling Application Delivery Via the Web.
User Interfaces II GUI – Awt, Swing, Web
List and Search Grants Chapter 2. List and Search Grants 2-2 Objectives Understand the option My Grants List Grant Screen Viewing a Grant Understand the.
0 - 0.
Addition Facts
Introduction to programming in java. Input and output to screen with Java program Structure of Java programs Statements Conditional statements.
Iterations for loop. Outcome Introduction to for loop The use of for loop instead of while loop Nested for loops.
1 G54PRG Programming Lecture 1 Amadeo Ascó Adam Moore 22 GUI Programming I.
Lecture 10 Methods COMP1681 / SE15 Introduction to Programming.
Lecture 10 Flow of Control: Loops (Part 2) COMP1681 / SE15 Introduction to Programming.
Mike Scott University of Texas at Austin
4. Internet Programming ENG224 INFORMATION TECHNOLOGY – Part I
Test on Input, Output, Processing, & Storage Devices
Programming Methodology (1). public class Hello { public static void main(String[] args) { System.out.println("Hello world"); } } Hello world.
1 CSC 221: Computer Programming I Fall 2006 interacting objects modular design: dot races constants, static fields cascading if-else, logical operators.
Copyright 2010 by Pearson Education Building Java Programs More Graphics reading: Supplement 3G.
Copyright 2006 by Pearson Education 1 Building Java Programs Supplement 3G: Graphics.
OLD BUSINESS : Lets talk about the next exam Project proposals – Functional Definitions Go over homework – NEW BUSINESS: Chapter 4 today GUIs Assignment.
1 Graphical User Interfaces AWT and Swing packages Frames and Panels Components Nested Panels Images Reading for this Lecture: L&L, 3.9 – 3.11.
2D Graphics Drawing Things. Graphics In your GUI, you might want to draw graphics E.g. draw lines, circles, shapes, draw strings etc The Graphics class.
1 public class Newton { public static double sqrt(double c) { double epsilon = 1E-15; if (c < 0) return Double.NaN; double t = c; while (Math.abs(t - c/t)
1.A computer game is an example of A.system software; B.a compiler; C.application software; D.hardware; E.none of the above. 2.JVM stands for: A.Java Virtual.
Past Tense Probe. Past Tense Probe Past Tense Probe – Practice 1.
Graphical User Interfaces
Chapter 5 Loops Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved.
Addition 1’s to 20.
25 seconds left…...
Test B, 100 Subtraction Facts
Week 1.
Computer Programming Lab(7).
13-1 © Prentice Hall, 2004 Chapter 13: Designing the Human Interface (Adapted) Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra,
Web Design & Development Lecture 19. Java Graphics 2.
Picture It Very Basic Game Picture Pepper. Original Game import java.util.Scanner; public class Game { public static void main() { Scanner scan=new Scanner(System.in);
1 More on Applets Overview l Changing Colors l Changing Fonts & Styles l Applet Life-Cycle l Input using Dialog Window l Input using HTML parameters l.
Frame Windows A frame object is used to create a graphical frame window. This frame is used to show information in a graphical application. The JFrame.
Building Java Programs Interactive Programs w/ Scanner What is a class? What is an object? What is the difference between primitive and object variables?
CSE 1341 Honors Professor Mark Fontenot Southern Methodist University Note Set 21.
Chapter 10 Ch 1 – Introduction to Computers and Java Streams and File IO 1.
Polymorphism Method overriding Method overloading Dynamic binding 1.
Chapter 8 Improving the User Interface
Chapter 16 Graphical User Interfaces John Keyser’s Modifications of Slides by Bjarne Stroustrup
Chapter 2: Using Objects Part 2. Assume you wish to test the behaviour of some method. This is accomplished by providing a tester class: Supply a main.
Today’s lecture Review of Chapter 1 Go over homework exercises for chapter 1.
Laboratory Study II October, Java Programming Assignment  Write a program to calculate and output the distance traveled by a car on a tank of.
Chapter 2 Programming by Example. A Holistic Perspective Three sections separated by blank lines. Program comment File: FileName.java
The Model-View Approach in Java. OK, you’ve got “Hello World” running... What now?
Problem Solving 6 GUIs and Event Handling ICS-201 Introduction to Computing II Semester 071.
1 Drawing C Sc 335 Object-Oriented Programming and Design Rick Mercer.
Chapter 5 Programming Graphics. Chapter Goals To be able to write applications with simple graphical user interfaces To display graphical shapes such.
M.E. Caspersen, M. Kölling, Teaching IOOP - Dangers, Traps and a Road Map Teaching Introductory Object-Oriented Programming Dangers, Traps and a.
Begin Java having used Alice Pepper - Some slides from Alice in Action with Java.
1 Teaching OOP - A Practical Approach using BlueJ Teaching OOP  A Practical Approach Using BlueJ David J Barnes University of Canterbury Michael Kölling.
Java Review Structure of a graphics program. Computer Graphics and User Interfaces Java is Object-Oriented A program uses objects to model the solution.
CSci 111 – computer Science I Fall 2014 Cynthia Zickos WRITING A SIMPLE PROGRAM IN JAVA.
BallWorld.java A structured walkthrough. Key Features: 2 classes are created Execution is done through the procedure called “main” which are decleared.
CIS Intro to JAVA Lecture Notes Set 8 9-June-05.
Creating a Java Application and Applet
Java: Variables and Methods By Joshua Li Created for the allAboutJavaClasses wikispace.
Creating Java Applications (Software Development Life Cycle) 1. specify the problem requirements - clarify 2. analyze the problem - Input? Processes? Output.
F II 2. Simple Java Programs Objectives
Presentation transcript:

First BlueJ Day Houston, 2006 David J. Barnes University of Kent

2 First BlueJ Day, Houston, Texas, 1st March 2006 Getting started with BlueJ My personal route to using BlueJ Traditional approaches to teaching Java and OOP The problems How BlueJ addresses the problems

3 First BlueJ Day, Houston, Texas, 1st March 2006 My personal route Looking for an OO language Blue at SIGCSE 1997 Java by decree Objects early via the command line. –Prentice-Hall textbook in 2000

4 First BlueJ Day, Houston, Texas, 1st March 2006 Traditional approaches to teaching Java Strong influence of procedural programming Heavy dependence on textbooks. ‘Hello world’ GUI-based

5 First BlueJ Day, Houston, Texas, 1st March 2006 Hello World public class Hello { public static void main(String[] args) { System.out.println("Hello, world"); } } A necessary starting point?

6 First BlueJ Day, Houston, Texas, 1st March 2006 Text output public class OldMacDonald { public static void main(String[] args) { System.out.println("Old MacDonald had a farm"); System.out.println("E I E I O"); System.out.println("and on his farm he had a duck"); System.out.println("E I E I O"); System.out.println("With a quak quak here"); System.out.println("And a quak quak there"); System.out.println("Here a quak, there a quak"); System.out.println("Everywhere a quak quak"); System.out.println("Old MacDonald had a farm"); System.out.println("E I E I O"); }

7 First BlueJ Day, Houston, Texas, 1st March 2006 Text input and output import java.util.Scanner; public class Square { public static void main(String[] args) { Scanner reader = new Scanner(System.in); System.out.print("Input a number: "); int number = reader.nextInt(); System.out.println(number + " squared is " + (number * number)); }

8 First BlueJ Day, Houston, Texas, 1st March 2006 Classes to wrap functions Data Fields sqMeters Methods toSqYards readSqMeters displayFabric getDouble displayResult... Conversion: square metres to square yards for a piece of fabric

9 First BlueJ Day, Houston, Texas, 1st March 2006 GUIs import java.awt.*; public class Message extends Frame { Font f; public Message() { f = new Font("SansSerif", Font.BOLD, 24); setBackground(Color.yellow); setSize(400, 150); setVisible(true); } public void paint(Graphics g) { g.setFont(f); g.setColor(Color.blue); g.drawString("Welcome to Java", 100, 100); }

10 First BlueJ Day, Houston, Texas, 1st March 2006 GUIs (continued) public class FirstApp extends wheel.users.Frame { private wheels.users.Ellipse _ellipse; public FirstApp() { _ellipse = new wheels.users.Ellipse(); } // magic to let the FirstApp execute public static void main(String[] args) { FirstApp app = new FirstApp(); }

11 First BlueJ Day, Houston, Texas, 1st March 2006 The problems Java’s main method is a requirement. Traditional (procedural) curricula exert a strong influence. GUI-based examples are attractive, but often carry a lot of baggage.

12 First BlueJ Day, Houston, Texas, 1st March 2006 What I would like to teach Classes and objects from day 1 Object fundamentals –state –behaviour –multiplicity –independence Let students experience objects Emphasise modelling

13 First BlueJ Day, Houston, Texas, 1st March 2006 Avoiding the problems Jump start Don't use main Don't start with I/O Beware the complexities of GUIs –custom libraries may have potential Pick early examples very carefully –avoid simply converting old examples

14 First BlueJ Day, Houston, Texas, 1st March 2006 What does BlueJ have to offer? Liberation from a main method A visual and interactive environment that is simple to use An environment that supports OO concepts –the opportunity to experience objects –access to object state and behaviour

15 First BlueJ Day, Houston, Texas, 1st March 2006 Using BlueJ – first steps Shapes and Pictures

16 First BlueJ Day, Houston, Texas, 1st March 2006 Next steps Avoid teaching BlueJ –BlueJ is a means to support OO teaching. Choose examples that illustrate key concepts Beware of falling back into old ways Avoid the completeness trap

17 First BlueJ Day, Houston, Texas, 1st March 2006 Next steps (continued) Don't be afraid to use 'large' examples –Encourage students to read code –Apprenticeship is appropriate Use sensible examples Avoid giving them a blank screen –Design is hard –Syntax can be a stumbling block

18 First BlueJ Day, Houston, Texas, 1st March 2006 Summary Teaching proper OO may require a radical rethink of material BlueJ provides excellent support for a truly OO curriculum OO is possible from day 1 – ‘objects first’