Credit: The lecture slides are created based on previous lecture slides by Dan Zingaro.

Similar documents
CSC148H Week 1 >> COURSE INFORMATION, RECAP, OOP. Sadia Rain Sharmin Week of May 7, 2018

CSC209H Lecture 1. Dan Zingaro. January 7, 2015

CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims

Computer Science 210: Data Structures

ECE Object-Oriented Programming using C++ and Java

Announcements. 1. Forms to return today after class:

Welcome. Orientation to online CPS102 Computer Science 2 (Java 2)

CSC207 Week 3. Larry Zhang

Welcome to CSC148! Introduction to Computer Science

CIS 3308 Web Application Programming Syllabus

Lecture 1: Overview & Intro to Java

Syllabus COSC-051-x - Computer Science I Fall Office Hours: Daily hours will be entered on Course calendar (or by appointment)

CSC148 Intro. to Computer Science

Today. An Animated Introduction to Programming. Prerequisites. Computer programming

Announcements. Course Staff. Course Staff. Lectures 10/19/11. CS/ENGRD 2110 Fall Instructor. Administrative Assistant

CMSC201 Computer Science I for Majors

WELCOME TO CS 16! Enrollment status: 117/ Problem Solving with Computers-I

CSC108: Introduction to Computer Programming. Lecture 1

Advanced Programming Concepts. CIS 15 : Spring 2007

Object-Oriented Programming CSCI-UA

During the first 2 weeks of class, all students in the course will take an in-lab programming exam. This is the Exam in Programming Proficiency.

HOUSTON COMMUNITY COLLEGE BUSINESS TECHNOLOGY NORTHEAST COLLEGE-NORTHLINE LOCATION COURSE SYLLABUS FALL 2011 COMPUTER APPLICATION I POFI 1301

STUDENT INSTRUCTIONS FOR KENT STATE UNIVERSITY S PSYCHOLOGY RESEARCH WEBSITE (

CSC290 Communication Skills for Computer Scientists

COSC 115A: Introduction to Web Authoring Fall 2014

INFS 2150 (Section A) Fall 2018

CSE 336. Introduction to Programming. for Electronic Commerce. Why You Need CSE336

CS 241 Data Organization. August 21, 2018

Cisco Academy Year 2 Instructor: Shade Adeleke

Syllabus CS 301: Data Structures Spring 2015

CS 235AM, Mobile Application Development: Android Spring 2016

CSE 332: Data Abstractions. Ruth Anderson Spring 2014 Lecture 1

Recall. Key terms. Review. Encapsulation (by getters, setters, properties) OOP Features. CSC148 Intro. to Computer Science

CSC148: Week 1

Course: Honors AP Computer Science Instructor: Mr. Jason A. Townsend

Welcome to CS 135 (Winter 2018)

San Jose State University College of Science Department of Computer Science CS151, Object-Oriented Design, Sections 1, 2, and 3, Spring 2018

Sona Experiment Management System Participant Manual

Course Syllabus. Course Information

Lab 2: Object-Oriented Design 12:00 PM, Jan 31, 2018

San José State University Computer Science Department CS49J, Section 3, Programming in Java, Fall 2015

CS503 Advanced Programming I CS305 Computer Algorithms I

Who we are: Lecture 1: Overview & Java. Why CS 62? Sample Problems. CS 62 Fall 2016 Kim Bruce & Peter Mawhorter

San José State University Department of Computer Science CS-144, Advanced C++ Programming, Section 1, Spring 2018

CS61BL. Lecture 1: Welcome to CS61BL! Intro to Java and OOP Testing Error-handling

AP Computer Science in Java Course Syllabus

ITT Technical Institute. SD1420 Introduction to Java Programming Onsite and Online Course SYLLABUS

Distributed Systems Intro and Course Overview

Al al-bayt University Prince Hussein Bin Abdullah College for Information Technology Computer Science Department

Application Procedures: Fulbright English Teaching Assistantship IMPORTANT DATES AND DEADLINES - Application Year

CS 4349 Lecture August 21st, 2017

Advanced Relational Database Management MISM Course S A3 Spring 2019 Carnegie Mellon University

CS61A Lecture 1. Amir Kamil UC Berkeley January 23, 2013

AP Computer Science A

Welcome to... CS113: Introduction to C

COSC 115: Introduction to Web Authoring Fall 2013

CSCE Java. Lab 13 - Searching & Sorting. Dr. Chris Bourke

Lecture 1: CSE 373. Data Structures and Algorithms

Oklahoma State University Institute of Technology Face-to-Face Common Syllabus Fall 2017

Object-Oriented Programming for Managers

This handbook contains directions on using tools and resources in WebAccess at CSM.

CSC 172 Data Structures and Algorithms. Fall 2017 TuTh 3:25 pm 4:40 pm Aug 30- Dec 22 Hoyt Auditorium

ECOM 2314 COMPUTER PROGRAMMING II

CS 241 Data Organization using C

COMP-202 Unit 0: Course Details

CSC 1052 Algorithms & Data Structures II: Introduction

Introduction to Programming System Design CSCI 455x (4 Units)

Welcome to Moodle! How To Moodle

Introduction To Data Processing COMP 153 Business Administration Program/Administrative Studies. Course Outline

CISN 340 Data Communication and Networking Fundamentals Fall 2012 (Hybrid)

Introduction to Computer Science with Python Course Syllabus

CMPE012 Computer Engineering 12 (and Lab) Computing Systems and Assembly Language Programming. Summer 2009

WELCOME! (download slides and.py files and follow along!) LECTURE 1

WELCOME TO CS 16! Problem Solving with Computers-I.

Object Oriented Programming Using C++

Due: Tuesday 29 November by 11:00pm Worth: 8%

Enhanced Entity- Relationship Models (EER)

Unit 10: Data Structures CS 101, Fall 2018

Object-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018

Welcome to CS61A! Last modified: Thu Jan 23 03:58: CS61A: Lecture #1 1

STUDENT INFORMATION Introduction. Getting Started. Requesting an Account

Advanced Relational Database Management MISM Course F A Fall 2017 Carnegie Mellon University

Network Security

Philadelphia University Faculty of Information Technology Department of Computer Science --- Semester, 2007/2008. Course Syllabus

Cisco Academy Year 1 Instructor: Ken Shade

CPSC 213. Introduction to Computer Systems. Introduction. Unit 0

CSC309 Winter Lecture 2. Larry Zhang

Introduction to Data Structures

Beijing Jiaotong University CS-23: C++ Programming Summer, 2019 Course Syllabus

COURSE SYLLABUS AND INSTRUCTOR PLAN

3D Graphics Programming Mira Costa High School - Class Syllabus,

ET345P Control Systems [Onsite]

MSO Lecture 1. Wouter Swierstra (adapted by HP) September 11, 2017

PC Applications IT102 estart Fall 2014

CIS 101 Orientation Document Fall 2017

Inheritance and Interfaces

WELCOME TO CS 16! Problem Solving with Computers-I

GPU Programming and Architecture: Course Overview

Data Structures and OO Development II

SCRATCH MODULE 3: NUMBER CONVERSIONS

Transcription:

CSC148 2018 Here 1

Credit: The lecture slides are created based on previous lecture slides by Dan Zingaro. 2

Larry Zhang Office: DH-3042 Email: ylzhang@cs.toronto.edu 3

The teaching team Dan Zingaro: LEC0103 (Coordinator) Larry Zhang: LEC0101 and LEC0102 Vincent Maccio: LEC0104 and ~20 Teaching Assistants 4

What s in CSC148 Object Oriented Design: principles for all programming languages Recursion: magical and powerful problem solving technique Recursive functions Recursive data structures Reasoning about efficiency of code Reasoning about sorting algorithms Prerequisite: CSC108 5

Course Website https://mcs.utm.utoronto.ca/~148/ All course materials can be found here. Links for weekly readings. 6

Evaluation Two assignments (5% each) Two exercises (2% each) Two term tests (15% each) Better test counts for 20%, worse test for 10% Final exam (56%) must get at least 40% on the exam to pass the course 7

Lectures We have three lectures per week (MWF) Introduce most of the new material (W and F) Worksheets and exercises (M) Get involved in classroom interactions answering a question making a guess / bet / vote back-of-the envelope calculations Emotional involvement makes the brain remember better! 8

9

Open Labs This year, labs are replaced by open TA office hour time. We will post recommended lab material each week that we hope you will do for practice Work on this material with your peers and ask the TA if you get stuck! more practice higher marks! 10

Exercises and Assignments The handouts will be on the course website Due at 22:00 on due date; submitted electronically using MarkUs Exercises are completed individually Assignments are completed in a group of 1-3 11

Assignment Late Policy No assignments are accepted late If you can t finish the work, you can earn part marks for a good partial solution Illness and other disasters are another matter; contact me or Dan as soon as you can 12

Get Help Office hours Attend any of the three instructor s office hours (info on course website) or make an appointment Open labs (led by your TA) Online discussion boards (link on course website) Anonymous feedback (link on course website) Form study groups! 13

14

Academic Integrity In brief Never look at someone else s assignment work (not even a draft) Never show other students your assignment work (not even a draft) Don t post anything online (e.g. pastebin, Github) Discuss how to solve an assignment only with your assignment partner, the course TAs, and instructor 15

Academic Integrity... We often handled many academic offense cases in CSC108 and CSC148 Waste of your time, the instructors time, Chair s time, Dean s time. Doesn t help you learn the course material Results in mark penalties and transcript annotations other consequences 16

Other awards For occasional in-class quizzes, or outstanding performance in tests Kahoot quizzes: you ll use a browser (phonen/laptop) to visit https://kahoot.it 17

Checklist for this week Read the course information sheet Bookmark the course website and discussion board Read the recommended readings for Week 1 Log in to the online discussion board. Make sure your login works! If you plan on working on your own computer, install the necessary softwares. The course website has some instructions. Drop by office hours and introduce yourself! 18

This Friday Object Oriented Programming 19

Object Oriented Programming 20

Procedural vs Object-Oriented Procedural programming The program is mainly a description of procedures do this, do this, then do this Object-oriented programming The program is mainly a description of objects and their relations a student has a student number, a UTORID and can take courses, drop courses, etc; a classroom has a podium, desks and students rather than take_course(stu, course), we do stu.take_course(course) Better suited for modelling the real world. OO is not always better than procedural, e.g., sqrt(9) is better than 9.sqrt() 21

Python Objects You have seen some already in CSC108. Examples? DEMO 22

References to an object 23

Classes We can already create some types of objects using the built-in object types, e.g., string, list, dict But sometimes, we want more types of objects, e.g., Student, Building, Game, Circle You can add a new type in Python by defining a new class. then you can instantiate an object of that class Class names are nouns: Student, Course, Rectangle, Animal, Cat, Ship, (and str, list, dict!) 24

How to define a class? A class s definition consists of methods and attributes Methods: actions that an object of this class can perform. e.g., for ship e.g., move(), turn(), shoot(), raise_shields(), lower_shields(), teleport() like functions, but inside the class Attributes: a feature or characteristic of an object implemented using an instance variable it s something that an object HAS, not something that it DOES (not an action) e.g. for ship: weight, length, width, direction, speed 25

Creating an object After defining the class, we don t have an object yet. We need to call a constructor method to instantiate an object of the class In Python, the constructor s name is init () 26

Fun fact In Python, EVERYTHING is an object, even functions. http://www.diveintopython.net/getting_to_know_python/everything_is_an_object.html 27

Object-Oriented Analysis 28

What is object-oriented analysis Given a description of something in real world identify the classes the methods and attributes of each class the relations between the classes Important skill for solving real-world problems! 29

Design a new class 30

Bad Design! 31

Good design 32

Design Another New Class 33

Inheritance 34

Inheritance Many times, a new class will have much in common with an existing class Example: we already have the class Ship, now we need to define a new class for Indestructible Ship Approach #1: Copy-and-paste code from the old class, and then making a few changes. What if you then discover a bug in the original class? What if you find that there are many classes you d like to create from the original one? BAD approach! Approach #2: The new class to specialize an existing class by specifying only what is different between them. This is called Inheritance The class that inherits is called a subclass, and the class that is inherited from is its superclass 35

Inherit from a class class B(A): means B is a subclass of A, i.e., B inherits from A When calling a method on an IndestructibleShip: If the method exists in IndestructibleShip, it is called Otherwise, the one in the superclass is called 36

Relationships between classes: IS-A and HAS-A IS-A Inheritance models is-a relationships The subclass is-a subset of the superclass The indestructible ships is-a subset of ships HAS-A a ship has-a location, a ship has-a engine. has-a relationships is modelled by instance variables Do NOT use inheritance for has-a relationships! 37

Exercise: Identify IS-A / HAS-A Point and LineSegment HAS-A: a LineSegment has two points Integer and Rational IS-A: Integer is a subset of Rational Rational and Irrational neither Rectangle and Shape IS-A: Rectangle is a set subset of Shape Rectangle and Square this one is interesting, try writing code for it and see if inheritance makes sense for it then discuss (office hours, discussion boards, study groups) 38

Next week Exercises Stacks and Queues 39