THE PROCESS OF WRITING SOFTWARE Python: System Engineering 1.

Slides:



Advertisements
Similar presentations
Senem Kumova Metin Introduction to Programming CS 115 Introduction to Computing PART I : Computer Basics PART II: Introduction to Computing/Programming.
Advertisements

ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
CSI 3125, Preliminaries, page 1 Programming languages and the process of programming –Programming means more than coding. –Why study programming languages?
Python Programming: An Introduction to Computer Science
Lecture 1: Intro to Computers Yoni Fridman 6/28/01 6/28/01.
Introduction to Computers and Programming. Some definitions Algorithm: –A procedure for solving a problem –A sequence of discrete steps that defines such.
COMP 14 Introduction to Programming
Chapter 16 Programming and Languages: Telling the Computer What to Do.
1 Programming & Programming Languages Overview l Machine operations and machine language. l Example of machine language. l Different types of processor.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
Computers & Logic An Overview. Hardware Hardware is the equipment, or the devices, associated with a computer. For a computer to be useful, however, it.
Introduction to Computers and Python. What is a Computer? Computer- a device capable of performing computations and making logical decisions at speeds.
1 Chapter-01 Introduction to Computers and C++ Programming.
Introduction to High-Level Language Programming
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
An Introduction Chapter Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram.
CS 0004 –Lecture 1 Wednesday, Jan 5 th, 2011 Roxana Gheorghiu.
Topics Introduction Hardware and Software How Computers Store Data
High-level Languages.
High level & Low level language High level programming languages are more structured, are closer to spoken language and are more intuitive than low level.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Introduction CS 104: Applied C++ What is Programming? For some given problem: __________ a solution for it -- identify, organize & store the problem's.
Tranlators. Machine Language The lowest-level programming languageprogramming language Machine languages are the only languages understood by computers.languagescomputers.
Python Programming, 2/e1 Python Programming: An Introduction to Computer Science Chapter 1 Computers and Programs.
CISC105 General Computer Science Class 1 – 6/5/2006.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 1 Introduction to Computers and Programming.
What is a Computer? An, electrical machine, that can be programmed to accept data (input), process it into useful information (output) and store it away.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
1 CPSC 185 Introduction to Computing The course home page
2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.
Mrs. Ulshafer August, 2013 Java Programming Chapter 1.
COMPUTER PROGRAMMING. Computer programming the objective of the module to gain the necessary skills to develop a computer program using one of the high.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
1 TOPIC 1 INTRODUCTION TO COMPUTER SCIENCE AND PROGRAMMING Topic 1 Introduction to Computer Science and Programming Notes adapted from Introduction to.
Introduction 1 (Read Chap. 1) What is Programming? For some given problem: design a solution for it -- identify, organize & store the problem's data --
Programming in C++ Dale/Weems/Headington Chapter 1 Overview of Programming and Problem Solving.
Chapter 1 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
Lecture 2 Programming life cycle. computer piano analogy Piano + player - computer hardware Musical score/notes - software or program Composer - programmer.
Chapter 1 09/04/13. Change Your Password  The command is: passwd In the lab first do : ssh -Y onyx  You will have to see me to change it, if you forget.
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Installing Java on a Home machine For Windows Users: Download/Install: Go to downloads html.
Ch 1 - Introduction to Computers and Programming Hardware Terminology Main Memory Auxiliary Memory Drives Writing Algorithms Using Pseudocode Programming.
CS 177 Recitation Week 1 – Intro to Java. Questions?
The Big Picture. My Story  Wrote great programs  Didn’t understand how they worked.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
1 Chapter 1 Background Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Software Engineering Algorithms, Compilers, & Lifecycle.
Programming Languages Salihu Ibrahim Dasuki (PhD) CSC102 INTRODUCTION TO COMPUTER SCIENCE.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Computer Basics.
Software Development Environment
Installing Java on a Home machine
Operating System Interface between a user and the computer hardware
Sections Basic Concepts of Programming
CSCI-235 Micro-Computer Applications
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Introduction CSE 1310 – Introduction to Computers and Programming
Installing Java on a Home machine
Computers: Hardware and Software
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Topics Introduction Hardware and Software How Computers Store Data
Chapter 1: Preliminaries
Presentation transcript:

THE PROCESS OF WRITING SOFTWARE Python: System Engineering 1

Computing Systems A computing system is composed of  hardware: the physical components of the system  software: the instructions that control the hardware Hardware components include:  Motherboard  Central processing unit (CPU)  Memory (RAM / Drives)  IO Devices  Video Card  Sound Card  Network Card 2

Hardware: CPU Central Processing Unit  An electronic chip that performs instructions  The “brains” of a computing system  A CPU can only perform very simple tasks:  Can add/subtract/multiply/divide two numbers  Can compare two numbers to see if one is smaller/larger  Can copy/move data from one place to another  CPU’s appear more powerful than this since these tasks are done very quickly 3

Software and Programming Tell the CPU to add two numbers  Load the number from memory location 2001 into CPU register R1  Load the number from memory location 2002 into CPU register R2  Add the numbers in registers R1 and R2  Copy the result into memory location 2003 Programming in such a low-level fashion would not be good. Would like to write something like  c = a + b Programming languages make it easier for a programmer to talk to the CPU 4

Overview of Computation Natural-language : a language used by people  If it is written, it is defined by a system of symbols and notations that communicate the content of the language  Examples: English, Spanish, French, Arabic, Tamil, etc… Programming language : a language used by computers  A system of symbols and notations that communicate computational content to the CPU. 5

Low/High level languages Low-level language  Any language that is “close” to machine instructions  Not meant for human readability  Specific to the CPU High-level language  Any language that is closer to “natural” language  Easier to read and understand  Portable 6

Languages Object code, bytecode Assembly Fortran, C Algol, Pascal, Ada Python, Java, Ruby microcode High Level Low Level Natural Language English, Chinese, Japanese, …

Machine Language Example (Pentium III Linux Box) … Low Level Example Can you understand this code? 8

Assembly Example (Pentium III Linux Box).file “hello.c”.version “01.01”.section.rodata.LCO:.string“Hello World\n”.text.align 4.globl main: pushl %ebp movl %esp,%ebp pushl $.LCO call printf addl $4,%esp xorl %eax,%eax jmp.L1.p2align 4,,7.L1: leave ret Intermediate Level Example Can you understand this code? 9

C Language Example (machine independent) #include void main() { printf(“Hello World\n”); } High Level Example Can you understand this code? 10

Python Example print "Hello World" High Level Example Can you understand this code? 11

Compiled vs. Interpreted 12 Compiler Source Program Executable Code (THE CPU) Executable Code (THE CPU) Input Output Interpreter Source Program Output Input CPU Compilation: The language is brought down to the level of the machine using a translator. The translator is often called a compiler. Interpretation: The machine is brought up to the level of the language by the use of a virtual machine. This machine is often known as an interpreter.

Waterfall model The waterfall model involves the following processes  Analysis: Figure out exactly what the problem is. Understand as much of the problem as possible  Requirements: Describe exactly what your program will do (not necessarily how).  Design: Describe the variables, functions and classes of the solution. Describe the algorithms that will be used in your software.  Implement: Translate the design into a programming language and enter it into the computer. This course will use Python.  Test/Debug: Execute your implementation and devise tests that are designed to expose errors (bugs).  Maintenance: Continue to improve/develop/fix the program in response to user needs. 13

Waterfall 14

Example: Temperature Conversion Narrative: Susan is spending a year of study in China to learn advanced computer science programming.  She speaks Chinese fluently and listens to the radio every morning to figure out what the temperature will be so that she can dress appropriately.  The temperatures are reported in units of Celsius but she thinks only in terms of Fahrenheit. The analysis is pretty easy in this case:  She wants to write a program to convert Celsius to Fahrenheit for her. 15

Example: Temperature Conversion Requirements  The program will allow her to type in a number that represents the temperature in degrees Celsius.  The program will then print out the corresponding temperature in degrees Fahrenheit.  The relationship between input and output must be well defined.  F = 9/5 * C + 32  F is degrees in Fahrenheit (the output)  C is degrees Celsius (the input) 16

Example: Temperature Conversion Design  This is usually written in fake code (psuedo-code)  This is not a programming language  Describes the essentials without worrying about detail  For example: Input the temperature in degrees C (call it celsius) Calculate Fahrenheit as (9/5)*celsuis + 32 Output Fahrenheit Input the temperature in degrees C (call it celsius) Calculate Fahrenheit as (9/5)*celsuis + 32 Output Fahrenheit 17

Example: Temperature Conversion Implementation  Must take the design and translate it into a program. # convert.py # A program to convert Celsius temps to Fahrenheit # by: Susan Computewell def main(): celsius = eval(input(“What is the Celsius temperature? ”)) fahrenheit = 9 / 5 * celsius + 32 print(“The temperature is”, fahrenheit, “degrees Fahrenheit) main() # convert.py # A program to convert Celsius temps to Fahrenheit # by: Susan Computewell def main(): celsius = eval(input(“What is the Celsius temperature? ”)) fahrenheit = 9 / 5 * celsius + 32 print(“The temperature is”, fahrenheit, “degrees Fahrenheit) main() 18

Example: Temperature Conversion Testing  How would you test this program? # convert.py # A program to convert Celsius temps to Fahrenheit # by: Susan Computewell def main(): celsius = eval(input(“What is the Celsius temperature? ”)) fahrenheit = 9 / 5 * celsius + 32 print(“The temperature is”, fahrenheit, “degrees Fahrenheit) main() # convert.py # A program to convert Celsius temps to Fahrenheit # by: Susan Computewell def main(): celsius = eval(input(“What is the Celsius temperature? ”)) fahrenheit = 9 / 5 * celsius + 32 print(“The temperature is”, fahrenheit, “degrees Fahrenheit) main() 19