CP1 - Unit 1 - Programming Concepts
CP1 - Unit 1 - Programming Concepts
CP1 - 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
1
Programming Concepts
Course Materials
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).
- 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.
- 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. 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.
https://www.programiz.com/article/flowchart-programming
4
Programming Concepts
Find the largest among three different numbers entered by the user.
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.
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
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