Modules, Subroutines, Procedures, Functions, or Methods

Slides:



Advertisements
Similar presentations
Modular Design Using Subroutines (functions later)
Advertisements

Lecture 9: Implementation Dr Valentina Plekhanova University of Sunderland, UK.
Unit 6 Assignment 2 Chris Boardley.
Procedural programming in Java
Chapter 3: Modules, Hierarchy Charts, and Documentation
Chapter 3: Modularization
Chapter 2: Modularization
Modules, Hierarchy Charts, and Documentation
Programming Logic and Design Fourth Edition, Introductory
ALGORITHMS THIRD YEAR BANHA UNIVERSITY FACULTY OF COMPUTERS AND INFORMATIC Lecture two Dr. Hamdy M. Mousa.
Programming Logic and Design Fourth Edition, Introductory
Introduction to Computers and Programming Lecture 11: Introduction to Methods Professor: Evan Korth New York University.
Introduction to Computers and Programming Introduction to Methods in Java.
C Lecture Notes 1 Program Control (Cont...). C Lecture Notes 2 4.8The do / while Repetition Structure The do / while repetition structure –Similar to.
Structured Programming structured programming: A technique for organizing and coding computer programs in which a hierarchy of modules is used, each having.
Program Design and Development
Modules, Hierarchy Charts, and Documentation
Understanding the Mainline Logical Flow Through a Program (continued)
WEL COME PRAVEEN M JIGAJINNI PGT (Computer Science) MCA, MSc[IT], MTech[IT],MPhil (Comp.Sci), PGDCA, ADCA, Dc. Sc. & Engg.
Problem Solving Chapter 2. What is an algorithm? n A solution to a problem that is: –Precise –Effective –Terminating.
The Program Design Phases
 2003 Prentice Hall, Inc. All rights reserved Introduction Modules –Small pieces of a problem e.g., divide and conquer –Facilitate design, implementation,
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Lecture 5: Modular Programming (functions – part 1 BJ Furman 27FEB2012.
Programming Languages CPS120: Introduction to Computer Science Lecture 5.
OOP- OBJECT OBJECT PROGRAMMING By KRATI SHARMA 02 XI-B ✏✏✏✏ ☺☻☺☻☺☻☺ ✏✏✏✏
Dr. Ken Hoganson, © August 2014 Programming in R STAT8030 Programming in R COURSE NOTES 1: Hoganson Programming Languages.
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
An Object-Oriented Approach to Programming Logic and Design
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 5 Functions.
Programming Logic and Design Fifth Edition, Comprehensive
SE: CHAPTER 7 Writing The Program
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
INTRODUCTION TO COMPUTING CHAPTER NO. 04. Programming Languages Program Algorithms and Pseudo Code Properties and Advantages of Algorithms Flowchart (Symbols.
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 6 Using Methods.
Programming Logic and Design Using Methods. 2 Objectives Review how to use a simple method with local variables and constants Create a method that requires.
Programming Logic and Design Seventh Edition
First Steps in Modularization. Simple Program Design, Fourth Edition Chapter 8 2 Objectives In this chapter you will be able to: Introduce modularization.
Chapter 8 First steps in modularisation. Objectives To introduce modularisation as a means of dividing a problem into subtasks To present hierarchy charts.
1 5.4 Modular Design Top-Down Design Structured Programming Advantages of Structured Programming.
FUNCTIONS. Topics Introduction to Functions Defining and Calling a Void Function Designing a Program to Use Functions Local Variables Passing Arguments.
Systems Design.  Application Design  User Interface Design  Database Design.
Functions Part I (Syntax). What is a function? A function is a set of statements which is split off into a separate entity that can be used like a “new.
Programming Logic and Design Fifth Edition, Comprehensive Chapter 7 Using Methods.
Protocol Architectures. Simple Protocol Architecture Not an actual architecture, but a model for how they work Similar to “pseudocode,” used for teaching.
Computational Thinking, Problem-solving and Programming: General Principals IB Computer Science.
What is an Object Objects are key to understanding object-oriented technology. An object can be considered a "thing" that can perform a set of related.
Topics Introduction to Functions Defining and Calling a Void Function
CHAPTER 5 GENERAL OOP CONCEPTS.
Functions and Procedures
Chapter Topics 11.1 Introduction to Menu-Driven Programs
Programming Problem steps must be able to be fully & unambiguously described Problem types; Can be clearly described Cannot be clearly described (e.g.
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
Introduction to Computer Programming
Protocol Architectures
User Defined Functions
Designing Programs.
Functions Overview CSCE 121 J. Michael Moore
Unit 6 Assignment 2 Chris Boardley.
Structure Charts Agenda: What are Structure Charts
Programming Logic and Design Fourth Edition, Comprehensive
Topics Introduction to Functions Defining and Calling a Void Function
Functions and Top-Down Design
Topics Introduction to Functions Defining and Calling a Function
A function is a group of statements that exist within a program for the purpose of performing a specific task. We can use functions to divide and conquer.
Chapter 4: Writing and Designing a Complete Program
Programming Techniques
Presentation transcript:

Modules, Subroutines, Procedures, Functions, or Methods Unit of code that performs one small task Called a subroutine, procedure, function, or method Modularization: breaking a large program into modules

Modules, Subroutines, Procedures, Functions, or Methods Advantages of modularization: Provides abstraction Allows multiple programmers to work simultaneously Allows code reuse Makes identifying structures easier

Modules, Subroutines, Procedures, Functions, or Methods Abstraction: Focusing on important properties while ignoring non-essential details Avoids the low-level details and uses a high-level approach Makes complex tasks look simple

Modularization Allows Multiple Programmers to Work on a Problem Large programming projects can be divided into modules Modules can be written by different programmers Development time is significantly reduced

Modularization Allows You to Reuse Your Work Reusability: the ability to use modules in a variety of applications Reliability: assurance that a module has been tested and proven to function correctly

Modularizing a Program Most programs contain a main module Contains the mainline logic Accesses other modules or subroutines Rules for module names used here: Must be one word Should be meaningful Are followed by a set of parentheses

Modularizing a Program Calling program (or calling module): one that uses another module Flowchart symbol for calling a module: a rectangle with bar across the top Flowchart for the module contains: Module name in the start symbol exit or return in the stop symbol When a module is called, logic transfers to the model When module ends, logic transfers back to the caller

Modularizing a Program

Modules Calling Other Modules