Professional Documents
Culture Documents
A COMPILATION
OF LECTURES &
ACTIVITIES
Table of Contents
Table of Contents........................................................................................................................ 1
Disclaimer ..................................................................................................................................... 1
CHAPTER 1: Introduciton to Computer Programming ...................................................... 1
Module Overview .................................................................................................................... 2
Learning Outcomes ................................................................................................................ 2
Pre-Test ..................................................................................................................................... 3
Module Map .............................................................................................................................. 5
Definition of Key Terms / Unlocking of Difficulties ........................................................ 6
Introduction .............................................................................................................................. 7
LESSON 1: History of Computer Programming .............................................................. 8
Synthesis ................................................................................................................................ 10
Supplementary Learning Resources................................................................................ 11
Self-Assessment Questions 1-1 ............................................ Error! Bookmark not defined.
LESSON 2: Generations of Computer Programming Languages .............................
12 2.1. First Generation Language (Machine language) ........................................... 12
2.2. Second Generation Language (Assembly Language) ................................. 12 2.3.
Third Generation Languages (High-Level Languages) ............................... 13 2.4.
Fourth Generation Language (Very High-level Languages)....................... 13 2.5.
Fifth Generation Language (Artificial Intelligence Language) ................... 14
Supplementary Learning Resources................................................................................ 14
Self-Assessment Questions 2-1 ............................................ Error! Bookmark not defined.
LESSON 3: Programming Concepts ................................................................................ 15
3.1. Source code ........................................................................................................... 15
3.2. Compiler ................................................................................................................. 15
3.3. Data type ................................................................................................................. 15
3.4. Variable ................................................................................................................... 15
3.5. Constant ................................................................................................................. 15
3.6. Conditional ............................................................................................................. 15
3.7. Array ........................................................................................................................ 16
1
Self-Assessment Questions 3-1 ........................................................................................ 18
LESSON 4: Program Development Life Cycle ............................................................... 17
4.1 Problem Definition................................................................................................. 17
4.2 Problem Analysis................................................................................................... 18
4.3 Algorithm Development ....................................................................................... 18
4.4 Coding & Documentation .................................................................................... 18
4.5 Testing & Debugging ............................................................................................ 18
4.6 Maintenance ............................................................................................................ 18
Supplementary Learning Resources................................................................................ 18
Self-Assessment Questions 4-1 ............................................ Error! Bookmark not defined.
Post-Test ................................................................................................................................. 19
Assignment ................................................................................ Error! Bookmark not defined.
CHAPTER 2: PROGRAM DESIGN TOOLS .............................. Error! Bookmark not
defined.
Module Overview ...................................................................... Error! Bookmark not defined.
Learning Outcomes .................................................................. Error! Bookmark not defined.
Pre-Test ....................................................................................... Error! Bookmark not defined.
Module Map ................................................................................ Error! Bookmark not defined.
Definition of Key Terms / Unlocking of Difficulties .......... Error! Bookmark not defined.
Introduction ................................................................................ Error! Bookmark not defined.
LESSON 1: Algorithm .............................................................. Error! Bookmark not defined.
1.1. What is an algorithm? ............................................. Error! Bookmark not defined.
1.2. Characteristics of algorithm .................................. Error! Bookmark not defined.
1.3. Advantages of algorithm ........................................ Error! Bookmark not defined.
1.4. How to write algorithms .......................................... Error! Bookmark not defined.
Supplementary Learning Resources.................................... Error! Bookmark not defined.
Test Yourself 2-1-1 .................................................................... Error! Bookmark not defined.
LESSON 2: Pseudocode.......................................................... Error! Bookmark not defined.
2
3.3 Advantages of Flowchart ........................................ Error! Bookmark not defined.
3.4 Limitations of Using a Flowchart .......................... Error! Bookmark not defined.
3.5 Rules for Flowchart .................................................. Error! Bookmark not defined.
3.6 General Rules for flowcharting ............................. Error! Bookmark not defined.
3.7 Basic Control Structures ........................................ Error! Bookmark not defined.
Supplementary Learning Resources.................................... Error! Bookmark not defined.
Test Yourself 2-2-1 .................................................................... Error! Bookmark not defined.
Learning Activity 2-1 ................................................................ Error! Bookmark not defined.
Synthesis .................................................................................... Error! Bookmark not defined.
Post-Test ..................................................................................... Error! Bookmark not defined.
Assignment ................................................................................ Error! Bookmark not defined.
CHAPTER 3: INTRODUCTION TO JAVA PROGRAMMING .. Error! Bookmark not
defined.
Module Overview ...................................................................... Error! Bookmark not defined.
Learning Outcomes .................................................................. Error! Bookmark not defined.
Module Map ................................................................................ Error! Bookmark not defined.
Pre-Test ....................................................................................... Error! Bookmark not defined.
Introduction ................................................................................ Error! Bookmark not defined.
LESSON 1: The Java Programming Language .................. Error! Bookmark not
defined.
3
Supplementary Learning Resources.................................... Error! Bookmark not defined.
Test Yourself 3-5 ....................................................................... Error! Bookmark not defined.
LESSON 6: Applications of Java ........................................... Error! Bookmark not defined.
Supplementary Learning Resources.................................... Error! Bookmark not defined.
LESSON 7: Java Terminologies ............................................ Error! Bookmark not defined.
Supplementary Learning Resources.................................... Error! Bookmark not defined.
Test Yourself 3-7 ....................................................................... Error! Bookmark not defined.
8.1 Text Editor and Console ......................................... Error! Bookmark not defined.
8.2 Graphical User Interface Environment (Eclipse-Window Builder) ....... Error!
Bookmark not defined.
Synthesis .................................................................................... Error! Bookmark not defined.
Supplementary Learning Resources.................................... Error! Bookmark not defined.
Test Yourself 3-8 ....................................................................... Error! Bookmark not defined.
Post-Test ..................................................................................... Error! Bookmark not defined.
Assignment ................................................................................ Error! Bookmark not defined.
Disclaimer
This learning material is used in compliance with the flexible teaching-learning approach
espoused by CHED in response to the pandemic that has globally affected educational institutions.
Authors and publishers of the contents are well acknowledged. As such, the college and its faculty
do not claim ownership of all sourced information. This learning material will solely be used for
instructional purposes not for commercialization.
1
Catanduanes State University College of Information and Communications Technology
MODULE 1: Introduciton to Computer Programming
Chapter 1
Introduction
to
Computer
Programming
2
Catanduanes State University College of Information and Communications Technology
Module Overview
This module provides lecture on the introduction to computer programming. It covers the
lessons on programming concepts, generation of programming languages, and program
development life cycle.
Learning Outcomes
3
Catanduanes State University College of Information and Communications Technology
Pre-Test
I. Identification. Select the best answer from the choices below. Write your answer for
each item on the space provided before the number.
II. True or False. Write TRUE if the statement is correct, otherwise write FALSE.
III. Enumeration.
1. ______________________ 4. ____________________
2. ______________________ 5. ____________________
3. ______________________
4
Catanduanes State University College of Information and Communications Technology
6. ______________________ 8. ____________________
7. ______________________ 9. ____________________
5
Catanduanes State University College of Information and Communications Technology
Module Map
summarize the
history of
programming
languages.
6
Catanduanes State University College of Information and Communications Technology
Definition of Key Terms / Unlocking of Difficulties
Programming Language. The programmer uses this tool to write or code programs.
7
Catanduanes State University College of Information and Communications Technology
Introduction
Do you know what a programming is? Have you seen a computer program?
The term programming means to create (or develop) software, which is also called a
program. In basic terms, software contains the instructions that tell a computer—or a
computerized device—what to do.
Software is all around you, even in devices that you might not think would need it. Of
course, you expect to find and use software on a personal computer, but software also plays a
role in running airplanes, cars, cell phones, and even toasters. On a personal computer, you
use word processors to write documents, Web browsers to explore the Internet, and e-mail
programs to send and receive messages. These programs are all examples of software.
Software developers create software with the help of powerful tools called programming
languages.
If you learn to program using one language, you should find it is easier for you to learn
other programming languages. The key is to learn how to solve problems using a
programming approach.
The first computer programming language was created in 1883, when Ada Lovelace
worked with Charles Babbage on his very early mechanical computer, the Analytical Engine.
While Babbage was concerned with simply computing numbers, Lovelace saw that the
numbers the computer worked with could represent something other than just amounts of
things. She wrote an algorithm for the Analytical Engine that was the first of its kind. Because of
her contribution, Lovelace is credited with creating the first computer programming language.
As different needs have arisen and new devices have been created, many more languages
have followed.
1883: Algorithm for the Analytical Engine: Created by Ada Lovelace for Charles
Babbage’s Analytical Engine to compute Bernoulli numbers, it’s considered to be the first
computer programming language.
1949: Assembly Language: First widely used in the Electronic Delay Storage
Automatic Calculator, assembly language is a type of low-level computer programming
language that simplifies the language of machine code, the specific instructions needed to tell
the computer what to do.
1952: Autocode: Autocode was a generic term for a family of early computer
programming languages. The first was developed by Alick Glennie for the Mark 1 computer at
8
Catanduanes State University College of Information and Communications Technology
the University of Manchester in the U.K. Some consider autocode to be the first compiled
computer programming language, meaning that it can be translated directly into machine code
using a program called a compiler.
1958: Algol: Created by a committee for scientific use, Algol stands for Algorithmic
Language. Algol served as a starting point in the development of languages such as Pascal, C,
C++, and Java.
1959: LISP: Created by John McCarthy of MIT, LISP is still in use. It stands for LISt
Processing language. It was originally created for artificial intelligence research but today can
be used in situations where Ruby or Python are used.
1970: Pascal: Developed by Niklaus Wirth, Pascal was named in honor of the French
mathematician, physicist, and philosopher Blaise Pascal. It is easy to learn and was originally
created as a tool for teaching computer programming. Pascal was the main language used for
software development in Apple’s early years.
1972: Smalltalk: Developed by Alan Kay, Adele Goldberg, and Dan Ingalls at Xerox
Palo Alto Research Center, Smalltalk allowed computer programmers to modify code on the fly
and also introduced other aspects now present in common computer programming languages
including Python, Java, and Ruby.
1972: SQL: SQL was developed by Donald D. Chamberlin and Raymond F. Boyce at
IBM. SQL stands for Structured Query Language. It is used for viewing and changing
information that is stored in databases. SQL uses command sentences called queries to add,
remove, or view data.
1978: MATLAB: Developed by Cleve Moler. MATLAB stands for Matrix Laboratory. It is
one of the best computer programming languages for writing mathematical programs and is
mainly used in mathematics, research, and education. It can also be used to create two- and
three-dimensional graphics.
1983: Objective-C: Created by Brad Cox and Tom Love, Objective-C is the main
computer programming language used when writing software for macOS and iOS, Apple’s
operating systems.
1983: C++: C++ is an extension of the C language and was developed by Bjarne
Stroustrup. It is one of the most widely used languages in the world. C++ is used in game
9
Catanduanes State University College of Information and Communications Technology
engines and high-performance software like Adobe Photoshop. Most packaged software is still
written in C++.
1987: Perl: Perl was originally developed by Larry Wall in 1987 as a scripting language
designed for text editing. Its purpose was to make report processing easier. It is now widely
used for many purposes, including Linux system administration, Web development, and
network programming.
1990: Haskell: Named after Haskell Brooks Curry, an American logician and
mathematician. Haskell is called a purely functional computer programming language, which
basically means that it is mostly mathematical. It is used by many industries, especially those
that deal with complicated calculations, records, and number-crunching.
1991: Python: Designed by Guido Van Rossum, Python is easier to read and requires
fewer lines of code than many other computer programming languages. It was named after the
British comedy group Monty Python. Popular sites like Instagram use frameworks that are
written in Python.
1995: Java: Originally called Oak, Java was developed by Sun Microsystems. It was
intended for cable boxes and hand-held devices but was later enhanced so it could be used to
deliver information on the World Wide Web. Java is everywhere, from computers to
smartphones to parking meters. Three billion devices run Java!
1995: PHP: Created by Rasmus Lerdorf, PHP is used mostly for Web development and
is usually run on Web servers. It originally stood for Personal Home Page, as it was used by
Lerdorf to manage his own online information. PHP is now widely used to build websites and
blogs. WordPress, a popular website creation tool, is written using PHP.
1995: Ruby: Ruby was created by Yukihiro “Matz” Matsumoto, who combined parts of
his favorite languages to form a new general-purpose computer programming language that
can perform many programming tasks. It is popular in Web application development. Ruby
code executes more slowly, but it allows for computer programmers to quickly put together and
run a program.
1995: JavaScript: Created in just 10 days by Brendan Eich, this language is mostly
used to enhance many Web browser interactions. Almost every major website uses Javascript.
2000: C#: Developed by Microsoft with the goal of combining the computing ability of
C++ with the simplicity of Visual Basic, C# is based on C++ and is similar to Java in many
aspects. It is used in almost all Microsoft products and is primarily used for developing desktop
applications.
2003: Groovy: Developed by James Strachan and Bob McWhirter, Groovy is derived
from Java and improves the productivity of developers because it is easy to learn and concise.
2009: Go: Go was developed by Google to address problems that can occur in large
software systems. Since computer and technology use is much different today than it was when
languages such as C++, Java, and Python were introduced and put to use, problems arose
10
Catanduanes State University College of Information and Communications Technology
when huge computer systems became common. Go was intended to improve the working
environment for programmers so they could write, read, and maintain large software systems
more efficiently.
2014: Swift: Developed by Apple as a replacement for C, C++, and Objective-C, Swift
is supposed to be easier to use and allows less room for mistakes. It is versatile and can be
used for desktop and mobile apps and cloud services.
Most computer programming languages were inspired by or built upon concepts from
previous computer programming languages. Today, while older languages still serve as a
strong foundation for new ones, newer computer programming languages make programmers’
work simpler. Businesses rely heavily on programs to meet all of their data, transaction, and
customer service needs. Science and medicine need accurate and complex programs for their
research. Mobile applications must be updated to meet consumer demands. And all these new
and growing needs ensure that computer programming languages, both old and new, will
remain an important part of modern life.
Synthesis
Computer programming is defined as telling a computer what to do through a special set
of instructions which are then interpreted by the computer to perform some task(s). These
instructions can be specified in one or more programming languages including Java, C, C++
and a lot more.
A computer goes through a set of steps whose purpose is to achieve something. These
steps are instructed to the computer by computer programs. Essentialy, computer programming
is the process by which these programs are designed and implemented.
The advantages to learning computer programming include gaining new skills, being
able to tell the computer what to do, and becoming better acquainted with computers. Computer
programming is a challenging and rewarding discipline. Whatever you plan on building, the road
ahead of you is an interesting one.
11
Catanduanes State University College of Information and Communications Technology
LESSON 2: Generations of Computer
Programming Languages
Programming languages have been developed over the year in a phased manner. Each
phase of developed has made the programming language more user-friendly, easier to use and
more powerful. Each phase of improved made in the development of the programming languages
can be referred to as a generation. The programming language in terms of their performance
reliability and robustness can be grouped into five different generations:
12
Catanduanes State University College of Information and Communications Technology
Advantages of First-Generation Language
• They are translation free and can be directly executed by the computers.
• The programs written in these languages are executed very speedily and efficiently by
the CPU of the computer system.
• The programs written in these languages utilize the memory in an efficient manner
because it is possible to keep track of each bit of data.
13
Catanduanes State University College of Information and Communications Technology
Advantages of Third Generation Programming Language
• These programming languages allow the efficient use of data by implementing the
various database.
• They require less time, cost and effort to develop different types of software
applications.
• The program developed in these languages are highly portable as compared to the
programs developed in the languages of other generation.
• These languages can be used to query the database in a fast and efficient manner.
• In this generation of language, the user can communicate with the computer system
in a simple and an easy manner.
14
Catanduanes State University College of Information and Communications Technology
LESSON 3: Programming Concepts
The concepts discussed here are essential knowledge to anyone who wants to become
skilled in computer programming. While some are not universal, these concepts are present in
most computer programming languages and/or are a fundamental part of the programming
process.
The actual text used to write the instructions for a computer program. This text is then
translated into something meaningful the computer can understand.
3.2. Compiler
A software tool that translates source code into data that the computer can
understand. Specifically, a compiler is used to turn source code into object code. The object
code is then passed through a program called a linker which turns it into an executable
program.
3.3. Data type
The classification of pieces of information in a program. The amount of different data types
varies between languages. Typically, there are data types for integers (whole numbers),
floating-point numbers (numbers with a decimal part), and single characters. To distinguish
between different data types, a computer uses special internal codes.
3.4. Variable
A container which represents a value in a program. Variables can store different types
of data including numeric values, single characters, and text strings. The value of a variable
can change all throughout a program.
3.5. Constant
The same thing as a variable with one major difference - the value of a constant does
not change, while the value of a variable can change all throughout a program.
3.6. Conditional
A set of code that will execute only if a certain condition is true. Conditionals are used
to test expressions and perform certain operations accordingly. For example, you could test a
number input by the user and if it is too high print the message "The number entered is to
high" and the program exits. Thanks to conditionals, a program can work differently every
time it runs.
15
Catanduanes State University College of Information and Communications Technology
3.7. Array
A special type of variable used in many programming and web languages including
PHP, Javascript, and Java that contains a list of related values. For example, a colors array
would contain a list of colors.
3.8. Loop
A segment of code that executes repeatedly based on a certain condition. Loops are
used to perform tasks repeatedly a certain amount of times. For example, if you needed to print
the numbers 1 to 10. You can use a loop for this task instead of manually printing all the
numbers.
3.9. Function
A set of code used to carry out specific tasks. A function can take parameters
which will affect its output as well as return values. Functions prevent unnecessary
redundancy because you can use them as much as needed instead of retyping some
code over and over. For example, if you need to multiply two numbers, instead of
doing the calculation manually every time, you can supply the data to a function
through some parameters which will do it for you.
3.10. Class
• Problem Definition
16
Catanduanes State University College of Information and Communications Technology
• Problem Analysis
• Algorithm Development
• Coding & Documentation
• Testing & Debugging
• Maintenance
In this phase, we define the problem statement and we decide the boundaries
of the problem. In this phase we need to understand the problem statement, what is
our requirement, what should be the output of the problem solution. These are
defined in this first phase of the program development life cycle.
During this phase, we develop a step by step procedure to solve the problem
using the specification given in the previous phase. This phase is very important for
program development. That means we write the solution in step by step statements.
17
Catanduanes State University College of Information and Communications Technology
we construct actual program. That means we write the program to solve the given
problem using programming languages like C, C++, Java etc.,
During this phase, we check whether the code written in previous step is
solving the specified problem or not. That means we test the program whether it is
solving the problem for various input data values or not. We also test that whether it
is providing the desired output or not.
4.6 Maintenance
During this phase, the program is actively used by the users. If any
enhancements found in this phase, all the phases are to be repeated to make the
enhancements. That means in this phase, the solution (program) is used by the end
user. If the user encounters any problem or wants any enhancement, then we need
to repeat all the phases from the starting, so that the encountered problem is solved,
or enhancement is added.
1. Alyssa joy salazar. (2014). Program Development Life Cycle [YouTube Video]. In
YouTube. https://www.youtube.com/watch?v=YV6ykfG1nQY
2. Destin Learning. (2019). What Are The Steps of the Software Development
Lifecycle? [YouTube Video]. In YouTube. https://www.youtube.com/watch?
v=gNmrGZSGK1k
3. FuseupTech. (2020). FuseupTech [YouTube Video]. In YouTube.
https://www.youtube.com/watch?v=N8q1r99CUs4
Post-Test
I. Identification. Select the best answer from the choices below. Write your answer for
each item on the space provided before the number.
18
Catanduanes State University College of Information and Communications Technology
_____________ 7. In this generation, symbolic operation codes replaced the binary
operation codes.
_____________ 8. It is the language that is understood by computers.
_____________ 9. A programming language that provides statements that are closer to the
way the humans solve problems than assembly language.
_____________ 10. She is the first woman computer programmer.
II. True or False. Write TRUE if the statement is correct, otherwise write FALSE.
III. Enumeration.
19
Catanduanes State University College of Information and Communications Technology