Download presentation
Presentation is loading. Please wait.
1
CSCI-235 Micro-Computer Applications
Programming: Part I
2
Programming Program – a set of detailed, step-by-step instructions that directs the computer to do what you want it to do Programming language – a set of rules that provides a way of telling the computer what operations to perform © Prentice-Hall, Inc
3
The Programming Process
Five main steps Defining the problem Planning the solution Coding the program Testing the program Documenting the program © Prentice-Hall, Inc
4
Defining the Problem Develop a written agreement that specifies:
The input data The desired output Sometimes, the programmer receives a written specification from the systems analyst Other times, the programmer meets with users directly © Prentice-Hall, Inc
5
Planning the Solution Algorithm – a detailed, step-by-step solution to the problem Several tools help plan the algorithm © Prentice-Hall, Inc
6
Planning Tools Flowchart – a pictorial representation of the algorithm
Pseudocode – English-like language Specifies algorithm with more precision than you can in English, but less than a programming language © Prentice-Hall, Inc
7
Coding the Program Translating the algorithm from the planning stage into a formal programming language All languages have syntax rules Similar to grammatical rules The computer will reject a program with even a minor syntax error Programs can be keyed into the computer by using a text editor © Prentice-Hall, Inc
8
Programming Languages
Assembly Language Machine Language Fortran Pascal COBOL BASIC Ada Visual Basic C and C++ Java Smalltalk © Prentice-Hall, Inc
9
Testing the Program Two phases of testing the program Translation
Converting the program you wrote into the binary instructions the CPU understands Debugging Identifying and correcting logic errors in the program © Prentice-Hall, Inc
10
Translation Compiler translates the program (source module) into a machine language version (object module) If the compiler detects syntax errors, it will produce messages describing those errors If no syntax errors exist, the object module will be linked to create a load module Load module is executed by the computer EXAMPLE © Prentice-Hall, Inc
11
Documenting the Program
Materials are generated at each part of the process Common examples of documentation Flowchart and/or pseudocode Comments within the source code Testing procedures Layouts of input and output records A narrative description of the program © Prentice-Hall, Inc
12
Levels of Languages Lower-level languages – more like the 0s and 1s the computer itself uses Higher-level languages – more like the languages people use © Prentice-Hall, Inc
13
Machine Language Programs and memory locations are written in strings of 0s and 1s Problems with machine languages Programs are difficult to write and debug Each computer has its own machine language Only option available to early programmers © Prentice-Hall, Inc
14
Machine Language Machine language:
Consists of binary numbers (0s and 1s) Is the earliest programming language Is the only language the computer understands without translation Is machine dependent Each family of processors has its own machine language © Prentice-Hall, Inc
15
Assembly Languages Substitute mnemonic codes for 0s and 1s
For example, A for add, C for compare, etc. Use names rather than binary addresses for memory locations Require an assembler to translate the program into machine language Still used for programming chips and writing utility programs © Prentice-Hall, Inc
16
Assembly Languages Assembly language: Resembles machine language
Is a low-level language Uses brief abbreviations for program instructions Abbreviations are called mnemonics A program is written in source code (text file) and translated into machine language by an assembler © Prentice-Hall, Inc
17
High-Level Languages Transformed programming
Programmers could focus on solving problems rather than manipulating hardware Programs could be written and debugged much more quickly Requires a compiler to convert the statements into machine language Each computer has its own version of a compiler for each language © Prentice-Hall, Inc
18
High-level Languages High-Level languages:
Create programs at a high level of abstraction Are easier to read, write, and maintain than machine and assembly languages Use a compiler or interpreter to translate code © Prentice-Hall, Inc
19
Compilers and Interpreters
A compiler is a program that changes source code to object code An interpreter translates source code one line at a time and executes the instruction © Prentice-Hall, Inc
20
Major Programming Languages
FORTRAN COBOL BASIC Visual Basic C Java © Prentice-Hall, Inc
21
FORTRAN The first high-level language Stands for FORmula TRANslator
Used primarily for engineering, mathematical, and scientific tasks © Prentice-Hall, Inc
22
COBOL Stands for COmmon Business-Oriented Language
Used primarily for business requirements Processes large data files Produces well-formatted reports © Prentice-Hall, Inc
23
BASIC Stands for Beginners’ All-Purpose Symbolic Instruction Code
Developed to teach programming to college students Became very popular with the introduction of the microcomputer © Prentice-Hall, Inc
24
C Originally designed to write systems software
Offers the ease of use of a high-level language with the efficiency of an assembly language Very portable – can be used with virtually every combination of computer and operating system © Prentice-Hall, Inc
25
Java A network-friendly programming language that permits a piece of software to run directly on many different platforms Allows programmers to write one version of the program, rather than a separate version of each platform Very useful for Internet development Java applets can run in the user’s Web browser © Prentice-Hall, Inc
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.