Unit 1 - Introducing Abstract Data Type (ADT) Part 1.

Slides:



Advertisements
Similar presentations
COMPSCI 105 S Principles of Computer Science 12 Abstract Data Type.
Advertisements

CHAPTER 1 SOFTWARE DEVELOPMENT. 2 Goals of software development Aspects of software quality Development life cycle models Basic concepts of algorithm.
Ch 12: Object-Oriented Analysis
Software Engineering and Design Principles Chapter 1.
Introduction To System Analysis and Design
Designing Classes Chapter 3. 2 Chapter Contents Encapsulation Specifying Methods Java Interfaces Writing an Interface Implementing an Interface An Interface.
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
Chapter 1 Software Development. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 1-2 Chapter Objectives Discuss the goals of software development.
Department of Computer Science University of Maryland, College Park
1 Lecture 5 Introduction to Software Engineering Overview  What is Software Engineering  Software Engineering Issues  Waterfall Model  Waterfall Model.
1 CMSC 132: Object-Oriented Programming II Nelson Padua-Perez William Pugh Department of Computer Science University of Maryland, College Park.
Chapter 1 Principles of Programming and Software Engineering.
© Copyright Eliyahu Brutman Programming Techniques Course.
Object-Orientated Design Unit 3: Objects and Classes Jin Sa.
Software Engineering Principles and C++ Classes
Data Structures Using C++1 Chapter 1 Software Engineering Principles and C++ Classes.
Data Abstraction: The Walls
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Basic Concepts Chapter 1 Objectives
Chapter 3 Object-Oriented Analysis of Library Management System(LMS)
Introduction To System Analysis and design
OO Analysis and Design CMPS OOA/OOD Cursory explanation of OOP emphasizes ▫ Syntax  classes, inheritance, message passing, virtual, static Most.
Software Engineering CS B Prof. George Heineman.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
Introduction Ellen Walker CPSC 201 Data Structures Hiram College.
CHAPTER ONE Problem Solving and the Object- Oriented Paradigm.
OOD Case Study (For parallel treatment, see Chapter 2 of the text)
Introduction To System Analysis and Design
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
Programming in Java Unit 3. Learning outcome:  LO2:Be able to design Java solutions  LO3:Be able to implement Java solutions Assessment criteria: 
Object-Oriented Programming in C++
Object-Oriented Software Development F Software Development Process F Analyze Relationships Among Objects F Class Development F Class Design Guidelines.
SE: CHAPTER 7 Writing The Program
1 CSC 222: Computer Programming II Spring 2004 See online syllabus at: Course goals:
CS3773 Software Engineering Lecture 04 UML Class Diagram.
1 Software Development Software Engineering is the study of the techniques and theory that support the development of high-quality software The focus is.
Data Structures Using C++1 Chapter 1 Software Engineering Principles and C++ Classes.
Chapter 1 Data Structures and Algorithms. Primary Goals Present commonly used data structures Present commonly used data structures Introduce the idea.
Design.ppt1 Top-down designs: 1. Define the Problem IPO 2. Identify tasks, Modularize 3. Use structure chart 4. Pseudocode for Mainline 5. Construct pseudocode.
1 Introduction to Classes and Objects Chapter 3 Introduction to Classes and Objects Chapter 3.
Designing Classes Prelude © 2015 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures and Abstractions with Java, 4e Frank.
Designing Classes Chapter 3. 2 Chapter Contents Encapsulation Specifying Methods Java Interfaces Writing an Interface Implementing an Interface An Interface.
Chapter 4 Data Abstraction: The Walls. © 2004 Pearson Addison-Wesley. All rights reserved4-2 Abstract Data Types Modularity –Keeps the complexity of a.
Data Abstaraction Chapter 10.
Chapter 10 Classes and Objects In-Depth. Chapter 10 A class provides the foundation for creating specific objects, each of which shares the general attributes,
Data Structures Using C++ 2E
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Chapter 2 Object-Oriented Paradigm Overview. Getting Acquainted with the Class Project Read the requirements specification carefully Make note of any.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Chapter 10: Classes and Data Abstraction. Objectives In this chapter, you will: Learn about classes Learn about private, protected, and public members.
Winter 2011SEG Chapter 11 Chapter 1 (Part 1) Review from previous courses Subject 1: The Software Development Process.
INFSY 535.  Small systems  Larger systems 1.Understand the program requirement- what 3. Write and test each part (unit testing) 4. Maintenance 2. Specify.
(1) ICS 313: Programming Language Theory Chapter 11: Abstract Data Types (Data Abstraction)
Chapter 1 Data Abstraction: The Walls CS Data Structures Mehmet H Gunes Modified from authors’ slides.
Chapter 10: Classes and Data Abstraction. Classes Object-oriented design (OOD): a problem solving methodology Objects: components of a solution Class:
Chapter 2 Principles of Programming and Software Engineering.
Unit 1 - Introducing Abstract Data Type (ADT) Part 3 – Slides 24 to end.
Unit 1 - Introducing Abstract Data Type (ADT) Part 3 – Slides 1 to 11.
CSC 243 – Java Programming, Fall, 2008 Tuesday, September 30, end of week 5, Interfaces, Derived Classes, and Abstract Classes.
Advanced Data Structures Lecture 1
About the Presentations
Slides by Steve Armstrong LeTourneau University Longview, TX
Review CSE116 2/21/2019 B.Ramamurthy.
Copyright 2007 Oxford Consulting, Ltd
Lecture 2 – Abstract Data Type (ADT)
CMPT 225 Lecture 6 – Review of Complexity Analysis using the Big O notation + Comparing List ADT class implementations.
Lecture 3 – Data collection List ADT
Lecture 4 – Data collection List ADT
Presentation transcript:

Unit 1 - Introducing Abstract Data Type (ADT) Part 1

Unit Objectives Solve a problem using a concrete data type (CDT) ◦ Apply 4 steps of software development process  Side trip -> UML class diagram Solve same problem using an abstract data type ◦ Introduce abstract data type (ADT) ◦ Introduce our first ADT -> List  Design ADT List  First implementation: array-based List  Side trip -> pointers and linked lists  Second implementation: link-based List ◦ Compare both ADT List implementations  Side trip -> efficiency analysis CMPT Anne Lavergne2

What is a Concrete Data Type (CDT)? Term used to contrast with Abstract Data Type (ADT) Definition ◦ Data structure, i.e., constructs, available as part of a programming language, in which we store data Examples: ◦ array ◦ linked list: classes and pointers CMPT Anne Lavergne3

Review: The 4 Steps of the Software Development Process Step 1: Problem statement Step 2: Design Step 3: Implementation Step 4: Testing CMPT Anne Lavergne4

Step 1 - Problem Statement FriendsBook Application ◦ Design and implement an application that maintains the data for a simple social network. ◦ Each person in the network must have a profile that contains the person’s name, optional image, current status and a list of friends. ◦ Your application must allow a user to join the network by creating a profile, leave the network modify the profile, search for other profiles, and add friends. Source: Textbook - Programming Problem 11 - Chapter 9 - Page 287 CMPT Anne Lavergne5

Step 1 - Question Is the problem statement clear and unambiguous? CMPT Anne Lavergne6

Why is Step 1 important! This quote demonstrates why problem statement must be clear and unambiguous before we move on to the other steps of software development process CMPT Anne Lavergne7

Step 2 - OO Design Model “entities” from problem statement Using: ◦ “Noun” technique to figure out what could be a classes and what could be its attributes ◦ OO Principles:  Encapsulation  Information hiding  Single responsibility CMPT Anne Lavergne8

Step 2 - OO Design Choose appropriate ADT ◦ In this first implementation of our FriendsBook application, we shall choose a CDT instead 3. Record our design ◦ Use UML class diagram 4. Specify behaviour of our program ◦ Write algorithm (in pseudocode) CMPT Anne Lavergne9

Side Trip - UML

UML: Unified Modeling Language Object-Oriented Paradigm modelling notation Role: clear and effective way to represent (model) various aspects of software system Includes variety of techniques Programming language independent Flexible: allow models to evolve from one phase to another In this course, we will use UML Class Diagrams CMPT Anne Lavergne11

UML Class Diagram contains… Class ◦ Attributes ◦ Operations Relationship between classes ◦ Generalization (is-a) ◦ Aggregation (has-a) ◦ Dependency (uses) ◦ Multiplicity + other details CMPT Anne Lavergne12

CMPT Anne Lavergne13 Class Class Name Attributes Operations - account ID - customer - balance + deposit(…) + withdraw(…) Example: Exclude constructors, destructors, getters/setters. Why? Because we assume that we will develop these methods for our classes, if they are needed. Account How to represent a class in UML

UML class diagram for our FriendsBook Application CMPT Anne Lavergne14 FriendsBook - numberOfMembers : integer - members : Profile[0..*] + join( newProfile : Profile ) : void + leave( profile : Profile ) : void + modify( profile : Profile ) : void + search( target : String ) : Profile Profile - name : String - image : String - status : String - numberOfFriends : integer - friends : String[0..*] 0..* + addFriend( aFriend : String ) : void

Step 3 - Solution #1 – Code Posted on our course web site Week 2: ◦ Code demonstrating class testing with a Test Driver:  FriendsBook version 1 Profile.h, Profile.cpp, FriendsBook.cpp (Test Driver), MakefileProfile.hProfile.cppFriendsBook.cppMakefile ◦ Code demonstrating Incremental Development + use of CDT:  FriendsBook version 2 FriendsBook.cpp and version 3 FriendsBook.cppFriendsBook.cpp CMPT Anne Lavergne15

Documentation Header Comment Block Class description Class Invariant Method description Preconditions Postconditions CMPT Anne Lavergne16

Solution #1 – Disadvantages of having client code manipulating data directly 1. FriendsBook has many responsibilities: ◦ Interface with the user ◦ Manage data ( Profile objects) CMPT Anne Lavergne17

Observation: Client Code versus CDT Our FriendsBook (client code) manipulates the data, i.e., the array (CDT or data structure) containing Profile objects directly array Directly access data FriendsBook (client code) CMPT Anne Lavergne18

Solution #1 – Disadvantages of having client code manipulating data directly 2. Difficult to reuse the same data collection (array + functions to manipulate its data) in another application CMPT Anne Lavergne19