The Linux Command Line Chapter 26

Slides:



Advertisements
Similar presentations
Everyday Algorithms David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. lightning introduction to.
Advertisements

CHAPTER 6 BASIC MANEUVERS.
Lecture Notes 1/21/04 Program Design & Intro to Algorithms.
Chapter 6: Function. Scope of Variable A scope is a region of the program and broadly speaking there are three places, where variables can be declared:
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Introduction to Shell Script Programming
CS-0401 INTERMEDIATE PROGRAMMING USING JAVA Prof. Dr. Paulo Brasko Ferreira Fall 2014.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 3 Simple.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
CPS120: Introduction to Computer Science Decision Making in Programs.
7 1 User-Defined Functions CGI/Perl Programming By Diane Zak.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
First Steps in Modularization. Simple Program Design, Fourth Edition Chapter 8 2 Objectives In this chapter you will be able to: Introduce modularization.
Getting Started in RobotC // Comment task main() motor[] {} wait1Msec() ; = Header Code Compile Download Run Take out your notes.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
1 One Dimensional Arrays Chapter 11 2 "All students to receive arrays!" reports Dr. Austin. Declaring arrays scores :
Introduction to Computing Using Python Namespaces – Local and Global  The Purpose of Functions  Global versus Local Namespaces  The Program Stack 
Introduction to Functions CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Lab 4 Instructions If you have a text book, you can go to drill at pp. 126 for steps 1-6 at the end of chapter 4, Or you can read following slides of the.
Chapter 6 Functions The Tic-Tac-Toe Game. Chapter Content In this chapter you will learn to do the following: 0 Write your own functions 0 Accept values.
to understand recursion you must understand recursion
Creating a Personal Budget
EE330 Final Project Autonomous Car
Magnetism and Electricity
The Linux Command Line Chapter 14
to understand recursion you must understand recursion
The Linux Command Line Chapter 16
The Linux Command Line Chapter 12
Buy book Online -
The Linux Command Line Chapter 2
The Linux Command Line Chapter 29
The Linux Command Line Chapter 1
Starting Out with Programming Logic & Design
Chapter 3 Simple Functions
The Linux Command Line Chapter 10
The Linux Command Line Chapter 7
The Linux Command Line Chapter 18
Chapter 4 void Functions
Functions and Procedures
The Linux Command Line Chapter 27
Getting Started in RobotC
The Linux Command Line Chapter 24
The Linux Command Line Chapter 11
The Linux Command Line Chapter 3
NV Driver Education Curriculum
The Linux Command Line Chapter 28
The Linux Command Line Chapter 9
The Linux Command Line Chapter 17
Namespaces – Local and Global
The Linux Command Line Chapter 4
The Linux Command Line Chapter 25
Python 19 Mr. Husch.
Topics Introduction to Functions Defining and Calling a Function
Starting Out with Programming Logic & Design
The Linux Command Line Chapter 14
Python 19 Mr. Husch.
Chapter 10: Void Functions
ENERGY 211 / CME 211 Lecture 8 October 8, 2008.
Namespaces – Local and Global
Scope Rules.
The Linux Command Line Chapter 5
The Linux Command Line Chapter 3
The Linux Command Line Chapter 4
The Linux Command Line Chapter 12
The Linux Command Line Chapter 11
The Linux Command Line Chapter 24
CHAPTER 1 THE ABC OF PROGRAMMING
The Linux Command Line Chapter 26
The Linux Command Line Chapter 27
Presentation transcript:

The Linux Command Line Chapter 26 Top Down Design Prepared by Dr. Reyes, New York City College of Technology

Top Down Design As programs get larger and more complex, they become more difficult to design, code and maintain. It is often a good idea to break large, complex tasks into a series of small, simple tasks.

Top Down Design Instructions to buy food Get in car. Drive to market. Park car. Enter market. Purchase food. Return to car. Drive home. Enter house. Subtasks for step 3, 8 “Park Car” 1. Find parking space. 2. Drive car into space. 3. Turn off motor. 4. Set parking brake. 5. Exit car. 6. Lock car.

Simpler form (preferred) Shell Functions Shell functions - “mini-scripts” that are located inside other scripts and can act as autonomous programs. Formal form Simpler form (preferred)

Sample Script with Functions

Global vs Local Variables Global variables – variables that maintain their existence throughout the program and can be accessed anytime by any function. Local variables – variables defined inside shell functions and are only accessible within the shell function in which they are defined and cease to exist once the shell function terminates. Use keyword local in front of the variable After that, in a separate line assign a value to the variable

Example Using Local Variables