Programming II - Part 1 – Object Oriented Programming with Java Sebastian Uchitel www.doc.ic.ac.uk/~su2.

Slides:



Advertisements
Similar presentations
Object-Oriented Programming Session 9 Course : T Programming Language Concept Year : February 2011.
Advertisements

George Blank University Lecturer.
OBJECT ORIENTED PROGRAMMING M Taimoor Khan
Unified Modeling Language
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
Information Hiding Chapter 5: Classes and Objects in Depth.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Aalborg Media Lab 18-Jun-15 Introduction Introduction to System Design I Fall 2004.
CS565 Advanced Software Development (1 unit) Lecturer: Adrian O’Riordan Contact: is Office: prefab, behind.
Lecture 9 Concepts of Programming Languages
CSC 111 Course orientation
CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++
Computer Science A 1: 3/2. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated.
Java CourseWinter 2009/10. Introduction Object oriented, imperative programming language. Developed: Inspired by C++ programming language.
1 Chapter 8 Objects and Classes. 2 Motivations After learning the preceding chapters, you are capable of solving many programming problems using selections,
Java Software Solutions Lewis and Loftus Chapter 2 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Software Concepts -- Introduction.
New experiences with teaching Java as a second programming language Ioan Jurca “Politehnica” University of Timisoara/Romania
Object-Oriented Programming Dr. Napoleon H. Reyes, Ph.D. Computer Science Institute of Information and Mathematical Sciences Rm QA, IIMS, Albany.
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.
May 1, 2007Mohamad Eid SEG 3120 User Interface Design Mohamad Eid Office: SITE 5077 Tel: (613) ext. 2148
EC-241 OBJECT-ORIENTED PROGRAMMING (OOP)
C++ Programming. Table of Contents History What is C++? Development of C++ Standardized C++ What are the features of C++? What is Object Orientation?
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
Object Oriented Design and Programming Alan Goude Room: Sheaf 9323.
1 CSC 201: Computer Programming I B. S. Afolabi. Introduction  3 unit course  2 hours of lecture/week Thursdays 4.00pm – 6.00pm Mondays 4.00pm – 6.00pm.
An analysis of exam results in the Object-Oriented Programming course at „Politehnica” University of Timisoara Ioan Jurca.
Recap (önemli noktaları yinelemek) from last week Paradigm Kay’s Description Intro to Objects Messages / Interconnections Information Hiding Classes Inheritance.
Java Classes Using Java Classes Introduction to UML.
Course: Object Oriented Programming - Abstract Data Types Unit1: IntroductionSlide Number 1 Introduction Course: Object Oriented Programming Abstract Data.
Sadegh Aliakbary Sharif University of Technology Fall 2012.
Object Oriented Programming Lecture 1: Introduction.
Module Overview n Module Title: OO Programming n Module Code: MIT3446 n Module Value: 3.0 n Duration: 15 weeks n Class-Contact Hours: Lecture15 hrs n Lab/Tutor30hrs.
Selected Topics in Information Technology Programming Language - JAVA Semester 1/2554.
1 Object-Oriented Programming Using C++ CLASS 1. 2 Review of Syllabus Catalog Description –An introduction to object oriented programming techniques using.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 6: Object-Oriented Programming.
Lecture 10 Concepts of Programming Languages Arne Kutzner Hanyang University / Seoul Korea.
Chapter 12 Support for Object-Oriented Programming.
C++ The reason why it is still in use. Table of Contents Disadvantages Disadvantages Advantages Advantages Compare with object-oriented programming language.
1 OOP - An Introduction ISQS 6337 John R. Durrett.
Object Oriented Programming (FIT-II) J. H. Wang Jan. 31, 2008.
Boris Milašinović Faculty of Electrical Engineering and Computing University of Zagreb, Croatia 15th Workshop on "Software Engineering Education and Reverse.
Programmeren 1 6 september 2010 HOORCOLLEGE 2: INTERACTIE EN CONDITIES PROGRAMMEREN 1 6 SEPTEMBER 2009 Software Systems - Programming - Week.
1 Chapter 11 © 1998 by Addison Wesley Longman, Inc The Concept of Abstraction - The concept of abstraction is fundamental in programming - Nearly.
A High Flying Overview CS139 – Fall 2006 How far we have come.
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,
1 Welcome Alireza Humber College Lecture 1 Game 540 Alireza
ISBN Chapter 12 Support for Object-Oriented Programming.
서울대한양대 ( 안 산 ) 충남대 1년1년 컴퓨터기초 (C) 컴퓨터프로그래밍 (C, Java) 컴퓨터프로그래밍 (C) 2. 봄 프로그래밍 원리 (Scheme, ML) Structure & Interpretation of Computer Programs 프로그래밍 방법론.
A High Flying Overview CS139 – Fall 2010 How far we have come.
Introduction to Object Oriented
EECS3311 Software Design Summer 2016 Przemyslaw Pawluk
PROGRAMMING PARADIGMS
Classes and Objects in Java
Object-Orientated Programming
Lecture 9 Concepts of Programming Languages
Introduction to Programming 2
CS139 – Fall 2010 How far we have come
EECE 310 Software Engineering
Computer Programming 1 introduction to JAVA Lecture 1 Instructor: Ruba A. Salamah Islamic University of Gaza.
Support for Object-Oriented Programming
Chapter 5: Classes and Objects in Depth
Objects First with Java A Practical Introduction using BlueJ
Object-Oriented Programming
Week 4 Lecture-2 Chapter 6 (Methods).
SE-1021 Software Development 2
Objects First with Java A Practical Introduction using BlueJ
Chapter 5: Classes and Objects in Depth
Lecture 10 Concepts of Programming Languages
Lecture 9 Concepts of Programming Languages
Presentation transcript:

Programming II - Part 1 – Object Oriented Programming with Java Sebastian Uchitel

2 © S. Uchitel, 2004 Course Structure Lectures Lectures  Room 308.  Monday 14:00 and Friday 10:00. Tutorials Tutorials  Room 344 (and 308 if we need more space)  Monday 15:00 Lab Lab  4 labs dedicated to topics covered in Programming II.  Week 2 (unassessed), and weeks 3, 5, and 6. Assessment Assessment  2 assessed assignments (one for each part of the course)  2h exam, 3 questions out of 4

3 © S. Uchitel, 2004 Part I - Aims 1. Learn concepts and fundamentals of the Object Oriented paradigm. 2. Apply in a real programming language (Java) these concepts and fundamentals 3. Learn Java 4. Practice problem solving using Java and OO principles.

4 © S. Uchitel, 2004 Part I - Textbooks Java Software Solutions – Foundations of Program Design (3 rd ed.), Lewis and Loftus, Addison Wesley. Java Software Solutions – Foundations of Program Design (3 rd ed.), Lewis and Loftus, Addison Wesley. Thinking in Java (3 rd ed.), Bruce Eckel, Prentice Hall. Freely available at Thinking in Java (3 rd ed.), Bruce Eckel, Prentice Hall. Freely available at Java Documentation: Java Documentation:  

5 © S. Uchitel, 2004 Part I - Outline Introduction Introduction  Motivation  From Kenya to Java Objects and Classes: A User’s Perspective Objects and Classes: A User’s Perspective  What are they?  How do I create objects from classes, and how do I use them?  Where do I get classes from in the first place? Objects and Classes: A Developers Perspective Objects and Classes: A Developers Perspective  How do I create my own classes?  How do I design “good” classes? Inheritance and Polymorphism Inheritance and Polymorphism Interfaces and Abstract Classes Interfaces and Abstract Classes Collections Collections Exceptions Exceptions

6 © S. Uchitel, 2004 Why Object Oriented Programming? Programming is about two things Programming is about two things  Problem solving  Managing complexity OO Programming provides conceptual framework and programming constructs for managing complexity OO Programming provides conceptual framework and programming constructs for managing complexity In principle with imperative and functional languages you can implement anything but... In principle with imperative and functional languages you can implement anything but...  Functional languages: input and output? acceptance in industry?  Imperative languages do not manage complexity well. More difficult to understand/maintain/extend.

7 © S. Uchitel, 2004 Why learn Java? Why Java? Why Java?  Java is an OO programming language.  Widespread in Industry for development of traditional and web-based applications Why not Kenya? Why not Kenya?  Kenya is not an OO programming language.  Developed at Imperial for educational purposes.  Outside Imperial College VERY few people know it.  Not used in Industry Why not other OO programming languages? Why not other OO programming languages?  C++? Complex (and confusing) mix between OO and imperative programming, memory management, and more...  Smalltalk? Pure? But, low acceptance in Industry, and more...

8 © S. Uchitel, 2004 From Kenya... void main() { // Requests two numbers and prints the larger println("Type in your 2 numbers -> "); println("The winner is " + bigger(readInt(), readInt())); } int bigger(int a, int b){ //post: returns the larger of the 2 values if (a > b) {return a;} else {return b;} } To tool...

9 © S. Uchitel, to Java import kenya.io.InputReader; public class Bigger { public static void main(String [] args) { System.out.println("Type in your 2 numbers -> "); System.out.println("Type in your 2 numbers -> "); System.out.println("The winner is " + System.out.println("The winner is " + bigger(InputReader.readInt(), InputReader.readInt())); bigger(InputReader.readInt(), InputReader.readInt()));} static int bigger(int a, int b){ static int bigger(int a, int b){ //post: returns the larger of the 2 values if (a > b) {return a;} else {return b;} }}

10 © S. Uchitel, 2004 From Kenya to Java By adding the bits and pieces of the previous slide, you can now write Java programs for all the Kenya programs you did in the previous term! By adding the bits and pieces of the previous slide, you can now write Java programs for all the Kenya programs you did in the previous term! However, in the next 10 lectures you will learn what these bits and pieces are! However, in the next 10 lectures you will learn what these bits and pieces are! Recommendations: Recommendations:  Throw the Kenya compiler away!  Write Java from the very first day!

11 © S. Uchitel, 2004 What’s new: Classes import kenya.io.InputReader; public class Bigger { public static void main(String [] args) { System.out.println("Type in your 2 numbers -> "); System.out.println("Type in your 2 numbers -> "); System.out.println("The winner is " + System.out.println("The winner is " + bigger(InputReader.readInt(), InputReader.readInt())); bigger(InputReader.readInt(), InputReader.readInt()));} static int bigger(int a, int b){ static int bigger(int a, int b){ //post: returns the larger of the 2 values if (a > b) {return a;} else {return b;} }} Classes (In Java, nearly everything appears within one) within one)

12 © S. Uchitel, 2004 What’s new: Objects import kenya.io.InputReader; public class Bigger { public static void main(String [] args) { System.out.println("Type in your 2 numbers -> "); System.out.println("Type in your 2 numbers -> "); System.out.println("The winner is " + System.out.println("The winner is " + bigger(InputReader.readInt(), InputReader.readInt())); bigger(InputReader.readInt(), InputReader.readInt()));} static int bigger(int a, int b){ static int bigger(int a, int b){ //post: returns the larger of the 2 values if (a > b) {return a;} else {return b;} }} Objects, object methods and calls

13 © S. Uchitel, 2004 What’s new: Command line parameters import kenya.io.InputReader; public class Bigger { public static void main(String [] args) { System.out.println("Type in your 2 numbers -> "); System.out.println("Type in your 2 numbers -> "); System.out.println("The winner is " + System.out.println("The winner is " + bigger(InputReader.readInt(), InputReader.readInt())); bigger(InputReader.readInt(), InputReader.readInt()));} static int bigger(int a, int b){ static int bigger(int a, int b){ //post: returns the larger of the 2 values if (a > b) {return a;} else {return b;} }} Command line parameters

14 © S. Uchitel, 2004 What’s new: Packages import kenya.io.InputReader; public class Bigger { public static void main(String [] args) { System.out.println("Type in your 2 numbers -> "); System.out.println("Type in your 2 numbers -> "); System.out.println("The winner is " + System.out.println("The winner is " + bigger(InputReader.readInt(), InputReader.readInt())); bigger(InputReader.readInt(), InputReader.readInt()));} static int bigger(int a, int b){ static int bigger(int a, int b){ //post: returns the larger of the 2 values if (a > b) {return a;} else {return b;} }} Packages

15 © S. Uchitel, 2004 What’s new: Visibility and Encapsulation import kenya.io.InputReader; public class Bigger { public static void main(String [] args) { System.out.println("Type in your 2 numbers -> "); System.out.println("Type in your 2 numbers -> "); System.out.println("The winner is " + System.out.println("The winner is " + bigger(InputReader.readInt(), InputReader.readInt())); bigger(InputReader.readInt(), InputReader.readInt()));} static int bigger(int a, int b){ static int bigger(int a, int b){ //post: returns the larger of the 2 values if (a > b) {return a;} else {return b;} }} Visibility & Encapsulation

16 © S. Uchitel, 2004 What’s new: Class scope import kenya.io.InputReader; public class Bigger { public static void main(String [] args) { System.out.println("Type in your 2 numbers -> "); System.out.println("Type in your 2 numbers -> "); System.out.println("The winner is " + System.out.println("The winner is " + bigger(InputReader.readInt(), InputReader.readInt())); bigger(InputReader.readInt(), InputReader.readInt()));} static int bigger(int a, int b){ static int bigger(int a, int b){ //post: returns the larger of the 2 values if (a > b) {return a;} else {return b;} }} Class scope

17 © S. Uchitel, 2004 What’s new: Much more! Inheritance Inheritance Polymorphism Polymorphism Dynamic Binding Dynamic Binding Casting Casting Overloading Overloading Constructors Constructors Abstract Classes Abstract Classes Interfaces Interfaces and much more! and much more!