48
Software Development Basic Computer Concepts Program Planning and Development Defining the Problem Designing a solution Writing the Program

* Property of STI Page 1 of 48

  • Upload
    minor

  • View
    36

  • Download
    0

Embed Size (px)

DESCRIPTION

Basic Computer Concepts Program Planning and Development Defining the Problem Designing a solution Writing the Program. Software Development. * Property of STI Page 1 of 48. Basic Computer Concepts Program Planning and Development. Compiling, debugging and testing the programs - PowerPoint PPT Presentation

Citation preview

Page 1: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Program Planning andDevelopment

Defining the Problem

Designing a solution

Writing the Program

Page 2: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Program Planning andDevelopment

Ø

Ø

Compiling, debugging and testing the programs

Documenting the Program

Page 3: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Program Planning andDevelopment

ØDefining the Problemv

vrecognizing the need for informationdefining what outputs are required of theprogram

ØDesigning a Solutionvbreaking the problem into discrete steps

known as “algorithm”

Flowcharting - a graphical representation of thesequence of operations a computer is to perform

Page 4: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Designing a Solution

Ø

Ø

Ø

Ø

Ø

Ø

Ø

Ø

Terminal

General input/output operation

Process

Comparison

Connector

Predefined process

Document

Manual Input

Page 5: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Designing a Solution

Payroll Flowchart

Page 6: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Designing a Solution

Ø

Ø

Pseudocode - is a version of the instructionsdescribing each step the computer must follow

Payroll PseudocodeStartRead employee's hours worked and

hourly wageDo until end of items

Multiply hours worked by hourlywage to get gross payIf gross pay is greater than 70KThen tax rate is 20%

Else tax rate is 15%Multiply tax rate by gross payto give taxSubtract tax and union dues fromgross to get net payPrint checkRead next employee's hoursworked and hourly wage

End loop (no more data)Print reports

Page 7: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Writing the Program

Ø

Ø

write the program in a specific programminglanguagetypes of programming statements

vvv

vvv

commentsdeclarationsinput/output statementscomputationstransfer of controlComparison

Øthe programmer should try to incorporate thefollowing qualities into any program:

v

vvv

v

easy to read and understandefficientreliablerobustmaintainable

Page 8: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Compiling, Debugging,and Testing the Program

Ø

Ø

a compiler is a special program for eachprogramming language that is loaded into thecomputer when the language is usedcompilation errors are discovered by thecompiler and include:

vv

vvv

vv

spelling errorssyntax errorsimproperly sequenced statementsimproperly labeled statementsconflict in variable namesillegal names or statementsmissing punctuations

Page 9: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Compiling, Debugging,and Testing the Program

Ø

Ø

logical errors have to be detected by theprogrammer in a process called debugging

to be sure that the program will give thecorrect output, the program has to be testedby running the program and inputting datawith known outputs

Page 10: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Documentation of theProgram

Ø

Ø

Ø

documentation consists of written descriptionsand explanations of programs and othermaterials associated with an organization’sdata processing systemproper program documentation serves as aguide for programmers and analysts who mustmodify or update existing programs and systemproceduresthe process of documentation is an on-goingone

v

v

v

a complete description of the contents andformats of all data inputs, outputs and filesto be useda statement of the hardware requirementsfor running the program as well asestimated processing time and storagerequirementsa statement of software requirements suchas utility programs and library programs

Page 11: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Structured Design

Ø

Ø

Ø

programs must be structured, that is, eachmajor step in the program must be developedas independent module and represented in theflowchart as a separate blockprogram codes will be easier to understand andmore maintainable if you break the logic intosteps, and encompass each step in its ownsubroutine or functionusing structured design leads to the followingbenefits:

v

vvv

early detection design flawsprograms that can be easily modifiedclear and complete documentationmodular design to improve testing

Page 12: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Structured Design

Top-down vs. Bottom-upØ

Ø

Top-down structured design is done by firstrecognizing the major components of thesolution, expressing the solution as a sequenceof these major components and thenexpanding the major components themselvessimilarly.Bottom-up design starts by identifying smallfunctions and subroutines present in the designand moving up towards more complexprocedures.

Page 13: * Property of STI Page 1 of 48

Basic Computer Concepts

Structured Design

Using FlowchartØ

Ø

generally involves a top-down analysis of theproblembased on the assumption that there are four(4) basic logic patterns namely:

Simple Sequence

Software Development

Selection

Page 14: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Structured Design

Ø

Ø

Loop

Branch

Page 15: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Structured Design

Ø

Ø

Do-while

Case

Page 16: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Programming ParadigmØ Paradigm

v

van “example, model or pattern”an idealized pattern of usage under whichsome agent can operate

ØProgramming Paradigmva way of thinking about problems and theirsolutions, or an approach on how to use acomputer to implement those solutions

ØFor a programmer to solve a particularproblem, he needs to know several things,namely:

v

v

v

must have a clear picture of what theproblem is supposed to domust have an understanding of how theprogram should work to produce thedesired resultmust understand how the program fits inits environment

ØMajor Programming Paradigmsvvv

v

ImperativeLogicalFunctionalObject-Oriented

Page 17: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Imperative Paradigm

Ø

Ø

Ø

Ø

characterized by programming with states andcommands that modify the states

Imperative means a command or order, whilea command or a procedure means a particularcourse of action.

implies procedures (or programs) or directionsfor performing an actionan abstraction of real computers, which arebased on the Von Neumann machineassumes that a computer can maintain throughenvironment variables any change in thecomputation process

Page 18: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Imperative Paradigm

ØPopular programming languages are more oftenimperative mainly because of two reasons:

v

v

it closely resembles the actual computeror machine itself, so the programmer ismuch closer to the machineit is the only one efficient enough forwidespread use

Ø Advantage:vcan be easily translated to an efficientmachine code, so they are consideredhighly efficient

ØDisadvantage:vsome problems are hard to model usingthis paradigm

Page 19: * Property of STI Page 1 of 48

Basic Computer Concepts

Imperative Paradigm

Ø

Ø

When it is combined with subprograms it iscalled procedural programming also calledstructured programmingAn example of an imperative program that willcompute the factorial of a given number is:

Function factorial(n){ var x = 1;

while(n>0) {x = x*n;

}n = n-1;return x;

}

Software Development

Page 20: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Logical Paradigm

Ø

Ø

takes a declarative approach to problem-solvingcan be divided into three (3) steps:

1.

2.

3.

a series of definitions/declarations thatdefine the problem domainstatements of relevant factsstatements of goals in the form of queries

Ø Advantages:v

v

the system solves the problem; soprogramming steps are kept to a minimumsince it is largely based on mathematicallogic, proving the validity of a givenprogram becomes simple

Page 21: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Logical Paradigm

ØAn example to illustrate the logical paradigm:

Page 22: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Functional Paradigm

Ø

Ø

Ø

Øv

v

v

provide a high level of abstraction; theprogramming becomes modular andremoves the possibility of creating manyerrorsnot heavily dependent on the assignmentoperation, so the programs can beevaluated with many different ordersmuch more amenable to mathematicalproof and analysis than imperative ones

based on functional expressions and theevaluation of these expressionviews all programs as functions in amathematical senseto illustrate, the functional program expressedin functional paradigm:

Factorial n =If n = 1 then 1Else

n * Factorial(n-1);

Advantages:

Page 23: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Functional Paradigm

ØDisadvantages:v

v

hard to implement efficiently, because it ishard to determine if data storage can bere-usablefor problems involving many variables or alot of sequential activity, it is sometimeseasier to handle them imperatively or withobject-oriented programming paradigms

Function for computing the averageof two numbers:

(defun avg(X Y) (/ (+ X Y) 2.0))

Function is called by:> (avg 10.0 20.0)

Function returns:15.0

Page 24: * Property of STI Page 1 of 48

Basic Computer Concepts

Object-OrientedParadigm

Ø

Ø

a paradigm in which real world objects areviewed as separate entities having their ownstate and exhibit their own behaviorfocuses on the objects that the programmer isrepresenting

Illustrates objects and how they areencapsulated into modules

Object interface

DATAMethods

Software Development

Page 25: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Object-OrientedParadigm

Ø Object-orientedprogramming approach ingeneral can be divided into four (4) steps:

v

v

vv

Identify the problemIdentify the objects needed for thesolutionIdentify messages to be sent to the objectsCreate a sequence of messages to theobjects that solve the problem

ØTo illustrate the four (4) steps:1. Problem Identification: Compute the sum

of two numbers and printout the result2. Object Identification: Identify objects

needed to solve the problem• Num1 - first number (object)• Num2 - second number (object)• Sum - result of the addition of the twonumbers

Page 26: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Object-OrientedParadigmTo illustrate the four (4) steps (cont.):3. Message Identification: Messages needed to

send to objectsv

v

+ aNum - this is the message sent to thereceiver object with parameter aNum. Theresult of this message is the value (anumeric objects) of the total sum of thereceiver object and aNumprint - a message that displays the value ofthe receiver object

4. Objects-Message Sequences:(Num1 + Num2) print

vThe message + with parameter Num2 issent to objects Num1. The result is anobject (Num1 + Num2), which is sent themessage print.

Page 27: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Other ProgrammingParadigms

1.

2.

3.

4.

Tree - this is viewing code or data in a highlyhierarchical mannerExpert System - this organizes data by using alist or pool of rules that are sometimesconstantly recycled throughStream - is based on the idea that input andoutput of smaller programs or utilities can belinked togetherNeural Network - based on the concepts thatcomputers are programmed in the same way ashow humans think

Page 28: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Programming Language

Ø

Ø

Ø

Ø

Ø

Language is defined as a system forcommunicating.Written language use symbols (characters) tobuild words.The entire set of words is the languagevocabulary.The language syntax and grammar define theway in which the words are meaningfullycombined.The actual meaning of words and combinationsof words is defined by the language semantics.

Page 29: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Machine Language

ØØ

Ø

the lowest level of programming languageonly language understood by computers andconsists of pure numbers; takes the form of“1” or “0”each machine instruction has two (2) parts:

v

v

op code (operation code) - which tells thecomputer what function to performoperand - which tells the computer whatdata to use when performing the function

Page 30: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Low-level Language

Øalso called assembly language and is similar tomachine language but assembly language ismuch easier to understand than machinelanguage

Examples of mnemonic codes

Page 31: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Low-level Language

ØProgrammers who write low-level languageprograms must be highly skilled in two (2)areas:

v

v

must know a great deal about the internalworkings of the microprocessor, and abroad technical knowledge of thecomputer is neededmust be very detail oriented; every step ofthe computer must be coded, and theactual numerical address of theinstructions and data must be specified

An example of using the assembly language tomultiply 87 and 243 and saving the resultin the memory

Page 32: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

High-level ProgrammingLanguage

Ø

Ø

Ø

Ø

enables a programmer to write programs thatare more less independent of a particular typeof computerconsidered high-level because it’s closer tohuman language than the machine languagethat the computer understandseasier to understand and allows theprogrammer to focus on solving the problemrather than knowing how to program thecomputerexamples: Ada, Algol, BASIC, COBOL, C, C++,FORTRAN, LISP, Pascal, Prolog

Page 33: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

BASICØØ

Ø

Ø

Beginner’s All-purpose Instruction Codedeveloped by John Kemeny and Thomas Kurtzin the early 1960’sintended as an easy-to-learn interactivelanguage for the studentsAdvantages:

vvv

simplicity and flexibilityallows basic manipulation of textprovides built-in functions such aslogarithms, square root, trigonometricfunctions, and random number generator

An example of a BASIC program that will multiplytwo numbers, 243 and 87 and printing the result

Page 34: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

FORTRANØØØØ

Ø

Formula Translatorthe oldest high-level programming languagedeveloped in the mid -1950’s by John Backusprimarily intended as a high-level languageused for programming scientific, mathematicaland engineering applicationsAdvantages:

v

v

procedure-oriented language withexcellent mathematical capabilitiesits pattern is similar to the BASIC language,a programmer who is familiar withFORTRAN can easily write programs inBASIC

ØDisadvantages:v

v

closely resembles mathematical notations;thus, it is very difficult for non-programmer to understand or find theerrors in the programnot suited as a business applicationlanguage for it does not have the capabilityto develop programs that involve filemaintenance, editing of data, or documentproduction

Page 35: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

FORTRAN

An example of a FORTRAN program that willmultiply two numbers, 243 and 87 and printingthe result

Page 36: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

COBOL

ØØ

Ø

Ø

Ø

Common Business-Oriented Languagethe most frequently used businessprogramming languageused extensively in business, education, andgovernmentstarted in the early 1960’s when a committeeled by U. S. Department of Defense and othercomputer users and manufacturers known asCODASYL (Conference of Data SystemsLanguages) wanted to develop a commonbusiness programming languageDr. Gray Murray Hopper was a majorcontributor to the structure and developmentof the COBOL language

Page 37: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

COBOL

Ø Advantages:v

vv

vv

easy to understand by non-programmerssince it is English-likeself-explanatory and well-documentinggood literary capability which means thatit is good in manipulating words,sentences, or paragraphs of text materialstrong file-handling capabilitiesmachine-independent

ØDisadvantages:vvprograms tend to be wordy and quite longlimited computational capabilities whichmakes it inappropriate for applicationsthat require computations

Page 38: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

COBOL

An example of a COBOL program that willmultiply two numbers, 243 and 87 and printingthe result

Page 39: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

PASCAL

Ø

Ø

Ø

Ø

Ø

Ø

Ø

Ø

Ø

the language named after the seventeenthcentury French mathematician Blaise Pascalwho constructed one of the first addingmachinesa high-level language developed by NiklausWirth of Zurich, Switzerland in the late 1960’sone of the first languages developed using astructured programming approachPascal programs consist of modules, and eachmodule performs a specific function.The statements in the module can beorganized into levels, and the level of thestatement is shown by its degree of indentionfrom the margin to follow the program logiceasily.Statements in a Pascal program are composedof reserved words, symbols, and identifiers.Reserved words are words that have a specialmeaning to the Pascal compiler.Symbols used in Pascal include mathematicalsymbols and punctuation marks.Identifiers are names that represent variousconstants, variables, procedures, or functions.

Page 40: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

PASCAL

Ø Advantages:v

vv

relatively easy to learnpowerful and efficient languagestrong graphics capabilities

ØDisadvantages:vvv

v

not as standard as COBOL or BASICpoor input and output capabilitieslimited file-handling capabilitiesdoes not possess the ability to manipulate

large collection of numbers or words

An example of a Pascal program that will multiplytwo numbers, 243 and 87 and printing the result

Page 41: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

PASCAL

The program computes for the average ofnumbers read from an input

Page 42: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

C Language

Ø

Ø

Ø

Ø

a high-level programming language developedby Dennis Ritchie at the Bell Laboratories in1972named C, because it was influenced by anotherlanguage called B developed by Ken Thompsonoriginally designed as a systems programminglanguage, which means that it was used towrite operating systems programsAdvantages:

v

v

v

allows direct manipulation of bits, bytesand words that is similar to assemblylanguageuseful for numerical, text processing, anddatabase programsvery good graphics programmingcapabilities

Page 43: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

C Language

ØDisadvantage:vnot intended as a language for non-programmers, unlike BASIC and COBOL; ifyou are not familiar with the language, youcannot understand the structure

An example of a C program that will multiplytwo numbers, 243 and 87 and printing the

result

Page 44: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

C++ Language

Ø

Ø

developed by Bjarne Stroustrup while workingat the Bell Laboratoriesconsidered as a superset of C, and it has the

same capabilities as C with added object-oriented features

An example of a C++ program that will multiplytwo numbers, 243 and 87 and printing the result

Page 45: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

JAVA

Ø

Ø

Ø

popular programming language for creatingapplications on the web“Oak”, was developed in December 1990 bySun MicrosystemsThe Java language was the perfect languagefor the Internet because of the following:

v

vvv

vv

Simple and familiarObject-orientedArchitecture-neutralPortableDistributedSecure

Page 46: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Interpreters andCompilers

Compilers and Interpreters translate a high-level language to machine language

Page 47: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Compiler

Ø

Ø

a program that translates a program written ina high-level language (source code) andtranslates it into machine language (objectcode)the advantages and disadvantages of acompiled code over an interpreted code arethe following:

v

v

v

v

v

Compiled machine codes run much fasterthan interpreted onesCompiled codes occupy less memory duringexecutionOnce a program is compiled it can be re-run anytimeThe program can only be executed oncethe translation is completeAny change to the source code requires acomplete recompilation

Page 48: * Property of STI Page 1 of 48

Software Development

Basic Computer Concepts

Interpreter

Ø

Ø

Ø

translates and executes the program line bylinetranslates high-level instructions into anintermediate form, which it then executesthe advantages and disadvantages of aninterpreter are the following:

v

v

v

v

v

The interpreter program is loaded intomemory along with the program sourcecode so it uses more memory thencompiled codesNo copy of the translated code exist; if youwant to re-run the program it must beinterpreted all over againInterpreted codes are much slower thancompiled codesIt is faster and easier to detect errors inthe interpreted program than the compiledprogramIt is easier and faster to make changes tothe program which makes developmenttime faster especially for large programs