Professional Documents
Culture Documents
Introduction
This chapter focused on programming principle and terminologies on how the
program/code works with the use of Integrated Development Environment (IDE) so
that students will be familiarized on the process of the program execution.
Learning Outcomes
Learning Content
The first step in defining a problem begins with recognizing the need for
information. As we all know all information is very important primarily because such
information can help us in making a good decision. This information may be
requested for a solution to a particular problem. The problem is thoroughly analyzed
in order to determine what is required for its solution.
To better understand and analyze the problem we must conduct a study of the
nature of the problem and we must able to identify the necessary outputs required in
the program. In conducting a study or investigation of the problem we must talk to the
end-use of the proposed program we are trying to develop since he understands the
problem prior to writing the necessary code for the program itself.
The programmer must determine what data are needed, what form they are to be
in, what information should the program generate, and how the data are to be
manipulated to produce the result.
Designing a Solution
When the problem is defined properly, we can start designing the solution to the
problem. In designing he solution, we must be able to breakdown the problem into
several steps so that is easier for us to solve the problem in smaller pieces. This
method is called divide and conquer principle. This sequence of steps for the
solution to the problem is called an Algorithm.
After the programmer has defined the problem and designed a solution, the next
step is to write the program in a specific programming language. Although the
definition and solution of the problem are independent of the programming language,
the proposed solution to the problem, may limit the choices of languages that can be
used.
Program
Despite the fact that programming languages differ in commands they use, high-
level programming languages must have certain types of programming statements in
common. These are comments, declarations, input/output statements, computations,
transfer of control, and comparison.
Comments are statements that have no effect on the program. They are simply
used to make the program easier to understand. They are inserted at the key points in
the program and serve as an internal documentation of the program.
The programmer uses declarations to define items used in the program. Examples
include definitions of files, records, initial values, reusable functions and the like.
Input/output statements transfer data to and from the primary storage for use by
the program, as well as to and from other I/0 devices like the monitor and the
keyboard. Commands such as READ and PRINT are examples of these types of
statements.
Computational instructions perform arithmetic operations such as addition,
subtraction, multiplication, division and exponentiation. Different programming
languages vary in the way they invoke the computer's arithmetic capabilities.
Another type of instruction allows the sequence of execution to be altered by
transferring control. A conditional transfer of control alters the sequence only when a
certain condition met. An unconditional transfer of control always changes the
sequence of execution.
Comparisons allow two items to be compared. Based on the result of the
comparison, input/output, computation, or transfer of control could occur.
As the program is being coded, the programmer should be aware that although
generating the correct output is the primary goal of the program, it is not the only
requirement of a good program. The programmer should try to incorporate the
following qualities into any program.
Compiler
Debugging
Testing
1. A method of assessing the functionality of a software program.
2. The process of checking if a program actually performs its functions as
planned.
Maintenance
During the implementation of the s y s t e m , there a r e s ome c h a n g e s in
the program that w i l l occur d e p e n d i n g on the· nature of the system that i s
being developed. Maintenance is one of the most important aspects i n
developing a computer program in a sense that is there are errors or bugs that
are spotted by the user it should be fixed as soon as possible in order to avoid
big problems along the way of using the system. Let say, for example, the
user has discovered that' every time a new record is being added in the
database the record is not being saved correctly h a v i n g this problem i s very
c r i t i c a l in any business organization. This problem should be corrected
right away from the programmer, so that it will not hamper the day-to-day
operation of the company.
1. Syntax errors - Errors due to the fact that the syntax of the language is
not respected.
2. Semantic errors - Errors due to an improper use of program statements
3. Logical errors - Errors that occur when the specification is not respected.
4. Compile time errors - Syntax errors and static semantic errors
indicated by the compiler.
5. Runtime errors - Dynamic semantic errors and logical errors that
cannot be detected by the compiler (debugging).
Programming Language
1. Machine Language
2. Uses binary codes that consist of string of only zeroes and ones.
3. These are languages that a computer can understand and execute
directly.
4. Machine dependent
5. Low – level Language
1. Assembly Language
2. Instead of zeroes and ones, it uses mnemonics or very short words for
commands.
3. Program written in assembly language must be converted by an
ASSEMBLER.
4. Low level language TASM, MASM.
1. Logic Programming
2. Artificial Language
3. Operates on the concept of solving problems based on constraints or
rules that have been declared in the program.
4. The focus is on making the computer program solve the problem for
you.
5. Uses knowledge bases and expert system
6. PROLOG, Mercury, LISP
7. PROGRAMMING PARADIGMS
8. Imperative
9. Functional
10. Logic
11. Object-Oriented
12. Concurrent and Distributed
Imperative Programming
Functional Programming
1. Computations are specified through mathematical functions that
evaluate input expressions and convert them into output values.
2. Functional programming languages are “what” – oriented.
3. They describe the problem to be solved rather than specify the actual
steps required for the solution.
4. LISP, Haskell, Scheme, Standard ML.
Logic Programming
Machine Language
Regardless of what type of language you are using, eventually you will
convert your program into a machine language so that the computer can
understand and execute your program. When we write our programs in a
high-level language the computer does not understand the language
because it is only operated with bit or one's and zero’s. There is a need
for translation process that will. convert the programs written in high-
level language into machine language. '
Compiler
Interpreter
Intermediate
Source Code Interpreter
code
Characteristics of Java
1. Java is simple.
2. Java is object-oriented.
3. Java is distributed.
4. Java is interpreted
5. Java is robust.
6. Java is secure.
7. Java is architecture-neutral.
8. Java is portable.
9. Java's performance.
10. Java is multithreaded.
11. Java is dynamic.
Benefits of Java
class Hello_World {
public static void main (String [] args){
System.out.println(“Welcome to Java Programming”);
}
}
Reference