1 / 18

First BlueJ Day Houston, 2006

First BlueJ Day Houston, 2006. David J. Barnes University of Kent. Getting started with BlueJ. My personal route to using BlueJ Traditional approaches to teaching Java and OOP The problems How BlueJ addresses the problems. My personal route. Looking for an OO language Blue at SIGCSE 1997

miyoko
Download Presentation

First BlueJ Day Houston, 2006

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

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

  3. 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 First BlueJ Day, Houston, Texas, 1st March 2006

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

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

  6. 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"); } } First BlueJ Day, Houston, Texas, 1st March 2006

  7. 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)); } } First BlueJ Day, Houston, Texas, 1st March 2006

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

  9. 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); } } First BlueJ Day, Houston, Texas, 1st March 2006

  10. 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(); } } First BlueJ Day, Houston, Texas, 1st March 2006

  11. 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. First BlueJ Day, Houston, Texas, 1st March 2006

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

  13. 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 First BlueJ Day, Houston, Texas, 1st March 2006

  14. 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 First BlueJ Day, Houston, Texas, 1st March 2006

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

  16. 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 First BlueJ Day, Houston, Texas, 1st March 2006

  17. 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 First BlueJ Day, Houston, Texas, 1st March 2006

  18. 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’ First BlueJ Day, Houston, Texas, 1st March 2006

More Related