CSci 162 Lecture 8 Martin van Bommel. Large-scale Programming Up to now we have been writing relatively short programs to solve simple problem Want to.

Slides:



Advertisements
Similar presentations
User-Defined Functions Like short programs Can operate on their own data Can receive data from callers and return data to callers.
Advertisements

Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
C Module System C and Data Structures Baojian Hua
COMPSCI 105 S Principles of Computer Science 12 Abstract Data Type.
ITEC200 Week01 Introduction to Software Design.
16/11/2015 9:05 AM6/11/2015 9:05 AM6/11/2015 9:05 AMFunctions Functions A function consists of: Name Name Arguments (also called parameters) Arguments.
Fall 2007CS 225 Introduction to Software Design Chapter 1.
CS 201 Functions Debzani Deb.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program.
Using Abstraction to Manage Complexity Abstraction: procedural abstraction & data abstraction. Procedural abstraction=> function development should separate.
Fall 2007CS 2251 Software Engineering Intro. Fall 2007CS 2252 Topics Software challenge Life-cycle models Design Issues Documentation Abstraction.
CS 201 Functions Debzani Deb.
Object-oriented Programming Concepts
Chapter 6: User-Defined Functions I
1 CSC 1401 S1 Computer Programming I Hamid Harroud School of Science and Engineering, Akhawayn University
Spring 2009CS 225 Introduction to Software Design Chapter 1.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Functions A function is a snippet of code that performs a specific task or tasks. You use a multitude of functions daily when you do such things as store.
Lecture 5: Modular Programming (functions – part 1 BJ Furman 27FEB2012.
1 Using Classes Object-Oriented Programming Using C++ Second Edition 5.
Classes Mark Hennessy Dept. Computer Science NUI Maynooth C++ Workshop 18 th – 22 nd Spetember 2006.
1/19 Component Design On-demand Learning Series Software Engineering of Web Application - Principles of Good Component Design Hunan University, Software.
An Object-Oriented Approach to Programming Logic and Design
chap13 Chapter 13 Programming in the Large.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. C How To Program - 4th edition Deitels Class 05 University.
Chapter 13 Programming in the Large Dr. Jiung-yao Huang Dept. Comm. Eng. Nat. Chung Cheng Univ. TA: 鄭筱親 陳昱豪.
Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13: Introduction to Classes.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 7 Structured Data and Classes.
Programming in C++ Language ( ) Lecture 5: Functions-Part1 Dr. Lubna Badri.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 6 September 17, 2009.
Chapter 4: Subprograms Functions for Problem Solving Mr. Dave Clausen La Cañada High School.
38 4/11/98 CSE 143 Modules [Chapter 2]. 39 4/11/98 What is a Module?  Collection of related items packaged together  Examples:  Stereo System Components.
1 CHAPTER 3 MODULAR PROGRAMMING. 2 Introduction  A library in C is a collection of general purpose and related functions.  2 types of libraries: Standard.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program.
Abstraction ADTs, Information Hiding and Encapsulation.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 5.3Math Library Functions Math library functions –perform.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Functions Outline 5.1Introduction 5.2Program Modules.
KIC/Computer Programming & Problem Solving 1.  Introduction  Program Modules in C  Math Library Functions  Functions  Function Definitions  Function.
Computer Programming Rattapoom Waranusast Department of Electrical and Computer Engineering Faculty of Engineering, Naresuan University.
Chapter 3 Top-Down Design with Functions Part II J. H. Wang ( 王正豪 ), Ph. D. Assistant Professor Dept. Computer Science and Information Engineering National.
MODULAR ORGANIZATION Prepared by MMD, Edited by MSY1.
Chapter 10: Classes and Data Abstraction. Objectives In this chapter, you will: Learn about classes Learn about private, protected, and public members.
CSci 162 Lecture 10 Martin van Bommel. Procedures vs Objects Procedural Programming –Centered on the procedures or actions that take place in a program.
Design Reuse Earlier we have covered the re-usable Architectural Styles as design patterns for High-Level Design. At mid-level and low-level, design patterns.
FALL 2001ICOM Lecture 01 ICOM 4015 Advanced Programming Lecture 0 Review of Programming I Reading: LNN Chapters 1-3,5-6.
Or how to work smarter when building solutions.  2:30 – 3:30 Mondays – focus on problem solving (with some terminology thrown in upon occasion)  All.
Chapter 12: Programming in the Large By: Suraya Alias 1-1.
Computer Science 112 Fundamentals of Programming II.
Chapter 10: Classes and Data Abstraction. Classes Object-oriented design (OOD): a problem solving methodology Objects: components of a solution Class:
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 13: Introduction to Classes.
Dale Roberts CSCI N305 Functions Declarations Department of Computer and Information Science, School of Science, IUPUI.
FUNCTIONS (C) KHAERONI, M.SI. OBJECTIVE After this topic, students will be able to understand basic concept of user defined function in C++ to declare.
Chapter 11: Abstract Data Types Lecture # 17. Chapter 11 Topics The Concept of Abstraction Advantages of Abstract Data Types Design Issues for Abstract.
Unit 10 Code Reuse. Key Concepts Abstraction Header files Implementation files Storage classes Exit function Conditional compilation Command-line arguments.
BIL 104E Introduction to Scientific and Engineering Computing Lecture 4.
Introduction to Classes
CSCI 161: Introduction to Programming Function
Functions.
Chapter 5 - Functions Outline 5.1 Introduction
Functions Declarations CSCI 230
Subprograms and Programmer Defined Data Type
CS149D Elements of Computer Science
Functions Imran Rashid CTO at ManiWeber Technologies.
ENERGY 211 / CME 211 Lecture 27 November 21, 2008.
Lecture 8 Object Oriented Programming (OOP)
Presentation transcript:

CSci 162 Lecture 8 Martin van Bommel

Large-scale Programming Up to now we have been writing relatively short programs to solve simple problem Want to now think about the management of large-scale programs Top-down design still works to modularize a large project into individual pieces Want pieces to be implemented by different programmers

Procedural Abstraction After breaking down problem into solvable chunks, must think about chunks separately Procedural abstraction –separate concerns of what a function does from details of how it does it Permits use of function in design of problem solution before implementation is done Think - integer array functions

Data Abstraction Data abstraction –separate concerns of types of data objects and the associated operations from the details of how represented in memory and implemented Permits focus on the use of the data in solving larger problems Again think integer array and its operations

Information Hiding Abstractions enable designer to make implementation decisions in a more ad-hoc fashion - can postpone implementation Concealing details of implementation of data object and only enabling manipulation via defined operations allows changes to be made at lower level without affecting upper Protecting implementation details from user is called information hiding

Reusable Code Reusable code - can be used by many different applications Encapsulation - packaging data object together with its operators in a library Use #include to access the library Want to be able to provide these ourselves

Header Files Header file - text file containing all information about a library needed by the compiler and the user of the library Contents –comment summarizing library’s purpose –#define directives –type definitions for library –comments for each library function –function prototypes in form extern prototype

Implementation Files Implementation file – C++ source file containing code of library’s functions and any other information needed for compiling Contents –comment summarizing library’s purpose –#include directives for header file and others –#define directives needed in implementation –type definitions used only in implementation –function implementations (including comments)

Interface Conceptual entity Boundary between the implementation of a library and programs that use that library Information passes across boundary whenever functions in library are called Interface mediates and gives structure to the exchange of information between library and its users -.h file serves as interface

Example Math library - sqrt function Implementation contains steps to calculate square root of a number User needs not know implementation, only use of function –- how to pass in value and get back result Shown in - file “cmath.h” –double sqrt(double);

Interface Terminology Implementor - defines functions –programmer who implements a library Client - uses functions –programmer who calls functions in library Both must know: –Function name –The arguments and their types –The type of the return result

Interface Design Unified - single abstraction with theme Simple - hide all complexity from client Sufficient - meet the needs of client General - meet needs of different clients Stable - never change structure and effect of a function in interface, even if implementation changes or more functions added