Software - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

Software

Description:

Software – PowerPoint PPT presentation

Number of Views:33
Avg rating:3.0/5.0
Slides: 24
Provided by: Kenny77
Category:
Tags: oxen | software

less

Transcript and Presenter's Notes

Title: Software


1
Software
2
Computer Software
  • Computer software is an encoding of data and
    instructions where the instructions are to be
    executed by the CPU. Software is synonymous with
    computer program.
  • Recall that
  • A CPU is a physical device
  • A CPU can only do simple things like
  • add/subtract/multiply/divide two numbers
  • compare two numbers
  • copy data from one storage location to another

3
Computer Software
  • A computer program must use only instructions
    that the CPU understands
  • It would be good to program a computer by saying
    something like
  • look at a folder containing all of my MP3 files,
    sort them by their song titles and print a
    tabular report to my color printer.
  • A computer program, however, must look like this
  • place the value 18 into storage location 530
  • place the value 12 into storage location 531
  • add the value stored in location 530 to the value
    stored in location 531 placing the result in
    storage location 612
  • etc

4
Computer Software Language
  • A programming language is a way of representing
    commands.
  • A set of CPU instructions can be rendered in
    different programming languages just as a
    textbook can be rendered in English, Japanese,
    and Spanish.
  • Modern programming languages
  • allow a programmer to say more than the CPU
    understands by translating these instructions
    into the simple language of the CPU

5
Software Languages
High Level close to English
LISP, C, Java, Python
FORTAN, C, PASCAL
ASSEMBLY
Low Level close to the CPUs native
language add/sub/mul/divide/compare
MICROCODE
6
Software Low Level Language
  • Machine Language (Pentium III Linux Box)

01111111 01000101 01001100 01000110 00000001
00000001 00000000 00000000
7
Software Intermediate Level Language
  • Assembly (Pentium III Linux Box)

.file hello.c .version 01.01 .section .rodata
.LCO .string Hello World\n .text .align
4 .globl main .type main,_at_function main pushl
ebp movl esp,ebp pushl .LCO call
printf addl 4,esp xorl eax,eax jmp
.L1 .p2 align 4,,7 .L1 leave ret
8
Software Intermediate Level Language
  • C

include ltstdio.hgt void main() printf(Hello
World\n)
9
Software High Level Language
  • Python

print Hello World
Each of these programs mean the same thing. They
are just written in different languages!
10
Software Languages and Compilation
Compiler
  • Programmers write at a high level
  • The CPU cant understand the high level and so
    a translator converts into low level
  • The translator is itself a program called a
    compiler.

11
Software Compilation and the JVM
  • In Java, there is a virtual CPU known as the JVM
  • Java Virtual Machine
  • The JVM is a program that, when run on a real
    CPU, makes the real CPU act like the Java CPU.
  • A Java compiler converts a java program into
    bytecode (the JVMs microcode)

12
Software Compilation and the JVM
Java Program
bytecode
JVM
JVM
JVM
Intel Pentium (Windows)
PPC (Mac)
MIPS 32 (Unix)
13
Important ConceptsSyntax and Semantics
  • A programming language
  • is a language!
  • All written languages (whether programming or
    natural)
  • Have rules about syntax
  • The way the language looks. More specifically,
    what symbols are in the language and how those
    symbols must be arranged.
  • Have rules about semantics
  • What the symbols mean

14
Syntax and Semantics Example
15
Syntax and Semantics Example
Syntax also defines how words can be arranged
to form sentences
16
Syntax and Semantics Example
Umbrella
  • Semantics gives meaning to symbols.
  • A device for protection from the weather
    consisting of a collapsible, usually circular
    canopy mounted on a central rod. (From Yahoos
    online dictionary)
  • Given the first statement below identify whether
    the following statements contain changes in
    SYNTAX or SEMANTICS or BOTH.

The college student ate three large pizzas.
The high-school student made five large pizzas.
The coLLage stoodaent, 8te three larj pissas
17
Syntax and Semantics Programming
  • Consider Java
  • A programming language
  • Java has a set of syntax rules
  • Java has a set of semantic rules
  • Syntax Rule Example
  • Integer numbers are 1 or more consecutive digits
    optionally preceded by a or - symbol (must
    not have space(s) between them).

918
-3
54.21
00005
3 5
18
Syntax and Semantics Programming
  • Syntax Rule Example
  • The symbol lt and the symbol gt can only appear
    immediately between two integer numbers. Spaces
    may separate the numbers from these two symbols.

9lt8
gt 35
3 gt1
0 lt
10gtgt5
  • Semantic Rule Example
  • If a lt appears between two numbers, it means
    the following
  • TRUE if the left number is less than the right
    number
  • FALSE if the left number is not less than the
    right number

9lt8
0lt 35
3 lt11
-3 lt2
10lt5
19
Programming the Big Idea
  • A programmer must
  • know the syntax of their programming language
  • know the semantics of their programming language
  • follow these rules to construct software that
    solves specific problems.

Example Problem Write software that computes
shipping cost for Amazon.com. Amazon is running
a special where they give free shipping for any
transaction totaling 25 or more. All other
transactions are charged a flat fee of 7.00 for
shipping.
if(totalPurchaseAmount lt 25) shippingCost
7.0 else shippingCost 0.0
20
Software
  • Software is a sequential set of instructions for
    the CPU
  • What qualities does good software have?
  • unambiguous- cant mean more than one thing
  • readable a human can look at it and understand
    it
  • correct doing exactly what it should do all the
    time

21
Software Engineering
  • Software engineering manages the process of
    writing software
  • Java is an Object-Oriented language (more on this
    later)
  • Three general phases in the process of software
    development
  • Analysis learn what the software should do.
    Write the requirements document.
  • Design decide how to structure the software
    (classes / objects / variables / methods). Write
    the design document.
  • Implementation Write the software using some
    language. We will use Java.

22
Software Engineering
  • These phases can be completed in various ways.
    The simplest is the waterfall cycle. Each
    phase is completed prior to the next.

Analysis
23
Software We focus on implementation
Software Tool
Deliverable
Action
Text editor (NotePad)
Programmer types the software into the computer.
The software is translated into a form that is
understood by the computer.
The program executes.
23
Write a Comment
User Comments (0)
About PowerShow.com