Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "First BlueJ Day Houston, 2006 David J. Barnes University of Kent."— Presentation transcript:

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

2 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 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 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 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 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 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 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 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 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 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 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 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 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 15 First BlueJ Day, Houston, Texas, 1st March 2006 Using BlueJ – first steps Shapes and Pictures

16 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 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 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’


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

Similar presentations


Ads by Google