You are on page 1of 7

Programming Concepts

UNIT 1: Programming Concepts

Introduction

Programming is the act of writing codes or instructions for the computer to execute. We
write programs because we would like the computer to solve a specific problem. Programs more
often than not are complex. A system (ex. Payroll system) is not only one program, but it is a
consolidation of several programs working together. For this reason, a system is developed by
several programmers and analyst.

There are several computer languages that are available to write programs. The choice
depends on the type of system or application you will develop or it can be based on the current
system your client is using. Studying computer languages will only be hard and confusing at the
beginning but once you become familiar with one and able to use it to write codes it will be
easier for you to study other computer languages on your own.

The tool that we use to write program is a computer. Sometimes, when we hear the word
computer, we imagine a keyboard, a monitor, a mouse and a CPU box or sometimes a laptop.
But nowadays, computer can take many form, it can also be a tablet or a smart phone. Your
regular android phone can be used to write programs. Example, there are compilers for C++
that you can download for free on your phone and write programs from there. Of course, it is not
allowed to use your phone to write programs for work, but for this class you can, especially
when you don’t have a laptop or pc at home. Smart phones are also portable but the size of the
screen is small and it is hard to type long programs with a small keypad.

Learning Objectives

After successful completion of this lesson, you should be able to:

1. Differentiate hardware, software and firmware.


2. Identify different types of computer.
3. Enumerate and explain the steps in program development
4. Analyze programming problems

1
Programming Concepts

Course Materials

1.1 Overview of Hardware, Software and Firmware

A computer is

- an electronic device
- that you feed with data and instructions (program),
- process data based on instructions (program) given,
- stores data and result of processing (information) and
- display or transfer information needed or requested by the authorized user

Some computers can perform several task (general-purpose computers) like you can use it
to type documents, browse the Internet, watch movie, play games etc. it really depends on what
software or programs are installed in your computer, others are dedicated to perform one
specific task (special-purpose computer).

Computer can take many forms, they can be:

- desktop computer
- laptop
- tablet
- servers
- smart phones
- game consoles
- wearables
- smart TVs
- …

The physical part of the computer is what we call the hardware and the programs that we
install or use to run the computer and process our data is the software. The programs that are
part of the hardware or the programs that were installed in the hardware while it is being
manufactured are called the firmware. When we buy a laptop or pc or any computer a program
is already installed in it, we cannot erase or modify them anymore, this program starts-up the
computer; they look for the Operating System installed in our hard disk and load it to the
memory of the computer.

Hardware device can be classified as:

- Input device – receives data and information

- Output device - disseminates information ( result of processing)

- Storage device – saves data or information for future use

- Processing device – transforms our data into information based on the program we have

2
Programming Concepts

There are many classifications of software but for me, they fall in these two categories.

- System Software – these are the programs that control our hardware – the different
devices and how they can get connected to other devices and network.

- Application Software – these are programs that are specialized or customized for a
particular group of users. They can be readily available (you can buy them online or in
special computer shops) other needs to be developed or customized for particular user
(a company or agency) only.

Freeware are two words – free and software, they are software that you can
download or copy at no cost. It can be an application or systems software.

1.2 Steps in Program Development

Developing a program is comparable to building your dream house. It should be


carefully plan, check and maintain. Sometimes, we make some modification or renovations
depending on the needs of the users or when new regulations (ex. tax law/rates) arise. The
steps in program development are:

1. Problem Definition
2. Program Design
3. Coding and Debugging
4. Testing
5. Documentation
6. Maintenance

Problem Definition – it is the careful understanding and identification of the problem why a
program needs to be written or develop. This is the most crucial step because if we fail to
identify the real problem a concrete and reliable solution/program cannot be developed.
Sometimes, the program may not have any error but it will not serve the real purpose why we
develop it.

Here, we should identify the following: required output, the input data available and
where and how we can get them, the processing procedures, memory requirements, error
handling and the interface with other systems must be identified and taken into consideration.

We just don’t sit down in front of our computer and write codes immediately. Like in
building our dream house, before the architect can draw the design, the owner already decided
– how many floors, bedrooms, toilet, etc. then the architect or the engineer will start working on
those ideas plus other inputs like the location and size of lot, the regulations of the subdivision
and municipality. You can also tell the architect that you have plans of adding a room, a pool or
anything in the future.

3
Programming Concepts

Program Design – the program developer makes use of several tools to develop the design of
the program like a flowchart or an algorithm. This is like having a house plan drawn and signed
by architects and several engineers.

Flowchart – is the graphical representations of the steps on how to solve a particular


programming problem. It uses several symbols connected by lines to show the flow or sequence
of the solution.

Symbols Used In Flowchart

Symbol Purpose Description

Indicates the flow of logic by connecting


Flow line
symbols.

Terminal(Stop/Start) Represents the start and the end of a flowchart.

Input/Output Used for input and output operation.

Used for arithmetic operations and data-


Processing
manipulations.

Used for decision making between two or more


Decision
alternatives.

On-page Connector Used to join different flowline

Used to connect the flowchart portion on a


Off-page Connector
different page.

Predefined Represents a group of statements performing


Process/Function one processing task.

https://www.programiz.com/article/flowchart-programming

4
Programming Concepts

Find the largest among three different numbers entered by the user.

Flowchart to find the largest among three numbers.


https://www.programiz.com/article/flowchart-programming

Drawing flowchart can be useful in analyzing a problem that can help you in writing your
codes but if the program is too complex and big, drawing the flowchart can be more tedious
than writing the actual program. If this will be the case, you can write an algorithm for your
program design.

Algorithm – is a step-by-step solution to a problem written in simple English or in the


language spoken by the programmer. These steps will set as a guide in writing the computer
codes.

Algorithm of linear search :


1. Start from the leftmost element of arr[] and one by one compare x with
each element of arr[].
2. If x matches with an element, return the index.
3. If x doesn’t match with any of elements, return -1.
Here, we can see how the steps of a linear search program are explained in a simple, English
language.
https://www.geeksforgeeks.org/difference-between-algorithm-pseudocode-and-program/

5
Programming Concepts

Coding and Debugging – this is where the actual computer program is written or entered in the
computer using the chosen computer language (coding) and some minor errors are eliminated
and corrected (debugging).

An error that is detected by the compiler is what we call syntax error like a misspelled
word, missing punctuation, a bracket or brace with no pair. It is an error in the format of using
statement or command of the language. Another type of error that cannot be detected by the
compiler is the logical error. Logical errors are executed unlike when the compiler encounters
syntax errors the program will not execute and the compiler will make a list of all the syntax
errors it encountered.

Example: Compute the average of three numbers and store them in variable X

X=7+5+6/3; this line will be executed but the answer is wrong, the compiler will
not tell you to put parenthesis around the 7 + 5 + 6. (logical error)

X = (7 + 5 + 6) / 3 the formula is correct but you forgot to put a semicolon at the end.
This time the compiler will tell you that a ; is expected. (syntax error)

Testing – the program is tested using all possible data that it might encounter to ensure the
quality of its output. The test plan is usually part of the program design. Before implementing
the new program or system it should first run alongside with the old system to see if they will
produce the same result. Some systems/programs are replaced because of new technologies
or it might need to connect to other system that the old one cannot do.

Documentation - this is a very essential part of program development that sometimes taken
lightly especially if project is small and not really formalized. Documentation helps the users on
how to use the program and how to maintain the software. Programmers will have a hard time in
revising or maintaining the program if there are no documentations or manuals most specially, if
it is written by another programmer who may not be around anymore to clarify some of your
concerns.

All appliances or gadgets that we bought come with a manual that will tell us how to
assemble or use them. So, programs or systems developed must also come with their own
manual or documentation to guide its new users (ex. how to install, memory requirements, type
of monitor, size of printer, etc.)

Maintenance – is done after your program or system is turned over to the actual users.
Updating is done or new codes are added or deleted if new specifications arise or the user will
use another set of equipments. Other times, errors are encountered and the developer or
programmer will be called to correct the program or parts of it.

6
Programming Concepts

Activities

1. Make a diagram to highlight the steps in program development.


2. Make a collage for the different input and output device.
3. Continue my analogy in the steps in program development (comparing it to building your
dream house).

Online References

https://edu.gcfglobal.org/en/computerbasics/what-is-a-computer/1/

https://www.geeksforgeeks.org/software-engineering-program-development-life-cycle-pdlc/

https://www.techtarget.com/whatis/definition/algorithm

You might also like