1 Teaching OOP - A Practical Approach using BlueJ Teaching OOP  A Practical Approach Using BlueJ David J Barnes University of Canterbury Michael Kölling.

Slides:



Advertisements
Similar presentations
Comp1004: Object Oriented Design II Designing Applications Based on BlueJ Chapter 13.
Advertisements

First BlueJ Day Houston, 2006 David J. Barnes University of Kent.
Algorithms and Problem Solving
Lecture 0 CSIS10A Overview. Welcome to CSIS10A (5 mins) – Typical format for class meetings New material first (monitors off, notebooks out) Practice.
JAVA BASICS SYNTAX, ERRORS, AND DEBUGGING. OBJECTIVES FOR THIS UNIT Upon completion of this unit, you should be able to: Explain the Java virtual machine.
Object Orientated Concepts. Overview  The world is objects  Defining an object  Not a function, it’s a method  Lets inherit want we can  Objects.
Designing classes How to write classes in a way that they are easily understandable, maintainable and reusable 4.0.
M.E. Caspersen, M. Kölling, Teaching IOOP - Dangers, Traps and a Road Map Teaching Introductory Object-Oriented Programming Dangers, Traps and a.
Objects First with Java A Practical Introduction using BlueJ
String Concatenation (operator overloading) 3.0.
Introduction to Java, OO and IDEs ICW Lecture 2 Errol Thompson Room 134.
Designing Classes How to write classes in a way that they are easily understandable, maintainable and reusable.
Understanding class definitions Looking inside classes 3.0.
School of Computing Science CMT1000 © Ed Currie Middlesex University Lecture 10: 1 TEST!!
Aalborg Media Lab 21-Jun-15 Software Design Lecture 1 “ Introduction to Java and OOP”
More sophisticated behavior Using library classes to implement some more advanced functionality 4.0.
Objects & Object-Oriented Programming (OOP) CSC 1401: Introduction to Programming with Java Week 15 – Lecture 1 Wanda M. Kunkle.
Using Java without BlueJ Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling BlueJ projects A BlueJ.
Introduction to Programming. To gain a sound knowledge of programming principles To gain a sound knowledge of object- orientation To be able to critically.
CO320 Introduction to Object- Oriented Programming Michael Kölling 3.0.
Back to Basics in CS1 and CS2 Stuart Reges University of Washington.
Java CourseWinter 2009/10. Introduction Object oriented, imperative programming language. Developed: Inspired by C++ programming language.
5.0 Objects First with Java A Practical Introduction using BlueJ David J. Barnes Michael Kölling.
A virtuous cycle for Programming Principles Su White and Teresa Binks, University of Southampton.
Week 2 - Friday.  What did we talk about last time?  Data representation  Binary numbers  Types  int  boolean  double  char  String.
Starting Chapter 4 Starting. 1 Course Outline* Covered in first half until Dr. Li takes over. JAVA and OO: Review what is Object Oriented Programming.
Object Oriented Software Development
1 Programming James King 12 August Aims Give overview of concepts addressed in Web based programming module Teach you enough Java to write simple.
Hello AP Computer Science!. What are some of the things that you have used computers for?
Week 14 - Monday.  What did we talk about last time?  Image manipulation  Inheritance.
Teach.NET Workshop Series Track 4: AP Computer Science with.NET and J#
Java Workshop for Teachers May 6, 2005 A Brief Look at the Java Programming Language.
CSCI-383 Object-Oriented Programming & Design Lecture 4.
1 TOPIC 1 INTRODUCTION TO COMPUTER SCIENCE AND PROGRAMMING Topic 1 Introduction to Computer Science and Programming Notes adapted from Introduction to.
5.0 Objects First with Java A Practical Introduction using BlueJ Introduction to Computer Science I Instructor: Allyson Anderson.
CSI 1390: Introduction to Computers TA: Tapu Kumar Ghose Office: STE 5014
Designing classes How to write classes in a way that they are easily understandable, maintainable and reusable 3.0.
Objects First With Java A Practical Introduction Using BlueJ Designing applications 1.0.
Console Input. So far… All the inputs for our programs have been hard-coded in the main method or inputted using the dialog boxes of BlueJ It’s time to.
OOP (Java): Simple/ OOP (Java) Objectives – –give some simple examples of Java applications and one applet 2. Simple Java Programs Semester.
CSE 131 Computer Science 1 Module 1: (basics of Java)
Week 2 - Wednesday.  What did we talk about last time?  Data representation  Binary numbers  Types  int  boolean  double  char  String.
Interfaces. –An interface describes a set of methods: no constructors no instance variables –The interface must be implemented by some class. 646 java.
Designing classes How to write classes in a way that they are easily understandable, maintainable and reusable 5.0.
Teach.NET Workshop Series Track 4: AP Computer Science with.NET and J#
Mini University July, 2005 A Little Taste of Java (but don’t tell your folks) (they might think there’s caffeine involved)
Designing applications Main concepts to be covered Discovering classes CRC cards Designing interfaces Patterns Objects First with Java - A Practical.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and web applications Very rich GUI libraries Portability (machine independence) A real Object.
CS 11 java track: lecture 2 This week: more on object-oriented programming (OOP) objects vs. primitive types creating new objects with new calling methods.
5.0 Objects First with Java A Practical Introduction using BlueJ David J. Barnes Michael Kölling.
Working With Objects Tonga Institute of Higher Education.
Week 14 - Monday.  What did we talk about last time?  Inheritance.
1 COS 260 DAY 14 Tony Gauvin. 2 Agenda Questions? 6 th Mini quiz graded  Oct 29 –Chapter 6 Assignment 4 will be posted later Today –First two problems.
Objects First With Java A Practical Introduction Using BlueJ Designing classes How to write classes in a way that they are easily understandable, maintainable.
1 COS 260 DAY 12 Tony Gauvin. 2 Agenda Questions? 5 th Mini quiz –Chapter 5 40 min Assignment 3 Due Assignment 4 will be posted later (next week) –If.
Programming. To gain a sound knowledge of programming principles To gain a sound knowledge of object- orientation To be able to critically assess the.
OOP Basics Classes & Methods (c) IDMS/SQL News
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
ITP 109 Week 2 Trina Gregory Introduction to Java.
Programming for Interactivity Professor Bill Tomlinson Tuesday & Wednesday 6:00-7:50pm Fall 2005.
Chapter 1 Object Orientation: Objects and Classes.
Objects First with Java A Practical Introduction using BlueJ
Week 14 - Wednesday CS 121.
Objects First with Java A Practical Introduction using BlueJ
Tonga Institute of Higher Education
slides created by Alyssa Harding
Objects First with Java A Practical Introduction using BlueJ
Objects First with Java A Practical Introduction using BlueJ
Java Coding 4 (part2) David Davenport Computer Eng. Dept.,
LCC 6310 Computation as an Expressive Medium
Presentation transcript:

1 Teaching OOP - A Practical Approach using BlueJ Teaching OOP  A Practical Approach Using BlueJ David J Barnes University of Canterbury Michael Kölling University of Southern Denmark

2 Teaching OOP - A Practical Approach using BlueJ Introduction Who are you? What/where do you teach? What is your experience with Java teaching? What do you expect from this workshop? What problems do you experience in your teaching?

3 Teaching OOP - A Practical Approach using BlueJ Analysis What is happening with OOP teaching?

4 Teaching OOP - A Practical Approach using BlueJ Functions Conversion: square metres to square yards for a piece of fabric Data Fields sqMeters Methods toSqYards readSqMeters displayFabric getDouble displayResult...

5 Teaching OOP - A Practical Approach using BlueJ Hello World public class Hello { public static void main(String[] args) { System.out.println(“Hello, world”); } }

6 Teaching OOP - A Practical Approach using BlueJ Text 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”); } 1. Write a Java class that prints the second verse 2. Write a Java class that prints the following design...

7 Teaching OOP - A Practical Approach using BlueJ GUI’s import java.awt.*; public class Message2 extends Frame { Font f; public Message2() { f = new Font(“SansSerif”, Font.BOLD, 24); setBackground(Color.yellow); setSize(400, 150); } public void paint(Graphics g) { g.setFont(f); g.setColor(Color.blue); g.drawString(“Welcome to Java”, 100, 100); } public static void main(String[] args) { Message2 m2 = new Message2(); m2.setVisible(true); }

8 Teaching OOP - A Practical Approach using BlueJ Text input import java.io.*; public class Square { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader( new InputStreamReader(System.in)); System.out.println(“Input a number”); int number = Integer.parseInt(reader.readline()); System.out.println(number + “ squared is “ + (number * number)); }

9 Teaching OOP - A Practical Approach using BlueJ Why are things like this? It has a lot to do with the Pascal (etc.) heritage. Just using a class doesn’t make an OO program. Using an OO language requires a proper OO approach.

10 Teaching OOP - A Practical Approach using BlueJ Getting started How to get over the first few weeks

11 Teaching OOP - A Practical Approach using BlueJ Suggestions #1 Objects first Jump start Don’t use “main” Don’t start with I/O (GUIs, applets, text I/O) Don’t convert old examples Teach programming, not a programming language

12 Teaching OOP - A Practical Approach using BlueJ Objects first Start with key issues: Objects, classes, methods State and behaviour Almost universally accepted, but: not easy

13 Teaching OOP - A Practical Approach using BlueJ Jump start Don’t get students bored with detail at the start Start doing something! Experiment with objects before writing objects.

14 Teaching OOP - A Practical Approach using BlueJ Don’t use “main” What has main got to do with objects? - Nothing! public class Hello { public static void main(String[] args) { System.out.println(“Hello, world”); } }

15 Teaching OOP - A Practical Approach using BlueJ Don’t start with I/O I/O is an undesirable distraction from programming principles Text I/O (especially input) is not easy Applets are mysterious GUIs are complicated Custom made libraries…?

16 Teaching OOP - A Practical Approach using BlueJ Don’t convert your old examples Examples are (or should be) handpicked to illustrate key points Examples from procedural languages do not illustrate concepts of object orientation

17 Teaching OOP - A Practical Approach using BlueJ Teach programming, not a programming language Don’t teach Java, teach OOP! Don’t teach OOP, teach programming! Don’t teach programming, teach problem solving!

18 Teaching OOP - A Practical Approach using BlueJ Environment again need visualisation need interaction need simplicity BlueJ –successor of Blue system –supports Java –written in Java –free

19 Teaching OOP - A Practical Approach using BlueJ An Object-Oriented Environment An environment for an object- oriented language is not the same as an object-oriented environment

20 Teaching OOP - A Practical Approach using BlueJ Examples Shapes and Pictures

21 Teaching OOP - A Practical Approach using BlueJ Questions / Discussion

22 Teaching OOP - A Practical Approach using BlueJ Break

23 Teaching OOP - A Practical Approach using BlueJ Conveying key topics

24 Teaching OOP - A Practical Approach using BlueJ Examples Ticket machines & technical support

25 Teaching OOP - A Practical Approach using BlueJ Suggestions #2 Key issues first Read code Use “large” projects Don’t start with a blank screen Do sensible things Prepare for maintenance

26 Teaching OOP - A Practical Approach using BlueJ Key issues first Choose examples to illustrate key issues first Don’t get stuck in detail Avoid completeness trap!

27 Teaching OOP - A Practical Approach using BlueJ Read code Make students read code! (read before write) Show many examples Make sure all examples are well written (and worth reading)

28 Teaching OOP - A Practical Approach using BlueJ Use “large” projects Don’t start with small examples - they don’t have structure Use realistic context Concentrate on object interaction

29 Teaching OOP - A Practical Approach using BlueJ Don’t start with a blank screen Starting with a blank screen requires design (or the example is too trivial) Design is hard Designing a complete application is an advanced exercise

30 Teaching OOP - A Practical Approach using BlueJ Do sensible things Choose examples that make sense Don’t make students do things that you wouldn’t do yourself

31 Teaching OOP - A Practical Approach using BlueJ Prepare for maintenance Prepare students for real-life situations: –code maintenance –modification, extension –documentation –using class libraries –reuse

32 Teaching OOP - A Practical Approach using BlueJ Example The dark world of Zuul...

33 Teaching OOP - A Practical Approach using BlueJ Suggestions #3 Discuss application structure Open/closed exercises Create ownership Apprentice approach

34 Teaching OOP - A Practical Approach using BlueJ Discuss structure OO-modelling Relationships of classes Coupling and cohesion Later: patterns

35 Teaching OOP - A Practical Approach using BlueJ Open/closed exercises Make exercises that are closed so students know exactly what is expected of them (and when they are done), and Make exercises that are open so each student can adapt them to his/her own level of knowledge, expertise and ambition

36 Teaching OOP - A Practical Approach using BlueJ Create ownership Create your exercises and programming projects in such a way that the students take ownership Students then will –work harder –have more fun –learn much, much more...

37 Teaching OOP - A Practical Approach using BlueJ Apprentice approach Let students observe what you are doing See teacher in action Learn by imitation

38 Teaching OOP - A Practical Approach using BlueJ Reflection / Discussion

39 Teaching OOP - A Practical Approach using BlueJ References The material from this workshop will be available on the web: David J Barnes, Michael Kölling Objects First with Java - A Practical Introduction using BlueJ Contact: David Barnes Michael Kölling