SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.

Slides:



Advertisements
Similar presentations
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
Advertisements

Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 Contents. 2 Run-Time Storage Organization 3 Static Allocation In many early languages, notably assembly and FORTRAN, all storage allocation is static.
Introduction To System Analysis and design
Comp 248 Introduction to Programming Chapter 4 - Defining Classes Part A Dr. Aiman Hanna Department of Computer Science & Software Engineering Concordia.
Programming Languages and Paradigms Object-Oriented Programming.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
OOPs Object oriented programming. Based on ADT principles  Representation of type and operations in a single unit  Available for other units to create.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
Presented by: Mojtaba Khezrian. Agenda Object Creation Object Storage More on Arrays Parameter Passing For Each VarArgs Spring 2014Sharif University of.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
Adapted from Prof. Necula UCB CS 1641 Overview of COOL ICOM 4029 Lecture 2 ICOM 4029 Fall 2008.
Introduction To System Analysis and Design
Features of Object Oriented Programming Lec.4. ABSTRACTION AND ENCAPSULATION Computer programs can be very complex, perhaps the most complicated artifact.
CSE 425: Object-Oriented Programming I Object-Oriented Programming A design method as well as a programming paradigm –For example, CRC cards, noun-verb.
Peyman Dodangeh Sharif University of Technology Fall 2013.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
Chapter 10 Defining Classes. The Internal Structure of Classes and Objects Object – collection of data and operations, in which the data can be accessed.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Comp 248 Introduction to Programming Chapter 4 & 5 Defining Classes Part B Dr. Aiman Hanna Department of Computer Science & Software Engineering Concordia.
Lecture 10 Concepts of Programming Languages Arne Kutzner Hanyang University / Seoul Korea.
CS451 - Lecture 2 1 CS451 Lecture 2: Introduction to Object Orientation Yugi Lee STB #555 (816) * Acknowledgement:
 Objects versus Class  Three main concepts of OOP ◦ Encapsulation ◦ Inheritance ◦ Polymorphism  Method ◦ Parameterized ◦ Value-Returning.
OOPs Object oriented programming. Abstract data types  Representationof type and operations in a single unit  Available for other units to create variables.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 9 Java Fundamentals Objects/ClassesMethods Mon.
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
Object Oriented Software Development 4. C# data types, objects and references.
Peyman Dodangeh Sharif University of Technology Spring 2014.
COM S 228 Introduction to Data Structures Instructor: Ying Cai Department of Computer Science Iowa State University Office: Atanasoff.
Inheritance Inheritance is the process of extending the functionality of a class by defining a new class that inherit,all the features of extending class.
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
OOP Basics Classes & Methods (c) IDMS/SQL News
Sadegh Aliakbary Sharif University of Technology Fall 2010.
ISBN Chapter 12 Support for Object-Oriented Programming.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 10 Java Fundamentals Objects/ClassesMethods.
Object-Oriented Design
Objects as a programming concept
Java Primer 1: Types, Classes and Operators
Advanced Programming Behnam Hatami Fall 2017.
Object Oriented Programming
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
CSC 253 Lecture 8.
CSC 253 Lecture 8.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Parameter Passing Actual vs formal parameters
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2005 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Programs and Classes A program is made up from classes
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Introduction to Data Structure
Object-Oriented Programming
Object Oriented Programming in java
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Java Programming Language
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Classes, Objects and Methods
Lecture 10 Concepts of Programming Languages
ICOM 4029 Fall 2003 Lecture 2 (Adapted from Prof. Necula UCB CS 164)
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Presentation transcript:

SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin

Agenda – Lecture 1b Review of Object-Oriented Programming (OOP) fundamentals. Basic UML: a language for expressing designs. 11/30/2018 SOEN 343, © P.Chalin,

Reminders Tutorial to be held in H-905. You will have to buddy up … 11/30/2018 SOEN 343, © P.Chalin,

What is design? Requirements vs. Design: what vs. how. In design we create a system that will offer services to customers based on their statement of requirements. Course: Object-oriented analysis and design. Hence familiarity with OO programming is essential. 11/30/2018 SOEN 343, © P.Chalin,

Object-Oriented Programming 11/30/2018 SOEN 343, © P.Chalin,

OOP Reference Program Development in Java: Abstraction, Specification, and Object-oriented Design by Liskov and Guttag. AW 2001. Much of what follows is summarized from this book. 11/30/2018 SOEN 343, © P.Chalin,

Object-oriented languages: basic notions Basic notions: object, classes. Every object is an instance of a class. Most data is contained in objects. Objects contain both state and operations Operations are called methods. Objects interact by invoking methods. Methods allow the objects state to be accessed and possibly changed. 11/30/2018 SOEN 343, © P.Chalin,

Objects Have secrets Offer services to other objects in its community. They can hide e.g. data or even algorithm details. Offer services to other objects in its community. 11/30/2018 SOEN 343, © P.Chalin,

Java Programs Consist of classes and interfaces. A class can be used to Hold collections of procedures (static methods), or Define new data types. Interfaces can also be used to define new types. 11/30/2018 SOEN 343, © P.Chalin,

Methods Most of the text in a class or interface file will consists of method definitions. Methods can accept parameters and return results. Arguments are passed by “value”. 11/30/2018 SOEN 343, © P.Chalin,

Packages TBC later. 11/30/2018 SOEN 343, © P.Chalin,

Objects and Variables All data is access by means of variables. Local variables (including method parameters) are allocated on the runtime stack. Every variable has a declared type that is either Primitive type (int, char). Reference type (int [], String, any class type). Variables of Primitive types contain values. Reference types contain references to objects that are stored in the system heap. 11/30/2018 SOEN 343, © P.Chalin,

Stack and Heap Heap Stack [2,1,0] i j a b 3 s t SOEN 343, © P.Chalin, 11/30/2018 SOEN 343, © P.Chalin,

Stack and Heap: Exercise Given the following declarations int i = 6; int j; int a[] = {1,2,3}; int[] b = new int[2]; String s = “abc”; String t = null; what will be the state of the stack and heap after they have all been processed? 11/30/2018 SOEN 343, © P.Chalin,

Stack and Heap Stack Heap i j a b s t 11/30/2018 SOEN 343, © P.Chalin,

Type Hierarchy Every class is a subclass of Object. If S is a subclass of T then we can use an instance of S where ever a T is expected: T t = new S(); Object o = new S(); Object o = new String(“abc”); 11/30/2018 SOEN 343, © P.Chalin,

Method Invocations & Field Access static non-static 11/30/2018 SOEN 343, © P.Chalin,

Static Methods & Fields The method called depends on the declared type of the variable (not the run-time type of the referenced object). Like a “global” procedure and/or variable. 11/30/2018 SOEN 343, © P.Chalin,

Class P – i.e. Parent class class P { static int rate = 1; static String m1() {return “P.m1”} static String m2() { ... } String r1() {… "P.r1:“ + rate;} String r2() { … } } 11/30/2018 SOEN 343, © P.Chalin,

Class C – i.e. Child class class C extends P { static int rate = 2; static String m1() {return “C.m1”} String r1() {… “C.r1:"+rate;} } 11/30/2018 SOEN 343, © P.Chalin,

Main Class, part I P p = new C(); println(p.m1()); println(p.m2()); println(p.r1()); println(p.r2()); println(p.rate); 11/30/2018 SOEN 343, © P.Chalin,

Main Class, part II C c = new C(); println(c.m1()); println(c.m2()); println(c.r1()); println(c.r2()); println(c.rate); 11/30/2018 SOEN 343, © P.Chalin,

Dynamic Dispatching Now consider String s = “abc”; Object o = s; … o.equals(s); 11/30/2018 SOEN 343, © P.Chalin,