0% found this document useful (0 votes)
21 views3 pages

CFAP

Uploaded by

Karl Andasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views3 pages

CFAP

Uploaded by

Karl Andasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CFAP

● Programming is a process of designing or creating a program


● Programmer is a person who writes the program.
● Program A set of step-by-step instructions that directs a computer to perform a specific task and to produce the
required results.
● Programming Language (Java, C++)
○ Languages that are used for...
○ Writing games
○ Writing application programs
● Types of Programming Language
○ Low-Level Language
◆ Machine-dependent and not portable
◆ There are two types Machine Language and Assembly Language

● Machine language
○ The FIRST generation of programming language
○ The ONLY language that the computer directly recognizes.
○ Use a series of binary digits (1s and Os) or a combination of numbers and letters that represent binary digits.
○ Machine language Disadvantages
◆ Their instructions are extremely cryptic and difficult to learn
◆ Programs are lengthy
◆ Machine-dependent
◆ Not portable.
● Assembly Language
○ The SECOND generation of programming language
○ Using symbolic instruction codes (meaningful abbreviations)
○ A → addition
○ C→ compare
○ L → load
○ M → multiply
○ Assembly Language Disadvantages
◆ Difficult to learn.
◆ Programmers must use assembler to convert assembly language to machine language.
◆ Programs are lengthy
◆ Machine-dependent
◆ Not portable

● High - Level Language


○ Instructions are quite English-like and easier to learn than machine or assembly language.
○ A single instruction corresponds to many operations at the machine level.
○ Must be converted to machine language before they can be executed
○ Portable

Translator
● Translator Program -- the program that translates the source program into the object program.
● Source Program -- program written in a high-level programming language.
● Object Program -- the source program after it has been translated into machine language.

Assembler Intepreter Compiler


converts programs written in translates one high-level program convert all of the source program
assembly language to machine instruction at a time into machine
code code
translates one high-level program convert all of the source program
assembly language to machine instruction at a time into machine into object program
code code

Problem Solving in Programming


● Programming is a process of problem-solving
● Problem-solving techniques
. Analyze the problem
. Outline the Problem requirements
. Specify what the solution should do
. Design steps, called an algorithm, to solve the problem (the general solution)
. Verify that your solution really solves the problem

To do the IPO Analysis, start with:


. Output (Display the results)
. Input (Read the data)
. Process (Perform the computation)

Algorithm
● The algorithm is the abstract idea of solving a problem.
● An algorithm is a step-by-step instructions that will transform input into output.
● It can be represent using pseudo code or flow chart

Algorithm
can be described using three control structures
● A Sequence
– is a series of statements that execute one after another
● A Selection - (branch)
– statement is used to determine which of two different statements to execute depending on certain conditions
● A Looping - (repetition)
– statement is used to repeat statements while certain conditions are met

WAYS OR TECHNIQUES TO REPRESENT


THE ALGORITHM

Pseudo Code
● Artificial, informal language used to develop algorithms.
● It is usually referred to as the "false code"
● Similar to everyday English.

Flow Chart
● Graphical representation of an algorithm.
● Special-purpose symbols connected by arrows (flow lines).

Flowcharting structures
. Sequence - In a computer program or an algorithm, sequence involves simple steps which are to be executed one
after the other. The steps are executed in the same order in which they are written
. Selection - Selection is used in a computer program or algorithm to determine which particular step or set of steps
is to be executed
. Repetition - Repetition allows for a portion of an algorithm or computer program to be done any number of times
dependent on some condition being met. An occurrence of repetition is usually known as a loop.
– An essential feature of repetition is that each loop has a termination condition to stop the repetition, or the

obvious outcome is that the loop never completes execution (an infinite loop).
– The termination condition can be checked or tested at the beginning and is known as a pre-test loop or at the
end of the loop and is known as a post-test loop.
– Repetition Pre-test (structure)
● A pre-tested loop is so named because the condition has to be met at the very beginning of the loop or the body of
the loop is not executed.
● This construct is often called a guarded loop.
● The body of the loop is executed repeatedly while the termination condition is true.

– Repetition Post-test (structure)


● A post-tested loop executes the body of the loop before testing the termination condition.
● This construct 1s often referred to as an unguarded loop
● The body of the loop is repeatedly executed until the termination condition is true.

An important difference between a pre-test and post-test loop is that the statements of a post-test loop are executed at
least once even if the condition is originally true, whereas the body of the pre-test loop may never be executed if the
termination condition is originally true. A close look at the representations of the two loop types makes this point apparent.

Benefits of flowchart
A flowchart helps to clarify how things are currently working and how they could be improved. It also assists in finding out
the key elements of a process and the start of the next one

The reasons for using flowcharts as a problem-solving tool are given below
● Makes logic clear - the main advantage of using a flowchart to plan a task is that it provides a pictorial
representation of the tasks, which makes the logic easier to follow.
The symbols are connected in such a way that they show the movement of information through the system visibly.
● Communication - being a graphical representation of a problem-solving logic, flowcharts are a better way of
communicating the logic of a system to all concerned.
● Effective analysis - with the help of a flow chart, the problem can be analyzed in an effective way

Benefits of flowchart
● Useful in Coding- the flowcharts act as a guide or blueprint during the analysis and program development phase.
Once the flowcharts are ready, the programmers can plan the coding process effectively.
● Proper testing and debugging- by nature a flowchart helps in detecting the errors in a program, as the developers
know exactly what the logic should do.
● Appropriate documentation - Flowcharts serve as a good program documentation tool. Since normally the programs
are developed for novice users.

Limitations of flowchart
● Complex- The major disadvantage of using flowcharts is that when a program is very large, the flowcharts may
continue for many pages, making them hard to follow.
● Costly- Drawing flowcharts are viable only if the problem-solving logic is straightforward and not very lengthy.
However, if flowcharts are to be drawn for a huge application, the time and cost factor of program development may
get out of proportion.
● Difficult to modify- due to its symbolic nature, any changes or modifications to a flowchart usually require redrawing
the entire logic again, and redrawing a complex flowchart is not a simple task.
● No update: usually programs are updated regularly. However corresponding updates in the flowchart may not take
place, especially in the case of large programs. As a result, the logic in the flowchart may not match with the actual
program.

You might also like