/
Overview   problem Solving & Computer Programming Overview   problem Solving & Computer Programming

Overview problem Solving & Computer Programming - PowerPoint Presentation

telempsyc
telempsyc . @telempsyc
Follow
346 views
Uploaded On 2020-06-20

Overview problem Solving & Computer Programming - PPT Presentation

What is Computer A programmable electronic device that can Store Retrieve Process DATA A computer is a device that accepts information data by input manipulates it for some result based on a program sequence of instructions on how the data is to be processed generate res ID: 782568

program data step problem data program problem step computer algorithm input solution process output factorial design number requirements start

Share:

Link:

Embed:

Download Presentation from below link

Download The PPT/PDF document "Overview problem Solving & Compute..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Overview problem Solving & Computer Programming

Slide2

What is Computer??

Slide3

A programmable electronic device that can..

Store

Retrieve

Process

DATA

Slide4

A

computer is a device that accepts information / data by input, manipulates it for some result based on a program / sequence of instructions on how the data is to be processed, generate result as output and store in their storage as

needed.

Slide5

DATA?????

Computers manipulate data

When you write a program for a computer, you specify the properties of the data and the operations that can be applied to it.

Data is information in a form the computer can use-for example, numbers and letters.

Slide6

Data comes in many different forms:

letters

Words

integer numbers

real numbers

Dates timescoordinates on a map, and so on….

Slide7

We can conclude that..

any kind of information can be represented as data, or as a combination of data and operations on it.

Each kind of data in the computer is said to have a specific

data type

.

For exampleif we say that two data items are of type Integer, we know that they are represented in memory and we can apply arithmetic operations to them.

Slide8

Key Points

computer

-

A programmable device that can store, retrieve, and process

data

Data -Information in a form a computer can use.

Information-

Any knowledge that can be communicated.

Data type-

The specification of how the

information

is represented in the computer as data and the set of operations that can be applied to it.

Slide9

Computer program

: Data type specification and a set of instructions for carrying out operations that are used by a computer to solve a problem

.

Computer

programming

:The process of specifying the data types and the operations for a computer to apply on data in order to solve a problem.How do we write a Program????

Slide10

Do you think that a computer is a intelligent machine??

Slide11

A computer is not intelligent.

It cannot analyze a problem and come up with a solution.

A human (the programmer) must do it.

The Programmer must

1.analyze the problem 2.develop the instructions for solving the problem

3.And then have the computer to carry out the instructions.

Slide12

What’s the advantage of using a computer if it cannot solve problems???

Once we have written a solution for the computer, the computer can repeat the solution very quickly and consistently, again and again.

The computer frees people from repetitive and boring tasks.

Slide13

To write a program for a computer to follow, we must go through a two-phase process:

Problem Solving

Implementation

Slide14

Problem-Solving Phase

Analysis and Specification

: Understand (define) the problem and what the solution

must do.

General Solution (Algorithm): Specify the required data types and the logical sequences of steps that solve the problem. Verify: Follow the steps exactly to see if the solution really does solve the problem.

Slide15

Implementation Phase

Concrete Solution (Program).

Translate the algorithm (the general solution) into a

programming language.

Test:

Have the computer follow the instructions. Then manually check the results. If you find errors, analyze the program and the algorithm to determine the source of the errors, and then make corrections.

Slide16

Once a program has been written, it enters into third phase: maintenance.

Use:

Use the program.

Maintain:

Modify the program to meet changing requirements.

Slide17

Analysis and specification

General solution(algorithm)

Concrete solution

(program)

Verify

Test

Maintenance phase

Slide18

Algorithm

The programmer begins the programming process by analyzing the problem, breaking it into manageable pieces, and developing a general solution for each piece called an

algorithm

.

An algorithm is a written or verbal description of a logical sequence of actions applied to objects.

Examples: Recipes, instructions, and directions are all examples of algorithms that are not programs.

Slide19

When you start your car, you follow a step-by-step procedure. The algorithm might look something like this:

Insert the key.

Make sure the transmission is in Neutral.

Turn the key to the start position.

If the engine starts within six seconds, release the key to the ignition position.

If the engine doesn’t start in six seconds, release the key wait ten seconds, and repeat Steps 3 through 5

but not more than five times.

If the car doesn’t start, call the mechanic.

Slide20

Without the phrase “

but not more than five times

” in Step 5, you could be trying to start the car forever.

Why????

Because….

if something is wrong with the car, repeating Steps 3 t0 5 over and over will not start it.Infinite loop No termination for your Algorithm.

Your Algorithm should terminate at some point.

Slide21

So we can define Algorithm as follows

Algorithm :Sequence of Instructions for solving a problem in a

finite amount of time

using a

finite amount of data.

Slide22

Now….

Let’s move to a Software Industry….

Slide23

Program Development Steps

Defining or Analyzing the problem

Design (Algorithm)

Coding Documenting the program

Compiling and Running the Program

Testing and Debugging Maintenance

Slide24

Analyzing or Defining the Problem

The problem is defined by doing a preliminary investigation. Defining a problem helps us to understand the problem clear. It is also known as Program Analysis.

Slide25

Tasks in defining a problem:

Specifying the input requirements

Specifying the output requirements

Specifying the processing requirements

Slide26

Specifying the input requirements

Determine the inputs required and source of the data. The input specification is obtained by answering the following questions:

What specific values will be provided as input to the program?

What format will the values be?

For each input item, what is the valid range of values that it may assume?

Slide27

Specifying the output requirements

Describe in detail the output that will be produced. The output specification is obtained by answering the following questions:

What values will be produced?

What is the format of these values?

What specific annotation, headings, or titles are required in the report?

What is the amount of output that will be produced?

Slide28

Specifying the Processing Requirements

Determine the processing requirements for converting the input data to output. The processing requirement specification is obtained by answering the following questions:

What is the method (technique) required in producing the desired output?

What calculations are needed?

What are the validation checks that need to be applied to the input data?

Slide29

Data validation

In computer science, 

data validation

 is the process of ensuring that a program operates on clean, correct and useful data.

 It uses "validation rules" that check for correctness, meaningfulness, and security of data that are input to the system.

The simplest data validation verifies that the characters provided come from a valid set. For example, telephone numbers should include the digits and possibly the characters +, -, (, and )(plus, minus, and parentheses). A more sophisticated data validation rule would check to see the user had entered a valid country code, i.e., that the number of digits entered matched the convention for the country or area specified.

Slide30

Data type checks: Checks the data type of the input and give an error message if the input data does not match with the chosen data type, e.g., In an input box accepting numeric data, if the letter 'O' was typed instead of the number zero, an error message would appear.

Format or picture check

: Checks that the data is in a specified format (template), e.g., dates have to be in the format DD/MM/YYYY.

Logic check:

Checks that an input does not yield a logical error, e.g., an input value should not be 0 when it will divide some other number somewhere in a program.

Range check:

Checks

that the data lie within a specified range of values, e.g., the month of a person's date of birth should lie between 1 and 12.

Slide31

Incorrect data validation can lead to data corruption or a security vulnerability. Data validation checks that data are valid, sensible, reasonable, and secure before they are processed.

Slide32

Design

A design is the path from the problem to a solution in code.

A well designed program is more likely to be:

Easier to read and understand later

Less of bugs and errors

Easier to extend to add new features

Slide33

Modular Design

Once the problem is defined clearly, several design methodologies can be applied. An important approach is…..

Top-Down programming design….

It is a structured design technique which breaks up the problem into a set of sub-problems called Modules.

Slide34

Guidelines:

A problem is divided it into smaller logical sub-problems, called Modules

Each module should be independent and should have a single task to do.

Each module can have only one entry point and one exit point, so that the logic flow of the program is easy to follow.

When the program is executed, it must be able to move from one module to the next in sequence, until the last module is executed.

Each module should be of manageable size, in order to make the design and testing easier

Slide35

Top-down design has the following advantages:

Breaking up the problem into parts helps us to clarify what is to be done.

At each step of refinement, the new parts become more focused and, therefore, easier to design

Modules may be reused.

Breaking the problem into parts allows more than one person to work on the solution simultaneously.

Slide36

Algorithm (Developing a Solution technique)

An algorithm must be:

Definite

Finite

Precise and Effective

Implementation independent

Slide37

Definite???

Clearly stated or decided

Not doubtful

True or realunambiguous

Slide38

Precise and Effective

Exactness and accuracy of solution.

Every aspect must be in detail or careful about the details of the solution.

Effective:

Successful in producing a desired result or intended result.

Slide39

Implementation independent

whatever it is that an Algorithm is doing, it must do the same thing on whatever the hardware used to execute the algorithm.

Same thing with Programming language.

Slide40

Example: Find the factorial of a given numberInput: Positive valued integer number

Output: Factorial of that number

Process: Solution technique which transforms input into output. Factorial of a number can be calculated by the formula n! = 1*2*3*4….*n

Slide41

Algorithm for finding factorial of a given number

Step 1: Start

Step 2: Initialize factorial to be 1,

i

to be 1

Step 3: Input a number nStep 4: Check whether the number is 0. If so report factorial is 1 and goto step 9Step 5: Repeat step 6 through step 7 n timesStep 6: Calculate factorial = factorial *

i

Step 7: Increment

i

by 1

Step 8: Report the calculated factorial value

Step 9: Stop

Slide42

Pseudo Code

Pseudo code is an informal high-level description of an algorithm that uses the structural conventions of programming languages, but omits language-specific syntax.

It is an outline of a program written in English or the user's natural language.

Slide43

Example : Pseudo Code for finding factorial of a given number

Step 1: START

Step 2: DECLARE the variables n, fact,

i

Step 2: SET variable fact =1 and

i =1Step 3: READ the number nStep 4: IF n = 0 then

Step 4.1: PRINT factorial = 1

Step 4.2: GOTO Step 9

Step 5: WHILE the condition

i

<=n is true, repeat Step 6 through Step 7

Step 6: COMPUTE fact = fact *

i

Step 7: INCREMENT

i

by 1

Step 8: PRINT the factorial value

Step 9: STOP

Slide44

Flowchart

Flowchart is a diagrammatic representation of an algorithm. It uses different symbols to represent the sequence of operations, required to solve a problem. It serves as a outline or a logical diagram of the solution to a problem.

Slide45

Symbols

Represents Start, End

Slide46

Represents input, output data

Slide47

Represents Process(actions ,calculations)

Slide48

Represents Decision making

Slide49

Represents Pre-defined Process

Slide50

Represents off page connector which are used to indicate that the flow chart continues on another page. Page numbers are usually placed inside for easy reference

Slide51

Connector Symbol represents the exit to, or entry from, another part of the same flow chart. It is usually used to break a flow line that will be continued elsewhere.

Slide52

The Document Symbol is used to represent any type of hard copy input or output (i.e. reports).

Slide53

Represents control flow

Slide54

Coding

An algorithm expressed in programming languages is called Program. Writing a program is called Coding. The logic that has been developed in the algorithm is used to write the program.

Slide55

Documenting the Program

Documentation explains how the program works and how to use the program. Documentation can be of great value, not only to those involved in maintaining or modifying a program, but also to the programmers themselves. Details of particular programs, or particular pieces of programs, are easily forgotten or confused without suitable documentation.

Slide56

Documentation comes in two forms:

External documentation, which includes things such as reference manuals, algorithm descriptions, flowcharts, and project workbooks.

Internal documentation, which is part of the source code itself (essentially, the declarations, statements, and comments)

Slide57

Compiling and Executing the Program

Compilation is a process of translating a source program into machine understandable form.

compiler is system software, which does the translation after examining each instruction for its correctness.

The translation results in the creation of object code.

After compilation, Linking is done if necessary. Linking is the process of putting together all the external references (other program files and functions) that are required by the program. The program is now ready for execution.

During execution, the executable object code is loaded into the computer’s memory and the program instructions are executed.

Slide58

Testing

Testing is the process of executing a program with the deliberate intent of finding errors.

Testing is needed to check whether the expected output matches the actual output.

Program should be tested with all possible input data and control conditions.

Slide59

Testing is done during every phase of program development. Initially, requirements can be tested for its correctness. Then, the design (algorithm, flow charts) can be tested for its exactness and efficiency. Structured walk through is made to verify the design.

Slide60

Debugging

Debugging is a process of correcting the errors. Programs may have logical errors which cannot be caught during compilation. Debugging is the process of identifying their root causes. One of the ways to ensure the correctness of the program is by printing out the intermediate results at strategic points of computation.

Slide61

Maintenance

Programs require a continuing process of maintenance and modification to keep pace with changing requirements and implementation technologies. Maintainability and modifiability are essential characteristics of every program. Maintainability of the program is achieved by:

Slide62

System Development

System Development Life Cycle (SDLC)

The Waterfall Model:

Slide63

F. Software Engineering

Software Engineering is the establishment and use of sound engineering methods and principles to obtain a software that is reliable and that works on real machines.

This definition, from the first international conference on software engineering in 1969, was proposed 30 years after the first computer was built. During that period, software was more of an art than a science.