Chapter1: Intro to Software Development
COSC 1010 Intro to Software Development
Course Information
Instructor: Dr. Md. Tahmidul Islam Molla
Department: Computer Science
University: Marquette University
Copyright: Pearson Education, Inc., 2021, 2018, 2015. All Rights Reserved.
Chapter 1: Introduction to Computers and Programming
Topics Covered
Introduction to Computers and Programming
Hardware and Software
How Computers Store Data
How a Program Works
Using Python
Introduction
Definition of Computers:
Computers can be programmed to perform any job as dictated by a program.
Definition of Program:
A program is defined as a set of instructions that a computer follows to complete a task; commonly known as software.
Role of a Programmer:
A programmer is an individual who can design, create, and test computer programs; also referred to as a software developer.
How a Program Works
CPU and Machine Language:
A computer's CPU (Central Processing Unit) can only understand instructions in machine language, which makes it challenging for humans to write entire programs directly in that form.
CPU as the Computer's Brain:
While commonly referred to as the brain of the computer, the CPU is an electronic device designed to perform specific functions and is not inherently intelligent.
Operations Performed by the CPU:
Reading data from main memory
Performing arithmetic operations:
Addition
Subtraction
Multiplication
Division
Moving data between memory locations
Comparing values (e.g., equality checks)
Instruction Role in Computation:
The CPU requires a set of instructions (a program) to perform operations.
Hardware and Software
Definition of Hardware:
Hardware refers to the physical devices that constitute a computer.
Components of a Computer System:
Central Processing Unit (CPU)
Main Memory (RAM): Temporary storage for data and programs during processing.
Secondary Storage Devices: Devices where data is held long-term.
Input and Output Devices: Components that allow user interaction and display results, respectively.
The CPU
Role of the CPU:
The CPU is the essential component that runs programs; without it, no software can function.
Microprocessors:
Modern CPUs, known as microprocessors, are integrated onto small chips, making them compact compared to earlier models.
Historical Context:
ENIAC: Considered the world’s first programmable electronic computer, built in 1945.
It measured 8 feet tall, 100 feet long, and weighed 30 tons, primarily consisting of a large CPU.
Main Memory
Definition of Main Memory:
Main memory is where a computer stores the active program and the data that the program is manipulating during execution.
Terminology:
Often referred to as Random Access Memory (RAM).
Characteristics of RAM:
Quick access for the CPU
Volatile (data erased when power is off)
Secondary Storage Devices
Definition and Function:
Secondary storage retains data for prolonged periods and supplies it to main memory as needed.
Types of Secondary Storage:
Disk Drives: Use magnetic encoding to store data on circular disks.
Solid State Drives (SSD): Faster than disk drives with no moving parts, using solid-state memory.
Flash Memory: Portable storage that does not utilize a physical disk.
Input and Output Devices
Input Devices:
Collect data from users or other devices.
Examples: keyboard, mouse, touchscreen, scanner, camera.
Disk drives function as input devices by loading programs into RAM.
Output Devices:
Present data processed by the computer to users or devices.
Examples: video displays, printers.
Disk drives and USB drives may also function as output devices when saving data.
Software Overview
Role of Software:
All computer operations are controlled by software, which is divided into two primary categories.
Types of Software:
Application Software:
Software designed for performing everyday tasks such as word processing, email, gaming, and web browsing.
System Software:
Software that manages basic operations of the computer.
Includes operating systems (control of hardware operations), utility programs (perform specific tasks), and software development tools (for creating and testing programs).
How Computers Store Data
Binary Numbering System:
Fundamental to how electronic machines represent information with clear, unambiguous data storage.
Base-10 and Base-2:
Humans typically use base-10 (decimal system).
Computers utilize base-2 (binary system), which represents data in sequences of 0s and 1s.
Binary Numbering Specifics
Representation of Data:
Binary principles are characterized as On/Off, Yes/No, True/False, and Positive/Negative, essential for computational reliability.
Contents are interpreted by computers to display information in human-readable form.
Positional System Comparisons:
Base-Ten Example:
The decimal number 1,943 can be expressed as:
(1 imes 10^3) + (9 imes 10^2) + (4 imes 10^1) + (3 imes 10^0)Base-Two Example:
The binary number 1101 can be expressed as:
(1 imes 2^3) + (1 imes 2^2) + (0 imes 2^1) + (1 imes 2^0) = 13
Storing Data Formats
Byte Representation:
A byte stores memory equivalent to a letter or small number, consisting of eight bits.
Bit Definition:
A bit is an electrical component that can hold a positive or negative charge – essentially functioning as an on/off switch.
Character Encoding:
Data characters converted to numeric codes, primarily through ASCII, which encodes a total of 256 characters via 8-bit numbers.
Example representations:
+5 = 0101, -5 = 1101using sign/magnitude notation.
Unicode Standard:
An extensive encoding scheme capable of representing characters from various languages, using a minimum 16-bit system, accommodating 65,536 unique characters.
Advanced Number Storage Techniques
Negative Numbers Encoding:
Negative integers are represented using two's complement notation.
Real Numbers Encoding:
Real numbers use floating-point notation for storage.
Other Types of Data Representation
Digital Data:
Digital devices store information as binary numbers.
Images are composed of pixels, and each pixel's color is encoded as a binary number.
Audio is represented in sections called samples, also encoded in binary.
Comparisons of Data Storage Requirements
Text vs. Audio vs. Images:
A typical 300-page novel may contain approximately 4 million bits (based on an estimate of 100,000 words x 5 chars/word x 8 bits/char).
Comparatively, 1 minute of audio encoded in MP3 format:
(44,100 ext{ samples/sec} imes 16 ext{ bits/sample} imes 60 ext{ sec/minute}) = 42 ext{ million bits}
Storage for a single photograph may be:
(5,000,000 ext{ pixels/photograph} imes 24 ext{ bits/pixel}) = 120 ext{ million bits}
Hexadecimal Notation
Function and Usage:
Hexadecimal notation is shorthand for handling long bit patterns, grouping them into four bits for brevity.
Example conversion:
The binary pattern 10110101 becomes 0xB5 in hexadecimal.
Program Execution Overview
Program Flow:
The CPU executes programs by fetching instructions from memory, decoding them, and executing relevant operations through a cycle.
Fetch-Decode-Execute Cycle:
Fetch: Retrieves the next instruction from memory.
Decode: Interprets the instruction to determine the required operation.
Execute: Carries out the specified operation.
Machine Language to Assembly Language
Assembly Language Definition:
Assembly language provides mnemonics for instructions, simplifying programming compared to binary.
Example syntax:
MOV eax, 3MOV ebx, 4ADD eax, ebx
Assembler's Role:
An assembler converts assembly language into machine language for CPU execution.
High-Level Programming Languages
Definition:
High-level programming languages allow for simpler and more powerful program creation, requiring minimal knowledge of CPU workings.
Example: Python programming language exemplifies high-level language characteristics.
Compilers and Interpreters
Compiler Function:
A compiler translates high-level language programs into machine code, allowing for execution at any time.
Interpreter Function:
An interpreter performs real-time translation of high-level instructions, executing one at a time without generating separate machine code.
Python employs an interpreter for this purpose.
Programming Basics in Python
Installation and Configuration Required:
Python must be properly installed, including the Python interpreter.
Modes of Operation:
Interactive Mode: Users can enter statements directly via command-line input.
Script Mode: Users save statements in a file with a
.pyextension, running it from the operating system command line usingpython filename.
The IDLE Programming Environment
IDLE Definition:
Integrated Development Environment (IDLE): An essential tool for writing, executing, and testing Python programs, automatically installed with Python.
Interactive Features:
Built-in text editor designed to assist in Python programming.
Summary of Chapter 1
Main hardware components of computers
Types of software
Methods for data storage
Basic operations of the CPU and machine language
The fetch-decode-execute cycle
Translation of complex languages to machine code
Installation procedures for Python and interpreter modes.
Practice Problems
A(n) _ is a set of instructions that a computer follows to perform a task.
a. compiler
b. program
c. interpreter
d. programming language
The physical devices that a computer is made of are referred to as _.
a. hardware
b. software
c. the operating system
d. tools
The part of a computer that runs programs is called _.
a. RAM
b. secondary storage
c. main memory
d. the CPU
The computer stores a program while the program is running, as well as the data that the program is working with, in _.
a. secondary storage
b. the CPU
c. main memory
d. the microprocessor
A byte is made up of eight _.
a. CPUs
b. instructions
c. variables
d. bits