Computer Programming 1
Cour se
Or ient at ion
◉ Course Description: This course is the first
programming subject that will serve as a
foundation for other programming languages.
This course is designed to introduce the
student to logic formulation and C
programming.
◉ Units: 3-unit lec/1-unit lab
◉ Prerequisite: None
Introduction to Programming Concepts Page 1 of 55
Cour se
Or ient at ion
References:
1. Computer Concepts (5th edition) by Parsons / Oja
2. Turbo C/C++ the Complete Reference 2nd
edition by Schildt
3. Absolute Beginner’s Guide to C by Greg Perry
4. New C Primer Plus by Mitchell Waite and
Stephen Prata
5. IBM Common Programming Interface C reference
6. T he C Programming Language 2nd Edition by Brian
W. Kernighan / Ritchie
Cour se
Or ient at ion
The following are the required periodic grade components for
this course:
Lecture
Class Participation 10%
Quizzes 15%
Group Reports 25%
Major Examinations 50%
100%
Laboratory
Project 50%
Laboratory exercises 50%
100%
Topic
Sequence
◉ Introduction to Programming
Concepts
◉ Flowcharting
◉ Introduction to C programming
◉ Intermediate Programming
Intr oduct ion t
o Pr ogr amming
Concept s
◉ HARDWARE CONCEPTS
◉ SOFTWARE CONCEPTS
◉ SOFTWARE DEVELOPMENT LIFE
CYCLE(SDLC)
What is a
Comput er
?
◉ An electronic device capable of performing
complex computations in a short time.
◉ A computer is a fast electronic calculating
machine that accepts input information,
processes it according to a list of
internally stored instructions called a
program, and produces the resultant
output information.
Har dwar e
Concept s
Digital representation: conversion of images,
letters and sounds into electrical signals.
Digital electronics: manipulation of “on” and “off”
signals to perform tasks.
Har dwar e
Concept s
A digital device works with discrete-distinct
or separate-data or digits, such as 1 and 0.
An analog device works with continuous data.
As an analogy, a traditional light switch has
two discrete state. A dimmer switch, on the
other hand, has a rotating dial that
controls a continuous range of brightness. It
is, therefore, an analog device.
Digital Data
REpr esent at
ion
The “0” and “1” are also known as bits or binary
digits.
A sequence of “0” and “1” could be written as
10011, this sequence may have significant value,
for instance it may pertain to a certain character
or number.
Digital Data
REpr esent at
ion
How can a computer represent numbers using bits?
Numeric data like your age, salary, electricity
bill are easily understood by humans. Then, how
is it possible for a computer to show a number
using only binary digits?
The binary number system only has two digits: 0
and 1. There are no 2’s nor 3’s. A series of 0’s
and 1’s will result to a particular number or
character.
Digital Data
REpr esent at
ion
Decimal (Base 10) Binary (Base 2)
This table shows how binary system works.
Decimal (Base 10) Binary (Base 2)
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
9 1001
Digital Data
REpr esent at
ion
A closer look on bits.
How come 5 represents 0101 when converted to
binary? Notice that there are 4 digits, namely, 0
, 1 , 0 and 1. The positions of the 0’s and 1’s
hold a significant value. The illustration will
show the corresponding position and value in the
binary number system.
8 4 2 1
0 1 0 1
Digital Data
REpr esent at
ion
If the box contains 0 , the value is turned “off”.
However, if the box contains 1, value of that box
is turned “on” and will be added to the sum.
8 4 2 1
0 1 0 1
8*0=0 4*1=42*0=0 1*1=
1
Therefore:
0+4+0+1=5
Digital Data
REpr esent at
ion
How can a computer represent words and letters
using bits?
Much like representing numerical data, bits can
also be used to represent character data. It is
synonymous to using Morse code using the dashes
and dots to represent letters in the alphabet. In this
case, computers makes use of 0 and 1 as a
replacement to dashes and dots. Example: STI has a
corresponding binary value.
0101 0011 0101 0100 0100 1001
Digital Data
REpr esent at
ion
Types of codes:
ASCII (American Standard Code for Information
Interchange)
* requires only seven bits for each character.
EBCDIC (Extended Binary Coded Decimal Interchange
Code)
* is an alternative 8-bit code used by older IBM
mainframe computers.
UNICODE
* uses 16 bits providing codes for 65000 characters and
becoming popular.
Digital Data
REpr esent at
ion
Extended ASCII code makes use of a series of 0’s and 1’s
to symbolize the 256 characters (includes letters for
uppercase and lowercase, numbers, and symbols).
Bit s and Byt es
BIT
◉ an abbreviation of binary digit
◉ other abbreviation for bit is the lowercase
BYTE
◉ a collection of bits (8 to be exact)
◉ usually abbreviated as an uppercase
Bit s and Byt es
Decade 1970s 1980s 1990s 2000s
Storage capacity Thousands Millions Billions Trillions
Prefix Kilo Mega Giga Tera
Abbreviation K M G T
Digit al
El ectr onics
How are bits stored and transferred from one
point to another?
◉ bits are in a form of electrical pulses (0 and
1) traveling on the circuits
◉ components of the circuits such as chips,
resistors, registers, etc. are created to handle
bits
Digit al
El ectr onics
The basic components of a computer system
Digit al
El ectr onics
• Motherboard - the main circuit board of a microcomputer;
also known as the main board or system board.
• CPU - the central electronic chip that determines the
processing power of the computer.
• Memory - the part of the computer that temporarily stores
applications, documents, and stem operating information.
• Bus - an electronic line that allows 1s and 0s to move from
one place to another.
• Expansion Slots - appear on the motherboard; they are
sockets into which adapters are connected.
• Ports and Connectors - a connector located on the
motherboard or on a separate adapter.
• Bays - a space inside the computer case where a hard
drive, floppy drive or CD-ROM drive sits.
• Power Supply - changes normal household electricity into
electricity that a computer can use.
• Sound Components - lets a computer play and record high
quality sound.
Digit al
El ectr onics
What is a chip?
A minute slice of a semiconducting material,
such as silicon or germanium, doped and
otherwise processed to have specified
electrical characteristics, especially before it is
developed into an electronic component or
integrated circuit. Also called microchip.
An integrated circuit.
source: www.dictionary.com
Digit al
El ectr onics
Chips (IC) are used for microprocessors,
memory, and support circuitry. These are
housed in within a ceramic container.
Types of
chips:
DIP
DIMM
PGA
SEC
Digit al
El ectr onics
DIP
Acronym for dual in-line package, a type of chip
housed in a rectangular casing with two rows of
connecting pins on either side. (source:
www.webopedia.com)
Digit al
El ectr onics
DIMM
◉ dual in-line memory module
◉ a small circuit board that holds memory
SIMM
◉ single in-line memory module (SIMM) has a 32-bit
path to the memory chips whereas a DIMM has
64- bit path
Digit al
El ectr onics
PGA
◉ Pin Grid Array, a type of chip package in which
the connecting pins are located on the bottom in
concentric squares
◉ PGA chips are particularly good for chips that have
many pins, such as modern microprocessors.
(source: www.webopedia.com)
Digit al
El ectr onics
SEC
It is a cartridge type of chip and a popular
package for microprocessors.
Digit al
El ectr onics
How do all this connect?
Microchips are connected via a mother board (a.k.a
main board).
The main board houses all pertinent chips providing
means of connectivity to each chip and bridging the
circuitry between them.
Some are soldered permanently in place, others have
a special socket allowing it to be removed for
further upgrades.
Sof t war e
Concept s
What is a software?
◉ computer instructions or data
◉ anything that can be stored electronically
◉ computer programs, modules (support and data)
working together providing computers with
instructions and data for certain task (e.g. word
processing, internet browsing)
Types of
Licenses
Before using a certain software, do you
always read the licenses agreement that
comes with it?
It is not enough just for users to “use” the
software purchased. Each users must be
responsible enough to what legal extent he/
she can do with the purchased software.
There are certain questions in this topic that
will help us understand the legality with
regards to software.
Types of
Licenses
◉ copyright is a form legal protection that enables
the owner exclusive right to the product (e.g.
reproduction, distribution, and modification of the
program)
◉ even if you have purchased a software package,
you are bound to follow the agreement stipulated
in the license.
◉ the term “purchase” only entitles the buyer to use
the software at some extent
Types of
Licenses
More on copyright
There are some circumstances that copying software
is legal. These exceptions are:
1. The purchaser has the right to copy software
from a distribution disk or web site to a
computer’s hard disk in order to install it.
2. The purchaser can make an extra, or back up,
copy of the software in case the original copy
becomes erased or damaged (usually the copy
is commonly used and the original is stored for
safe keeping).
3. The purchaser is allowed to copy and
distribute sections of a software program for
use in critical reviews and teaching.
Types of
Licenses
What is a software license?
A.K.A “license agreement”, it is a legal
contract that defines the ways in which
you may use a computer program.
Note that there are many kinds of license
involving software packages.
Types of
Licenses
◉ A software license is a legal contract that
defines the ways in which you may use a
computer program
◉ Software licenses are categorized to the following:
– Shrink–Wrap
– Commercial software
– Shareware
– Freeware
– Open source software
– Public Domain Software
Types of
Licenses
Shrink–Wrap
This is a type of license were the software
package is enclosed or sealed in an envelope,
plastic box, or shrink wrapping. The
agreement will take into effect once the user
opens up the container.
Types of
Licenses
Commercial software
Licenses of this type are commonly sold at computer
stores and websites.
1.) Single-user license - were the use of the
software is allowed to one user only at a time.
2.) Multiple-user license - were the use of the
software allows two or more persons at any
given time.
3.) Concurrent-use license - were it allows copies
of the software to be used simultaneously
(example: license for word processor or spread
sheet).
4.) Site license - were it allows the use of software
to any computer at a specific location
(example: license for a company or
universities).
Types of
Licenses
Shareware
Software distributed on the basis of an honor system.
Most shareware is delivered free of charge, but
the author usually requests that you pay a small
fee if you like the program and use it regularly.
By sending the small fee, you become registered
with the producer so that you can receive service
assistance and updates.
You can copy shareware and pass it along to
friends and colleagues, but they too are expected
to pay a fee if they use the product.
Types of
Licenses
Freeware
Copyrighted software given away for free by the author.
Although it is available for free, the author retains
the copyright, which means that you cannot do
anything with it that is not expressly allowed by the
author.
Usually, the author allows people to use the software,
but not sell it.
Types of
Licenses
Open source software
An example of this type of license is the Linux
operating system. In this case, the software may
be sold, modified, or distributed “free of
charge.”
Types of
Licenses
Public Domain Software
An example of a public domain software are
those software that has been abandoned by
the author including all of the rights to it.
Software in this category are available
without any restrictions, meaning, it can
be sold, distributed or even modified.
Sof t war e
Basics
Terminologies
1. Computer program (or “program”) - An
organized list of instructions that, when
executed, causes the computer to behave in a
predetermined manner.
2. Support module – is an auxiliary set of
instructions used in conjunction with the main
software program (example: DLL files).
3. Data module – contains data (not supplied by the
user) necessary for the execution of certain task.
(e.g. spell checker of Microsoft word and HLP
files).
Sof t war e
Basics
Support Modules are usually
In .dll format
Program files are usually
In .exe format
Data Modules comes in
Many forms (.hlp/.dat/.txt)
Sof t war e
Basics
Data vs. Software
Before, the term “software” is always
associated to all non-hardware components of a
computer.
However, modern definitions made it clear that
all documents, spreadsheets and even
downloaded materials from the net are now
classified as data.
Sof t war e
Basics
Application Software vs. System Software
◉ Application software provides instructions to the
computer depending on the use (application). The
purpose of application software is to help
automate common task (example: typing,
accounting task, etc).
◉ System software helps the computer carry out its
basic operating functions. Under this type of
software includes device drivers, operating
systems, and other utilities.
Sof t war e
Basics
Sof t war e
Devel
opment
Lif e Cycl e
What is SDLC?
◉ also known as Systems Development Life Cycle
◉ a common methodology for systems development
in many organizations, featuring several phases
that mark the progress of the system analysis and
design effort. (source: Modern Systems Analysis &
Design 2nd ed. By Hoffer/George/Valacich)
◉ an outline of a process that helps develop successful
information systems (source: Computer Concepts 5th ed by
Parson/Oja)
◉ is the process of developing information systems
through investigation, analysis, design,
implementation and maintenance
◉ also known as information systems development or
application development. (source: www.webopedia.com)
Sof t war e
Devel
opment
Lif e Cycl e
What is the importance of SDLC?
In order to create systems that are good in design
we must take into consideration that it must
involve several phases. You can’t just create it in
just one big attempt.
Furthermore , it would be very favorable for
companies to have certain set of standardized
steps that would serve as a guide in systems
development.
Sof t war e
Devel
opment
Lif e Cycl e
What are the 5 phases of SDLC?
1. Planning
2. Analysis
3. Design
4. Implementation
5. Maintenance
Sof t war e
Devel
opment
Lif e Cycl e
Planning phase
◉ also known as project identification and selection
◉ involves identification for the need or
enhancement(s) of the current system being used
“In the first phase of the SDLC, the organization’s
total information system needs are identified,
analyzed, priotized, and arranged.”
Sof t war e
Devel opment
Lif e Cycl e
Analysis Phase
◉ requires the analyst to thoroughly study the current
procedures or system used to execute tasks in an
organization
◉ the main goal in this phase is to identify the
requirements for a new system or simply change
several aspects in the current working system
“This phase studies the current system and
produces proposed alternatives or replacements.”
Sof t war e
Devel opment
Lif e Cycl e
Design Phase
◉ during this phase, the developer of the system
translates the result of the previous phase into
actual design or specifications of the system
◉ development of the system involves covering the
input and output screens to reports, databases,
and computer process
Sof t war e
Devel opment
Lif e Cycl e
Implementation Phase
1) coding – creation of the actual program
2) testing – both programmer and analyst
submits the system to various “quality testing”
to discover if there are any bugs within the
system
3) installation – after coding and testing is
done, the actual system must be installed
and slowly or completely replaces the old
system
Sof t war e
Devel opment
Lif e Cycl e
Maintenance Phase
◉ used to make necessary patches to remove
found errors
◉ where the system is systematically repaired
and improved based on errors or possible
new requirements found
Sof t war e
Devel opment
Lif e Cycl e
Waterfall SDLC
The waterfall SDLC suggest that prior to
proceeding to next phase, the current phase
should be finished first. But applying this strategy
in the real world would be unfeasible since it
would be impossible to modularize system
development.
Planning
Analysis
Design
Implementation
mplementatio
Maintenance
Sof t war e
Devel opment
Lif e Cycl e
Modified waterfall and iterative SDLC