Upload
freztstep
View
228
Download
0
Embed Size (px)
Citation preview
8/6/2019 TUGAS PROGDAS 01 - Program Design and Pseudocode - Copy
1/14
CHAPTER 1 PROGRAM DESIGN
CHAPTER 2 PSEUDOCODE
Muh Anung Darmawan 33209
Muhammad Muzani 33267
8/6/2019 TUGAS PROGDAS 01 - Program Design and Pseudocode - Copy
2/14
CHAPTER 1 : PROGRAM DESIGN
To write well-designed programs, we need :
1. Right tools
2. Right steps to follow
Programming can be defined as thedevelopment of a solution to an identified
problem, and the setting up of a related series
ofinstructions which, when directed through
computer hardware, will produce the desired
results.
8/6/2019 TUGAS PROGDAS 01 - Program Design and Pseudocode - Copy
3/14
STEPS IN PROGRAM DEVELOPMENT
(1)
There are seven basic steps in thedevelopment of a program
1. Define the problem. For initial analysis, the problem should be
divided into three separate components:1) the inputs
2) the outputs3) The processing steps to produce the required
outputs.
2. Outline the solution (or user interface). We decompose problem it into smaller tasks or steps
8/6/2019 TUGAS PROGDAS 01 - Program Design and Pseudocode - Copy
4/14
STEPS IN PROGRAM DEVELOPMENT
(2)3. Develop the outline into a solution algorithm
We expand the solution outline developed in Step 2
into an algorithm: a set of precise steps that
describe exactly the tasks.
4. Test the algorithm for correctness. This step is one of the most important in the
development of a program, and we must remember
to finish this step.
The main purpose ofdesk checking the algorithm
is to identify major logic errors early,
5. Code the algorithm into a specific programming
language.
We code the program into our chosen
programming language.
8/6/2019 TUGAS PROGDAS 01 - Program Design and Pseudocode - Copy
5/14
STEPS IN PROGRAM DEVELOPMENT
(3)6. Run the program on the computer.
We uses a program compiler and programmer
designed test data to machine test the code for syntax
errors (those detected at compile time) and logic errors
(those detected at run time).
7. Document and maintain the program.
Documentation involves both external documentation
(such as hierarchy charts, the solution algorithm and test
data results) and internal documentation that may
have been coded in the program.
8/6/2019 TUGAS PROGDAS 01 - Program Design and Pseudocode - Copy
6/14
METODOLOGI DESAIN PROGRAM
The fundamental principle of program designis based on the fact that a program acceptsinput data, processes that data, and thendelivers that data as output to the program
user. Recently, a number of different approachesto program design have emerged, the mostcommon being:
1. procedure-driven process/function
2. event-driven event/interaction
3. data-driven data data structure
The choice between procedure-driven, Event-driven or Data-driven program designmethodologies is usually determined by theselection of a programming language.
8/6/2019 TUGAS PROGDAS 01 - Program Design and Pseudocode - Copy
7/14
PROCEDURAL VERSUS OBJECT-ORIENTED
PROGRAMMING (1)
1. Procedural programming
y Procedural programming is based on a structured
(tasks or functions ), Top-down approach to
writing effective programs. The approach
concentrates on 'what' a program has to do and
involves identifying and organizing the 'processes'
in the program solution. The problem is usually
decomposed into separate tasks or functions and
includes 1)Top-down development and 2)modular
design.
8/6/2019 TUGAS PROGDAS 01 - Program Design and Pseudocode - Copy
8/14
PROCEDURAL VERSUS OBJECT-ORIENTED
PROGRAMMING (2)
1) Top-down development
We, first, outline a general solution to the Problem, then broken
down gradually into more detailed steps until finally the most
detailed levels have been completed.
This systematic, disciplined approach result in a higherprecision of programming than was previously possible.
programming than was previously possible.
2) Modular design.
Procedural programming also incorporates the concept ofmodular
design, which involves grouping tasks together because they all
perform the same function (for example, calculating sales tax orprinting report headings). Modular design is connected directly to
Top-down development, as the steps or subtasks, into which
the programmer divides the program solution, actually form the
future modules of the program. Good modular design also
assists in the reading and understanding of the program.
8/6/2019 TUGAS PROGDAS 01 - Program Design and Pseudocode - Copy
9/14
PROCEDURAL VERSUS OBJECT-ORIENTED
PROGRAMMING (3)
2. Object-Oriented Programmingy Object-oriented programming is also based on
decomposing the problem however, the primary
focus is on the things (or objects) that make upthe program. The program is concerned with how
the objects behave, so it breaks the problem into a
set of separate objects that perform actions and
relate to each other. These objects have definite
properties, and each object is responsible for
carrying out a series of related tasks.
8/6/2019 TUGAS PROGDAS 01 - Program Design and Pseudocode - Copy
10/14
AN INTRODUCTION TO ALGORITHMS AND
PSEUDOCODE (1)
1. Algorithm
y An algorithm is like a recipe: it lists the steps
involved in accomplishing a task.
y The algorithm is written in simple English and is
not a formal document
y to be useful, there are some principles which should
be adhered to. An algorithm must:
1) be lucid, precise and unambiguous
2) give the correct solution in all cases
3) eventually end.
8/6/2019 TUGAS PROGDAS 01 - Program Design and Pseudocode - Copy
11/14
AN INTRODUCTION TO ALGORITHMS AND
PSEUDOCODE (2)
2. Pseudocode
y Pseudocode has been chosen as the primary method of
representing an algorithm because it is easy to read and
write and allows the programmer to concentrate on the
logic of the problem.
8/6/2019 TUGAS PROGDAS 01 - Program Design and Pseudocode - Copy
12/14
AN INTRODUCTION TO ALGORITHMS AND
PSEUDOCODE (3)
y Like many versions of pseudocode, this version has
certain conventions, as follows:
Statements are written in simple English.
Each instruction is written on a separate line.
Keywords and indentation are used to signify particularcontrol structures.
Each set of instructions is written from top to bottom, with
only one entry and one exit.
Groups of statements may be formed into modules, and
that group given a name.
8/6/2019 TUGAS PROGDAS 01 - Program Design and Pseudocode - Copy
13/14
PROGRAM DATA(0)
Yang akan dibahas
y Variable, constants, lieteral
y Data types
y
Filesy Data Validation
8/6/2019 TUGAS PROGDAS 01 - Program Design and Pseudocode - Copy
14/14
PROGRAM DATA(1)
Variables, constants and literals
y Variable : It is called a variable because the value
stored in those memory cells may change or vary
as the program executes
y Constant : a data item with a name and a value
that remain the same during the execution of the
program. For example, the name 'fifty' may be given
to a data item that contains the value 50.
y Literal : a constant whose name is the written
representation of its value. For example, the
program may contain the literal '50'.