OOPs: The Harsh Realities of Programming

Similar documents
Review and Recursion

CHAPTER 5 GENERAL OOP CONCEPTS

Programming II. Modularity 2017/18

Object Oriented Programming

Programming Languages FILS Andrei Vasilateanu

Introduction. Instructor: Jia Xu CSCI-135

CGS 2405 Advanced Programming with C++ Course Justification


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

C++ Classes & Object Oriented Programming

Elementary Concepts of Object Class

Pointers and Terminal Control

Object Oriented Programming. Assistant Lecture Omar Al Khayat 2 nd Year

Inheritance and Polymorphism

Compulsory course in Computer Science

2. COURSE DESIGNATION: 3. COURSE DESCRIPTIONS:

Paytm Programming Sample paper: 1) A copy constructor is called. a. when an object is returned by value

Object-Oriented Programming CSCI-UA

Course materials Reges, Stuart, and Stepp, Martin. Building Java Programs: A Back to Basics Approach. 2d ed. (Boston: Addison-Wesley, 2011).

Multi-Paradigm Approach for Teaching Programming

Object Oriented Programming with Java

Inheritance and Polymorphism

Spring 2003 Instructor: Dr. Shahadat Hossain. Administrative Matters Course Information Introduction to Programming Techniques

OBJECT ORIENTED PROGRAMMING

Object Oriented Programming. C++ 6 th Sem, A Div Ms. Mouna M. Naravani

CSCE 210/2201 Data Structures and Algorithms. Prof. Amr Goneid

CSCE 210/2201 Data Structures and Algorithms. Prof. Amr Goneid. Fall 2018

CS 140 Programming with Objects

AN OVERVIEW OF C++ 1

(0) introduction to the course. how to learn a programming language. (0) course structure

Short Notes of CS201

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

QUIZ How do we implement run-time constants and. compile-time constants inside classes?

Organization of Programming Languages (CSE452) Why are there so many programming languages? What makes a language successful?

Course specification

CSCI 528: OBJECT ORIENTED PROGRAMMING, Fall 2015

CS201 - Introduction to Programming Glossary By

Absolute C++ Walter Savitch


Programming Languages & Paradigms PROP HT Course Council. Subprograms. Meeting on friday! Subprograms, abstractions, encapsulation, ADT

CS112 Lecture: Defining Classes. 1. To describe the process of defining an instantiable class

Developing Microsoft.NET Applications for Windows (Visual Basic.NET)

CSI33 Data Structures

IMACS: AP Computer Science A

EL2310 Scientific Programming

Course Syllabus. Programming Language Paradigms. Spring - DIS Copenhagen. Semester & Location: Elective Course - 3 credits.

Cpt S 122 Data Structures. Course Review Midterm Exam # 2

JAVA MOCK TEST JAVA MOCK TEST II

Lecture 6 Introduction to Objects and Classes

Object-Oriented Programming Fall Robert Grimm, New York University

Programming, numerics and optimization

COLLEGE OF THE DESERT

CENTRAL TEXAS COLLEGE COSC 1337 PROGRAMMING FUNDAMENTALS II. Semester Hours Credit: 3

Derived Classes in C++

Overloaded Operators, Functions, and Students

Review&Preview 1/23/15, 4:08:07 PM 1. 3rd edition - standardized, and standard library allows programmer to start from a higher level

Objects and Classes. Basic OO Principles. Classes in Java. Mark Allen Weiss Copyright 2000

OUTCOMES BASED LEARNING MATRIX

CSC 1052 Algorithms & Data Structures II: Introduction

Exam in TDDB84: Design Patterns,

Unit 1 : Principles of object oriented programming

Outline EXPERIENCE WITH TWO OOP LANGUAGES IN ONE COURSE. HISTORY Methodology and learning design of the course Experience from classes

CSE 70 Final Exam Fall 2009

Fast Introduction to Object Oriented Programming and C++

Reviewing for the Midterm Covers chapters 1 to 5, 7 to 9. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013

Continuations provide a novel way to suspend and reexecute

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE


Course specification

Review sheet for Final Exam (List of objectives for this course)

What is a Programming Paradigm

Chapter 5 Object-Oriented Programming

Course specification

ITT Technical Institute. SD2720 Advanced Software Development Using Java Onsite and Online Course SYLLABUS

CSc 372. Comparative Programming Languages. 2 : Functional Programming. Department of Computer Science University of Arizona

Object Oriented Software Design

CS112 Lecture: Defining Instantiable Classes

PROGRAMMING LANGUAGE 2

CMSC 132: Object-Oriented Programming II

G Programming Languages - Fall 2012

Object-Oriented Design

CS11 Intro C++ Spring 2018 Lecture 1

Chapter 4 Defining Classes I

PROGRAMMING IN C++ COURSE CONTENT

STUDENT LESSON A20 Inheritance, Polymorphism, and Abstract Classes

Example: Fibonacci Numbers

Design to interfaces. Favor composition over inheritance Find what varies and encapsulate it

C++ Important Questions with Answers

Microsoft Visual Basic 2005: Reloaded

Object-Oriented Programming for Managers

Object-Oriented Programming CSCI-UA

Object-Oriented Concept

COLLEGE OF DUPAGE CIS 2542 Advanced C++ with Data Structure Applications Course Syllabus

Lesson Plan. Subject: OBJECT ORIENTED PROGRAMMING USING C++ :15 weeks (From January, 2018 to April,2018)

Unit - IV CHAPTER - 13 INTRODUCTION TO OOP WITH C++ Part 1 Choose the best answer

The University Of Michigan. EECS402 Lecture 06. Andrew M. Morgan. Savitch Ch. 6 Intro To OOP Classes Objects ADTs.

Interview Questions of C++

COMS W3101 Programming Language: C++ (Fall 2016) Ramana Isukapalli

Com S 541. Programming Languages I

Programmazione. Prof. Marco Bertini

Transcription:

Division of Mathematics and Computer Science Maryville College

Outline Course Overview 1 Course Overview 2 3 4

Preliminaries Course Overview Required Materials Big C++ 2nd Edition by Cay Horstmann An Account on smc.cs.maryvillecollege.edu Catalog Description A continuation of Computer Science 111 with emphasis on advanced programming features. Laboratory work supplements and expands lecture topics and offers supervised practice using programming.

Recommended Supplementary Text The C++ Programming Language 4th Edition by Bjarne Stroustrup Written by the creator of C++ Serves as a Good Reference Very in-depth Explanations of The Language This should be on the bookshelf of all serious C++ programmers.

Course Goals Gain an advanced understanding of Object Oriented Programming. Learn to use Object Oriented Analysis and Design to build large complex programs. Gain a preliminary understanding of low level programming concepts, especially memory addressing. Increase your knowledge of using and programming the UNIX operating system. Hone your knowledge of programming tools like make, g++, and gdb. Learn new tools, like rcs.

Grading Course Overview Grading Labs 15% Programming Assignments 50% Exams 35%

Summary of Classroom Expectations Show up for class. Don t cheat. Attempt all the work. Ask lots of questions. Late assignments will generally not be accepted. Don t Panic!

Outline of Major Topics I. Object Oriented Programming a. Classes and Objects b. Inheritance and Polymorphism c. Overloaded Operators and Functions d. Object Oriented Analysis and Design II. Problem Solving Techniques a. Recursion b. Backtracking III. Tools and Techniques a. gdb b. UNIX System API c. Exceptions

Software Development Life Cycle Programming Is: Expensive Very Complex Critical The Ninety-Ninety Rule The first 90 percent of the code accounts for the first 90 percent of the development time. The remaining 10 percent of the code accounts for the other 90 percent of the development time. Tom Cargill, Bell Labs Image Source: wikipedia.org

Coping with Complexity The Main Challenge is Dealing With Complexity Analyze Big Tasks Decompose Big Tasks Encode Tasks into Computer Code

Coping with Customers Real world customers are not very tech savvy. Often, programs perform tasks outside of the programmer s expertise. Many iterations are needed to capture requirements. Even then, requirements are typically vague!

What Makes Programming Difficult Complexity Vague and Underdeveloped Requirements Time Pressure One-Off Nature of Programs

Programming Paradigms Programming paradigms represent ways of thinking and methods of decomposition. Imperative Programming All statements are direct commands which alter the program s state. (ex. Assembly and ALGOL) Procedural Programming Programs are decomposed into sub-routines. (ex. C and Pascal ) Functional Programming Computation is represented as mathematical functions. (ex. LISP and Erlang) Object Oriented Programming Programs are decomposed into objects. (ex. C++ and C#)

Effective Use of a Programming Language General Tips for Programming Language Use A programming language is a formal representation of ideas. Think first and then code! Use a language that is well suited to the task at hand. Learn the idioms of your language. Always use the language to express, rather than obscure, your intentions!

Objects and Classes Object An entity with state and behavior. (Instance of Classes) Variables Concrete Objects Class A collection of objects with identical attributes and behaviors. (Definition of Objects) Member Functions Member Variables Abstract Entity

Parts of Speech and OOP Nouns Objects and Classes Verbs Member Functions Adjectives Member Variables

An OOP Translation Example 1 Write some sentences describing the robot and its state. 2 Write some sentences describing what the robot can do. 3 Sketch out what a robot class may look like.

Four Major Principles of Object Oriented Programming Encapsulation Attributes and state are contained within objects and access to these attributes are restricted. Abstraction The inner workings of the objects are hidden. Inheritance Objects types can be derived from, and extend, other object types. (Is-A relationship) Polymorphism Objects can be referenced by different types, and they still behave correctly when treated as inherited types.

Goals for Effective Object Oriented Programming Your programs should be clear in intention. Objects should be cohesive. Objects should not be tightly coupled with other objects.

Class Declaration class name { public: //public methods protected: //protected variables and methods private: //private variables and methods };

Access Modifiers public Accessible to code inside and outside of the class. Methods Constructors Destructor protected Accessible to code within the class and sub-classes. (A big part of inheritance.) Variables (with great care) Methods private Accessible only to code within the class. Variables Methods

Constructors and Destructors Constructors Initializer for a class Can be overloaded Declared with same name as an object: name(); No return type Destructor Cleans up after an object. Used frequently with dynamic memory. Named: name();

Member Initialization Lists Member initialization lists can be used when simply copying values from constructor arguments. They are an absolute must when working with references! name(int x, int y) : x(x), y(y) { //constructor code }

Constructor and Destructors Best Practices Unless you really know what you are doing, constructors should be public. You should provide at least: 1 No-Argument constructor: name(); A copy constructor: name(name &c); If initial conditions make sense, you should have a constructor which allows them to be set. If you use any dynamic memory, you must create a destructor.

Putting it All Together Let s implement our robot class!