COMPUTER
PROGRAMMING
by:
Trisha Faye Gamboa
Karl Albert Balolong
 The Computer Programming and Analysis
program provides an opportunity to establish
a basic foundation in computer programming
in scientific, commercial, industrial and
government information technology
applications. Graduates are prepared for
positions as entry-level application
programmers, programmer specialists,
computer programmers and programmer
analysts.
 Computer programming is a process that leads from
an original formulation of a computing problem to
executable computer programs. Programming
involves activities such as analysis, developing
understanding, generating algorithms, verification of
requirements of algorithms including their correctness
and resources consumption, and implementation
(commonly referred to as coding) of algorithms in a
target programming language. Source code is written
in one or more programming languages (such as C,
C++, C#, Java, Python, Ruby, Smalltalk, JavaScript,
etc.).The purpose of programming is to find a
sequence of instructions that will automate
performing a specific task or solving a given problem.
Introduction to Programming
 Program is a set of step-by-step instruction
that tells or directs the computer what to do.
 Programming Language is a set of rules that
tells the computer what to perform is through
it.
 Programmer is the person who designs and
tests a program.Also decides which of the
programs or set of instruction to use.
 The process of programming thus often
requires expertise in many different subjects,
including knowledge of the application
domain, specialized algorithms and formal
logic.
 Identifying – Planning – Coding –Testing -
Documentation
- First step.To determine the
requirement of the program.
-Two ways of planning the soluti0n to a
problem.
1. Flowcharting
2. Pseudo Code
Flowcharting is a step-by-step instruction.
Psuedo Code is listing down the set of
instructions to be used in the program.
Coding the Program
 Designing the solution.This step needs to
use Visual Basic as it’s programming
language. Programming language have
their own set of rules to follow, this is
called syntax. Also used in a certain
program will produce an error called
syntax error.
After coding the program, it is important
to test if it is running.
Three phases of Testing:
1. Desk checking- in these phase the
programmer just mentally traces or checks
the logic of the program.To make sure if it’s
error free.
2. Translation- these phase uses a translator to
ensure that the programmer did not violate
any language rules by the chosen
programming language. It translates the
program line by line to locate any syntax
error.
Documentation
3. Debugging- this means detecting, locating
and correcting bugs ( an error or mistake).
-In this step, the programmer makes a
detailed description on how the program
was created. It contains a brief narrative
process undergone by a program.
- Codes used for the next programmer who
will upgrade the designed program.
Reliability: how often the results of a program are
correct.This depends on conceptual correctness of
algorithms, and minimization of programming
mistakes, such as mistakes in resource management
(e.g., buffer overflows and race conditions) and logic
errors (such as division by zero or off-by-one errors).
Robustness: how well a program anticipates
problems due to errors (not bugs).This includes
situations such as incorrect, inappropriate or corrupt
data, unavailability of needed resources such as
memory, operating system services and network
connections, user error, and unexpected power
outages.
 Usability: the ergonomics of a program: the ease with
which a person can use the program for its intended
purpose or in some cases even unanticipated purposes.
Such issues can make or break its success even regardless
of other issues.This involves a wide range of textual,
graphical and sometimes hardware elements that improve
the clarity, intuitiveness, cohesiveness and completeness of
a program's user interface.
 Portability: the range of computer hardware and
operating system platforms on which the source code of
a program can be compiled/interpreted and run.This
depends on differences in the programming facilities
provided by the different platforms, including hardware
and operating system resources, expected behavior of
the hardware and operating system, and availability of
platform specific compilers (and sometimes libraries) for
the language of the source code
 Maintainability: the ease with which a program
can be modified by its present or future
developers in order to make improvements or
customizations, fix bugs and security holes, or
adapt it to new environments. Good practices
during initial development make the difference
in this regard.This quality may not be directly
apparent to the end user but it can significantly
affect the fate of a program over the long term.
 Efficiency/performance: the amount of system
resources a program consumes (processor time,
memory space, slow devices such as disks,
network bandwidth and to some extent even
user interaction): the less, the better.This also
includes careful management of resources, for
example cleaning up temporary files and
eliminating memory leaks
 Different programming languages support
different styles of programming (called
programming paradigms).The choice of
language used is subject to many
considerations, such as company policy,
suitability to task, availability of third-party
packages, or individual preference. Ideally,
the programming language best suited for
the task at hand will be selected.
 Trade-offs from this ideal involve finding
enough programmers who know the
language to build a team, the availability of
compilers for that language, and the
efficiency with which programs written in a
given language execute. Languages form an
approximate spectrum from "low-level" to
"high-level"; "low-level" languages are
typically more machine-oriented and faster
to execute, whereas "high-level" languages
are more abstract and easier to use but
execute less quickly. It is usually easier to
code in "high-level" languages than in "low-
level" ones.
 The details look different in different
languages, but a few basic instructions appear
in just about every language:
 Input: Gather data from the keyboard, a file, or
some other device.
 Output: Display data on the screen or send data
to a file or other device.
 Arithmetic: Perform basic arithmetical
operations like addition and multiplication.
 Conditional Execution: Check for certain
conditions and execute the appropriate
sequence of statements.
 Repetition: Perform some action repeatedly,
usually with some variation.
Levels of programming language
 There are five levels of programming language.
Used in their respective generation. Each
generation is an improvement of the latter
generation.
1. Machine Language ( 1st Generation Prog.
Language
- Lowest level programming language. It’s
represented by 1s and 0s. A very tedious task for
just a simple task, the program code required
would be very long.
2. Assembly Language or 2nd Generation Prog.
Language
-Also considered as low level language.This
language is easier to use than Machine language.
Instead of using 1s and 0s, this language use
mnemonic codes( abbreviations that are easy to
remember).
3. High Level Language or 3rd Generation Prog.
Language
- this language transformed programming in
the early 1960s. It’s easier since the language is
now written in English like matter.Third
generation prog. Language uses translator.
 4.Very High Level Language or 4th Generation
Language ( 4 GL)
It simplifies further the third level generation
language (3GL) because there is a reduction in the
number of instructional statements. One hundred
(100) lines of instruction in 3GLs can be reduced to
five (5) to twenty (20) lines of instruction in 4GLs.
5. Natural Language
This language are considered to be the fifth gen.
prog. language. Natural language have their
resemblance to English language.This language
have the capability to translate human instructions
into code that a computer understands.
Examples:
Non-Procedural Languages
 So called as Object-oriented programming
languages. They are event-driven which means
that a programmer selects an event that needs
to occur before the instruction or statement is
executed.
Examples:
 VISUAL BASIC
 C++
 JAVA
 DELPHI
 Many computer languages provide a
mechanism to call functions provided
by shared libraries. Provided the
functions in a library follow the
appropriate run time conventions
(e.g., method of passing arguments),
then these functions may be written
in any other language.
Computer Programming

Computer Programming

  • 1.
  • 2.
     The ComputerProgramming and Analysis program provides an opportunity to establish a basic foundation in computer programming in scientific, commercial, industrial and government information technology applications. Graduates are prepared for positions as entry-level application programmers, programmer specialists, computer programmers and programmer analysts.
  • 3.
     Computer programmingis a process that leads from an original formulation of a computing problem to executable computer programs. Programming involves activities such as analysis, developing understanding, generating algorithms, verification of requirements of algorithms including their correctness and resources consumption, and implementation (commonly referred to as coding) of algorithms in a target programming language. Source code is written in one or more programming languages (such as C, C++, C#, Java, Python, Ruby, Smalltalk, JavaScript, etc.).The purpose of programming is to find a sequence of instructions that will automate performing a specific task or solving a given problem.
  • 4.
    Introduction to Programming Program is a set of step-by-step instruction that tells or directs the computer what to do.  Programming Language is a set of rules that tells the computer what to perform is through it.  Programmer is the person who designs and tests a program.Also decides which of the programs or set of instruction to use.
  • 5.
     The processof programming thus often requires expertise in many different subjects, including knowledge of the application domain, specialized algorithms and formal logic.  Identifying – Planning – Coding –Testing - Documentation
  • 6.
    - First step.Todetermine the requirement of the program. -Two ways of planning the soluti0n to a problem. 1. Flowcharting 2. Pseudo Code Flowcharting is a step-by-step instruction. Psuedo Code is listing down the set of instructions to be used in the program.
  • 7.
    Coding the Program Designing the solution.This step needs to use Visual Basic as it’s programming language. Programming language have their own set of rules to follow, this is called syntax. Also used in a certain program will produce an error called syntax error. After coding the program, it is important to test if it is running.
  • 8.
    Three phases ofTesting: 1. Desk checking- in these phase the programmer just mentally traces or checks the logic of the program.To make sure if it’s error free. 2. Translation- these phase uses a translator to ensure that the programmer did not violate any language rules by the chosen programming language. It translates the program line by line to locate any syntax error.
  • 9.
    Documentation 3. Debugging- thismeans detecting, locating and correcting bugs ( an error or mistake). -In this step, the programmer makes a detailed description on how the program was created. It contains a brief narrative process undergone by a program. - Codes used for the next programmer who will upgrade the designed program.
  • 11.
    Reliability: how oftenthe results of a program are correct.This depends on conceptual correctness of algorithms, and minimization of programming mistakes, such as mistakes in resource management (e.g., buffer overflows and race conditions) and logic errors (such as division by zero or off-by-one errors). Robustness: how well a program anticipates problems due to errors (not bugs).This includes situations such as incorrect, inappropriate or corrupt data, unavailability of needed resources such as memory, operating system services and network connections, user error, and unexpected power outages.
  • 12.
     Usability: theergonomics of a program: the ease with which a person can use the program for its intended purpose or in some cases even unanticipated purposes. Such issues can make or break its success even regardless of other issues.This involves a wide range of textual, graphical and sometimes hardware elements that improve the clarity, intuitiveness, cohesiveness and completeness of a program's user interface.  Portability: the range of computer hardware and operating system platforms on which the source code of a program can be compiled/interpreted and run.This depends on differences in the programming facilities provided by the different platforms, including hardware and operating system resources, expected behavior of the hardware and operating system, and availability of platform specific compilers (and sometimes libraries) for the language of the source code
  • 13.
     Maintainability: theease with which a program can be modified by its present or future developers in order to make improvements or customizations, fix bugs and security holes, or adapt it to new environments. Good practices during initial development make the difference in this regard.This quality may not be directly apparent to the end user but it can significantly affect the fate of a program over the long term.  Efficiency/performance: the amount of system resources a program consumes (processor time, memory space, slow devices such as disks, network bandwidth and to some extent even user interaction): the less, the better.This also includes careful management of resources, for example cleaning up temporary files and eliminating memory leaks
  • 14.
     Different programminglanguages support different styles of programming (called programming paradigms).The choice of language used is subject to many considerations, such as company policy, suitability to task, availability of third-party packages, or individual preference. Ideally, the programming language best suited for the task at hand will be selected.
  • 15.
     Trade-offs fromthis ideal involve finding enough programmers who know the language to build a team, the availability of compilers for that language, and the efficiency with which programs written in a given language execute. Languages form an approximate spectrum from "low-level" to "high-level"; "low-level" languages are typically more machine-oriented and faster to execute, whereas "high-level" languages are more abstract and easier to use but execute less quickly. It is usually easier to code in "high-level" languages than in "low- level" ones.
  • 16.
     The detailslook different in different languages, but a few basic instructions appear in just about every language:  Input: Gather data from the keyboard, a file, or some other device.  Output: Display data on the screen or send data to a file or other device.  Arithmetic: Perform basic arithmetical operations like addition and multiplication.  Conditional Execution: Check for certain conditions and execute the appropriate sequence of statements.  Repetition: Perform some action repeatedly, usually with some variation.
  • 17.
    Levels of programminglanguage  There are five levels of programming language. Used in their respective generation. Each generation is an improvement of the latter generation. 1. Machine Language ( 1st Generation Prog. Language - Lowest level programming language. It’s represented by 1s and 0s. A very tedious task for just a simple task, the program code required would be very long.
  • 18.
    2. Assembly Languageor 2nd Generation Prog. Language -Also considered as low level language.This language is easier to use than Machine language. Instead of using 1s and 0s, this language use mnemonic codes( abbreviations that are easy to remember). 3. High Level Language or 3rd Generation Prog. Language - this language transformed programming in the early 1960s. It’s easier since the language is now written in English like matter.Third generation prog. Language uses translator.
  • 19.
     4.Very HighLevel Language or 4th Generation Language ( 4 GL) It simplifies further the third level generation language (3GL) because there is a reduction in the number of instructional statements. One hundred (100) lines of instruction in 3GLs can be reduced to five (5) to twenty (20) lines of instruction in 4GLs. 5. Natural Language This language are considered to be the fifth gen. prog. language. Natural language have their resemblance to English language.This language have the capability to translate human instructions into code that a computer understands.
  • 21.
  • 22.
    Non-Procedural Languages  Socalled as Object-oriented programming languages. They are event-driven which means that a programmer selects an event that needs to occur before the instruction or statement is executed. Examples:  VISUAL BASIC  C++  JAVA  DELPHI
  • 23.
     Many computerlanguages provide a mechanism to call functions provided by shared libraries. Provided the functions in a library follow the appropriate run time conventions (e.g., method of passing arguments), then these functions may be written in any other language.