You are on page 1of 22

COURSE INTRODUCTION

RSU-IIT 00-0027-MOD-2021-08-22

Prepared by:
HOYLE S. FAJANILAN JR, MIT
Document Code
This module is dedicated to Romblon State University students who are
enrolled in the subject computer Programming 1. This module aims to
train the first year students in designing, debugging, and developing a
program intended to solve computing problems using fundamental
programming constructs.

2 | Page
TABLE OF CONTENTS

MODULE ONE:
INTRODUCTION #
LEARNING OUTCOMES #
LESSON 1A: ENTER TITLE HERE #
LESSON 1B: ENTER TITLE HERE #
LESSON 1C: ENTER TITLE HERE #
LESSON 1D: ENTER TITLE HERE #
ASSESSMENT #
REFLECTIVE ANALYSIS #
REFERENCES #

MODULE TWO:
INTRODUCTION #
LEARNING OUTCOMES #
LESSON 2A: ENTER TITLE HERE #
LESSON 2B: ENTER TITLE HERE #
LESSON 2C: ENTER TITLE HERE #
LESSON 2D: ENTER TITLE HERE #
ASSESSMENT #
REFLECTIVE ANALYSIS #
REFERENCES #

MODULE THREE:
INTRODUCTION #
LEARNING OUTCOMES #
LESSON 3A: ENTER TITLE HERE #
LESSON 3B: ENTER TITLE HERE #

3 | Page
LESSON 3C: ENTER TITLE HERE #
LESSON 3D: ENTER TITLE HERE #
ASSESSMENT #
REFLECTIVE ANALYSIS #
REFERENCES #

MODULE FOUR:
INTRODUCTION #
LEARNING OUTCOMES #
LESSON 4A: ENTER TITLE HERE #
LESSON 4B: ENTER TITLE HERE #
LESSON 4C: ENTER TITLE HERE #
LESSON 4D: ENTER TITLE HERE #
ASSESSMENT #
REFLECTIVE ANALYSIS #
REFERENCES #

4 | Page
IT 2 – Computer Programming 1

MODULE ONE

5 | Page
INTRODUCTION
Module one covers all the important terms in the computer programming language. Also, it
discusses the different languages such as Assembly language, Machine language, Low-level
language, and High-level language. It also discusses the procedural and object-oriented
programming concepts.
LEARNING OUTCOMES:
● Define what computer programming is

● Explain the terms related to computer programming such as source code, programs,
etc.
● Differentiate Assembly Language and Machine Language

● Describe what are the low and high-level languages

● Compare procedural and object-oriented programming

LESSON 1: Introduction to Programming

▪ LEARNING OBJECTIVES:
Upon completion of the course, the student should be able to:
● To know programming terms 09618143228

● To differentiate Low Level and High Level language

● To distinguish Machine language and Assembly Language

● To compare Procedural and Object-oriented Programming

Computer program - is a list of instructions that the computer machine follows to


properly accept input, correctly process them and present the results in the most
understandable way.

6 | Page
Computer Programming – is a way of giving computers instructions about what
they should do next. These instructions are known as code, and the computer
programmers write code to solve problems or perform a task. Also computer
programming is considered to be an art and at the same time a science. It is an art
because there is no standard way to interpret a problem and solve it using a
standard form of programming procedures and styles. It is fast becoming a science
because standard programming practice is starting to be adopted.

Programs fall into two major classes: application programs and operating systems.
An application program is one that carries out some function directly for a user,
such as word processing or game-playing.
An operating system is a program that manages the computer and the various
resources and devices connected to it, such as RAM (random access memory), hard
drives, monitors, keyboards, printers, and modems, so that they may be used by
other programs.
A programmer uses another type of program called a text editor to write the new
program in a special notation called a programming language. With the text editor,
the programmer creates a text file, which is an ordered list of instructions, also
called the program source file. The individual instructions that make up the
program source file are called source code. At this point, a special applications
program translates the source code into machine language, or object code — a
format that the operating system will recognize as a proper program and be able to
execute.

Three types of applications programs translate from source code to object code:
compilers, interpreters, and assemblers. The three operate differently and on
different types of programming languages, but they serve the same purpose of
translating from a programming language into machine language.
A compiler translates text files written in a high-level programming language—such
as Fortran, C, or Pascal— from the source code to the object code all at once.

Computer is composed of:


1. CPU (Central Processing Unit) – this is where all mathematical and logical forms
of processing are done on data.
2. Memory – before a computer can do any productive work such as programming,
it has to remember things such as data it needs to produce information.
3. Input and Output Device – data have to come into the computer by first entering
them through input devices.

7 | Page
Ex. Keyboard. After the computer executes a program to process data and produce
information, this information remains in the memory. Part of the program has to
show these results to the outside world. Output devices such as monitor screen
and printers are used to display the results to the user.
4. Software – computers today come bundled with some software already installed
in them. Operating System – performs for the programmer many tasks that used to
be very difficult to program.

Two forms of Memory


• Internal memory (RAM-Random Access Memory) – stores programs and data that
are executed and processed by the computer.
• Secondary memory – supplements RAM so those computers are able to
permanently save programs and data that are not yet needed for execution and
processing. Ex. Floppy disk, hard disk & etc.

The following are standard Operating System functions


•Validating user identification every time the user uses the computer.
•Provides standard functions like editor, compilers and linkers.
•Manages files of the user by providing functions like Copy, Delete, and Append.

The following are standard Operating System functions


•Retrieves data out of data files
•Manages memory for the user by determining where in the memory a program is
to be loaded every time it is called to run
•Makes communication between the CPU, Memory and input/output devices
transparent to the user or the user are unaware of these things while they are at
work.

Each of these programming languages was designed to solve particular kinds of


problems.
• COBOL – Common Business Oriented Language was designed to solve business
problems like accounting.
• FORTRAN – Formula Translation is a high level language used for scientific and
engineering applications.
• Pascal and C – are general-purpose language. They are high-level language but
they can be embedded with assembly language code effectively making these
languages middle-level languages.
C language is responsible in the implementation of major software including
operating systems, compilers and software development tools.

8 | Page
The Simplest computer programs perform three basic operations:
• get the input from the keyboard
• process the input data
• display the results on the screen

High Level Language vs Low Level language

High-level language

● It can be easily interpreted as well as compiled in comparison to low-level language.

● It can be considered as a programmer-friendly language.

● It is easy to understand.

● It is easy to debug.

● It is simple in terms of maintenance.

● It requires a compiler/interpreter to be translated into machine code.

● It can be run on different platforms.

● It can be ported from one location to another.

● It is less memory efficient, i.e it consumes more memory in comparison to low-level


languages.
● Examples of high level languages include C, C++, Java, Python.

● It is used widely in today's times.


Low-level language

● It is also known as machine level language.

● It can be understood easily by the machine.

● It is considered as a machine-friendly language.

● It is difficult to understand.

● It is difficult to debug.

● Its maintenance is also complex.

9 | Page
● It is not portable.

● It depends on the machine; hence it can't be run on different platforms.

● It requires an assembler that would translate instructions.

● It is not used widely in today's times.

Below is a table of differences between High-Level and Low-Level programming languages

High-Level Language Low-level language

It can be considered as a programmer- It is considered as a machine-friendly


friendly language. language.

It requires a compiler/interpreter to be It requires an assembler that would


translated into machine code. translate instructions.

It can be ported from one location to It is not portable.


another.

It is easy to understand. It is difficult to understand.

It is easy to debug. It is difficult to debug.

It is less memory efficient, i.e., it It consumes less memory.


consumes more memory in comparison
to low-level languages.

Machine Language vs Assembly Language

10 | Page
Machine language is the low level programming language. Machine language can only be
represented by 0s and 1s. In earlier when we have to create a picture or show data on the
screen of the computer then it is very difficult to draw using only binary digits(0s and 1s). For
example: To write 120 in the computer system its representation is 1111000. So it is very
difficult to learn. To overcome this problem the assembly language is invented.

Assembly language is the more than low level and less than high-level language so it is
intermediary language. Assembly languages use numbers, symbols, and abbreviations instead
of 0s and 1s.For example: For addition, subtraction and multiplications it uses symbols likes
Add, sub and Mul, etc.

Below is a table of differences between Machine Language and Assembly Language:

Machine Language Assembly Language

Assembly language is only understand


Machine language is only understand by by human beings not by the
the computers. computers.

In machine language data only In assembly language data can be


represented with the help of binary represented with the help of
format(0s and 1s), hexadecimal and mnemonics such as Mov, Add, Sub,
octadecimal. End etc.

Assembly language is easy to


Machine language is very difficult to understand by the human being as
understand by the human beings. compare to machine language.

Modifications and error fixing cannot be Modifications and error fixing can be
done in machine language. done in assembly language.

Machine language is very difficult to Easy to memorize the assembly

11 | Page
Machine Language Assembly Language

memorize so it is not possible to learn language because some alphabets and


the machine language. mnemonics are used.

Execution is fast in machine language


because all data is already present in Execution is slow as compared to
binary format. machine language.

There is no need of translator.The Assembler is used as translator to


machine understandable form is the convert mnemonics into machine
machine language. understandable form.

Machine language is hardware Assembly language is the machine


dependent. dependent and it is not portable.

Procedural vs Object Oriented Programming

Procedural Programming

Procedural Programming can be defined as a programming model which is derived from


structured programming, based upon the concept of calling procedure. Procedures, also
known as routines, subroutines or functions, simply consist of a series of computational steps
to be carried out. During a program’s execution, any given procedure might be called at any
point, including by other procedures or itself.

Languages used in Procedural Programming:


FORTRAN, ALGOL, COBOL,
BASIC, Pascal and C.

Object Oriented Programming

Object oriented programming can be defined as a programming model which is based upon
the concept of objects. Objects contain data in the form of attributes and code in the form of
methods. In object oriented programming, computer programs are designed using the
concept of objects that interact with real world. Object oriented programming languages are

12 | Page
various but the most popular ones are class-based, meaning that objects are instances of
classes, which also determine their types.
Languages used in Object Oriented Programming:
Java, C++, C#, Python,
PHP, JavaScript, Ruby, Perl,
Objective-C, Dart, Swift, Scala.

Below is a table of differences between Procedural Programming and Object Oriented


Programming

Procedural Oriented Programming Object Oriented Programming

In object oriented
programming, program is
In procedural programming, program is divided into small parts
divided into small parts called functions. called objects.

Procedural programming follows top down Object oriented programming


approach. follows bottom up approach.

Object oriented programming


There is no access specifier in procedural have access specifiers like
programming. private, public, protected etc.

Adding new data and function


Adding new data and function is not easy. is easy.

13 | Page
Procedural Oriented Programming Object Oriented Programming

Procedural programming does not have any Object oriented programming


proper way for hiding data so it is less provides data hiding so it
secure. is more secure.

In procedural programming, overloading is Overloading is possible in


not possible. object oriented programming.

In object oriented
In procedural programming, function is more programming, data is more
important than data. important than function.

Procedural programming is based on unreal Object oriented programming


world. is based on real world.

Examples: C++, Java, Python,


Examples: C, FORTRAN, Pascal, Basic etc. C# etc.

REFERENCES

1. Abraham (2015). Coding for dummies. John Wiley and Sons: Hoboken, NJ
2. Zak, D (2015). An Introduction to Programming with C++. 8th Edition
3. Cadenhead, R et. Al. (2016). C++ in 24 Hours, Sams Teach Yourself (6th Edition). Sams
Publishing
4. McGrath, M. (2017). C++ programming in easy steps (5th ed.). Warwickshire, United
Kingdom: Easy Steps Limited
5. Tale, T. (2016). C++: The Ultimate Beginners Guide to C++ Programing. CreateSpace
Independent Publishing Platform

14 | Page
15 | Page
MODULE TWO

16 | Page
INTRODUCTION
Module two covers all the important terms in writing, reading, and interpreting algorithms,
Flow charts and pseudocode and their components.
LEARNING OUTCOMES:
● what defines an algorithm, how to represent algorithms, and what makes
algorithms efficient.
● Explain what a flow chart is and its components

● Explain what a pseudocode is

LESSON 1: PROGRAM LOGIC, DESIGN AND FORMULATION

▪LEARNING OBJECTIVES:
Upon completion of the course, the student should be able to:
● To understand algorithms

● To Create a flowchart

● To write a pseudocode

● To understand the flow of command in a program

ALGORITHMS - a set of instructions for solving a problem.

Consider the following three examples. What do they all have in common?

17 | Page
Each of these examples are algorithms, a set of instructions for solving a problem. Once we
have created an algorithm, we no longer need to think about the principles on which the
algorithm is based. For example, once you have the directions to John's house, you do not
need to look at a map to decide where to make the next turn. The intelligence needed to find
the correct route is contained in the algorithm. All you have to do is follow the directions. This
means that algorithms are a way of capturing intelligence and sharing it with others. Once you
have encoded the necessary intelligence to solve a problem in an algorithm, many people can
use your algorithm without needing to become experts in a particular field.

PSEUDOCODE – is one method of designing or planning a program. Pseudo means false,


thus pseudocode means false code. A better translation would be the word fake or
imitation. Pseudocode is fake (not the real thing). It looks like (imitates) real code but it is NOT
real code. It uses English statements to describe what a program is to accomplish. It is fake
because no complier exists that will translate the pseudocode to any machine
language. Pseudocode is used for documenting the program or module design (also known
as the algorithm).

18 | Page
The following outline of a simple program illustrates pseudocode. We want to be able to enter
the ages of two people and have the computer calculate their average age and display the
answer

After developing the program design, we use the pseudocode to write code in a language (like
Pascal, COBOL, FORTRAN, "C", " C++", etc.) where you must follow the rules of the language
(syntax) in order to code the logic or algorithm presented in the pseudocode. Pseudocode
usually does not include other items produced during programming design such as identifier
lists for variables or test data.

FLOWCHART - is a type of diagram that represents an algorithm, workflow or process. The


flowchart shows the steps as boxes of various kinds, and their order by connecting the boxes
with arrows. This diagrammatic representation illustrates a solution model to a given
problem. Flowcharts are used in analyzing, designing, documenting or managing a process or
program in various fields.

19 | Page
Simple Flowcharting Symbols

Terminal

The Ovals, or terminal points, indicate the flowchart’s starting and ending points

Flow Lines

Represents the flow of the sequence.

Input/Output

The parallelograms designate input or output operations

20 | Page
Process

The rectangle depicts a process such as a mathematical computation, or a variable


assignment.

Decision

The diamond is used to represent the true/false statement being tested in a decision symbol.

Connectors

Sometimes a flowchart is broken into two or more smaller flowcharts. This is usually done
when a flowchart does not fit on a single page, or must be divided into sections. A connector
symbol, which is a small circle with a letter or number inside it, allows you to connect two
flowcharts on the same page. A connector symbol that looks like a pocket on a shirt, allows
you to connect to a flowchart on a different page.

On-Page Connector Off-Page Connector

21 | Page
Reference
● Programming Fundamentals A Modular Structured Approach, 2nd Edition,
KENNETH LEROY BUSBEE AND DAVE BRAUNSCHWEIG
● cnx.org: Programming Fundamentals – A Modular Structured Approach using C+
+
● Online Interactive Modules for Teaching Computer Science Osman Balci
William S. Gilley, Robin J. Adams, Emre Tunar, N. Dwight Barnette Department of
Computer Science 660 McBryde Hall, MC 0106 Virginia Tech Blacksburg, VA
24061, U.S.A

22 | Page

You might also like