ict l 5 computer program
ict l 5 computer program
Program-A computer program is a set of coded instructions given to the computer and
represents a logical solution to a problem. It directs a computer in performing various
operations/tasks on the data supplied to it.
Computer programs may be written by the hardware manufacturers, Software houses, or a
programmer to solve user problems on the computer.
Programming is the process of designing a set of instructions (computer programs) that can be
used to perform a particular task or solve a specific problem.
It involves the use of special characters, signs, and symbols found in a particular programming
language to create computer instructions.
The programming process is quite extensive. It includes analyzing an application, designing a
solution, coding for the processor, testing to produce an operating program, and developing other
om
.c
The program created must specify in detail the logical steps to be taken & the method of
ea
processing the data input into the computer to carry out the specified task.
A computer program performs the following:
Source program (source code)-Refers to the program statements that the programmer enters in
the program editor window, and which have not yet been translated into machine-readable form.
Source code is the code understood by the programmer and is usually written in a high-level
language or Assembly language.
506
Object code (object program)- Refers to the program code that is in machine-readable (binary)
form.
Object code is the code the computer can understand and is produced by a Compiler or
Assembler after translating the Source program into a form that can be readily loaded into the
computer.
Language translators
A computer uses & stores information in binary form, and therefore, it cannot understand
programs written in either high-level or assembly languages. This means that any
program code written in Assembly language or high-level language must be translated
into Machine language before the computer can recognize & run these programs.
A Translator is special system software used to convert the Source codes (program
statements written in any of the computer programming languages) to their Object codes
om
The Translators reside in the main memory of the computer, and use the program code of
t
sy
ea
the high-level or Assembly language as input data, change the codes, and gives the output
program in machine-readable code.
Also, translators check for & identify some types of errors that may be present in the
program being translated, e.g., Syntax/grammatical errors. They will produce error
messages if there is a mistake in the code.
Types of language translators
i. Assembler
An Assembler translates programs written in Assembly language into machine
language that the computer can understand and execute.
Functions of an Assembler.
It checks whether the instructions are written are valid, and identifies any
errors in the program.
507
The Assembler will display these errors as well as the complete source and object
programs. If the program has no errors, the job control will let it run immediately,
or save the object program so that it may run it later without translating it again.
It assigns memory locations to the names the programmer uses.
E.g., the Assembler keeps a table of these names so that if an instruction refers to
it, the Assembler can easily tell the location to which it was assigned.
It generates the machine code equivalent to the Assembly instructions.
Usually, the Assembler generates a machine code only when no errors are
detected. Some of the errors include;
- Typing mistakes.
- Using the wrong format for instruction.
- Specifying a memory location outside the range 0 – 2047.
om
ii. Interpreter
t .c
ve
iii. Compiler
A compiler translates the entire/whole source program into object code at once
and then executes it in machine language code. These machine code instructions
can then be run on the computer to perform the particular task as specified in the
high-level program.
508
Figure 176
compiler
The process of translating a program written in a high-level source language into machine
om
For a given machine, each language requires its Compiler. E.g., for a computer to be able
t
sy
ea
to translate a program written in FORTRAN into machine language; the program must
pass through the FORTRAN compiler (which must ‘know’ FORTRAN as well as the
Machine language of the computer).
Functions of a compiler.
A Compiler performs the following tasks during the compilation process:
It identifies the proper order of processing, to execute the process as fast as
possible & minimize the storage space required in memory.
It allocates space in memory for the storage locations defined in the program to be
executed.
It reads each line of the source program & converts it into machine language.
509
It checks for Syntax errors in a program (i.e., statements which do not conform
to the grammatical rules of the language). If there are no syntax errors, it
generates machine code equivalent to the given program.
i. Linker
The linker is a computer program that links and merges various object files to make
an executable file. All these files might have been compiled by the separate
assembler.
ii. Loader
The loader is a part of the operating system and is responsible for loading executable
files into memory and execute them.
It calculates the size of a program (instructions and data) and creates memory space
for it. It initializes various registers to initiate execution.
Programming approaches
Procedural
Event-driven
Object-oriented
Internet-based
i. Procedural Programming
510
Problem is broken down into procedures, or blocks of code that perform one task each. All
procedures taken together form the whole program. It is suitable only for small programs that
have a low level of complexity.
Example − For a calculator program that does addition, subtraction, multiplication, division,
square root and comparison, each of these operations can be developed as separate procedures.
In the main program, each procedure would be invoked based on the user’s choice.
Here the solution revolves around entities or objects that are part of the problem. The solution
deals with how to store data related to the entities, how the entities behave and how they interact
with each other to give a cohesive solution.
Example − If we have to develop a payroll management system, we will have entities like
employees, salary structure, leave rules, etc. around which the solution must be built.
om
i. Event-Driven programming
t .c
ve
Event-driven programming depends upon an event loop that is always listening for the new
t
sy
ea
incoming events. The working of event-driven programming is dependent upon events. Once
event loops, then events decide what to execute and in what order. –
511
Figure 177 Event-driven programming
The internet-based programming approach is also called web programming. web programming is
a set of web site development activities in WWW (World Wide Web) based on the public
network Internet. In the simplest case, each web site includes static web pages, but usually is an
aggregation of static and dynamic web pages. The later ones link under certain rules data sources
(structured and non-structured DB) and program codes (scripts), realizing some functionality.
This combination of web pages, scripts, and DB is called a web application. The web
applications are distributed (on one or more servers), working under HTTP, and available by a
browser or non-browser client application serving as a network interface. In detail, web
programming refers to writing, markup, and coding, involved in Web site building (known as
web development), which includes web content, web client and server scripting, and network
om
security.
t .c
ve
t
Practical exercise
ABC organization has recently employed you as a program developer expert. In preparation to
develop a program to run some operations in the company, the manager in consultation with
other ICT experts has requested you to lead a team in coming up with a detailed presentation on
some of the existing programming approaches that can be utilized.
Special instructions;
a. Using your computer, make a detailed PowerPoint presentation on the following
programming approaches
i. Procedural
ii. Event-driven
iii. Object-oriented
iv. Internet-based
b. Burn your presentation in a CD to be submitted to when required.
512
6.2.1.5 Self-Assessment
1. What is the meaning of the following terms:
i. Computer program.
ii. Programming.
iii. Programming language.
2. Regarding programming, distinguish between Source program and Object code.
3. What are the function(s) of Assemblers, Interpreters, and Compilers in a computer
system?
4. What is the difference between a Compiler and an Interpreter?
Decision tree
t .c
ve
Notepad
Computer
Software
Digital instructional material including DVDs and CDs
6.2.1.7 References
Blignaut, A. S., Hinostroza, J. E., Els, C. J., & Brun, M. (2010). ICT in education policy
and practice in developing countries: South Africa and Chile compared through SITES
2006. Computers & Education, 55(4), 1552–1563.
Nagar, T. (2019, December 3). What is software and types of software with examples?
YourStory.Com. https://yourstory.com/mystory/what-software-types-examples
problem. It involves the use of special characters, signs, and symbols found in
t .c
ve
514
It reads a statement from the input, converts it to an intermediate code, executes
it, then takes the next statement in sequence.
If an error occurs, an interpreter stops execution and reports it.
Functions of a compiler
the grammatical rules of the language). If there are no syntax errors, it generates
t .c
ve
515
ea
sy
tve
t.c
om
516
6.2.2 Learning Outcome 2: Identify Program Development Methodologies
6.2.2.1 Introduction to the learning outcome
This learning outcome specifies the content of competencies required to develop a
computer program. It entails the description of program specifications, program development
cycle, various types of development methodologies and Styles of programming.
6.2.2.2 Performance Standard
6.2.2.2.1 Description of program specifications is done.
6.2.2.2.2 Application of the program development cycle is done.
6.2.2.2.3 Types of development methodologies are identified.
6.2.2.2.4 Styles of programming are identified.
517
Task 2 - specify output, How do you determine the desired output?
Processing that must take place to convert input data into output information must
correspond with the problem definition determined in task 1.
om
.c
A step-by-step logical algorithm must be determined to process the input data to output
t
ve
t
sy
information.
ea
Document the program objectives, desired outputs, needed inputs, and required processing.
After these items are documented, then step 2, program design can commence.
Agile
Crystal
Rapid Application Development
Agile
518
AGILE methodology is a practice that promotes continuous iteration of development and
testing throughout the software development lifecycle of the project. In the Agile model, both
development and testing activities are concurrent, unlike the Waterfall model.
https://youtu.be/rvTejAg_fbY
Crystal method
Crystal family is a collection of agile software development methodologies that can be used for
different software projects depending upon size, complexity, criticality, and the number of
people involved. It was developed by Alistair Cockburn in early 1990 while working at IBM. He
interviewed different teams working on different projects to find the best practices followed by
teams. He found that these teams did not follow the formal methodologies or not using specific
technology for delivering successful software. However, they communicated frequently to
om
discuss the project. On the other hand, delayed or failed project teams tried to follow formal
t .c
ve
methods with little team collaboration. This helped him to conclude that frequent communication
t
sy
among team members can improve the software success rate. According to Cockburn’s
ea
philosophy “To the extent that you can replace the written documentation with face to face
interaction, you can reduce the reliance on written ‘promissory’ notes and improve the likelihood
of delivering the system. Crystal methods focus on people and communication among people
rather than a process to frequently deliver working software.
The rapid Application Development model is based on prototyping and iterative development
with no specific planning involved. It focuses on gathering customer requirements through
workshops or focus groups, early testing of the prototypes by the customer using the iterative
concept, reuse of the existing prototypes (components), continuous integration, and rapid
delivery.
519
-The program development life cycle is a set of steps or phases that are used to develop a
program in any programming language. Generally, the program development life cycle contains
7 phases, they are as follows
i. Problem Definition
ii. Program Design
iii. Coding
iv. Debugging
v. Testing
vi. Documentation
vii. Maintenance
1. Problem Definition
2. Program Design
om
t .c
ve
Coding
t
3.
sy
ea
4. Debugging
5. Testing
6. Documentation
7. Maintenance
i. Problem Definition:
520
The first step in the process of program development is the thorough understanding and
identification of the problem for which is the program or software is to be developed.
In this step, the problem has to be defined formally.
All the factors like Input/output, processing requirement, memory requirements, error
handling, interfacing with other programs have to be taken into consideration in this
stage.
The next stage is the program design. The software developer makes use of tools like
algorithms and flowcharts to develop the design of the program.
o Algorithm
o Flowchart
iii. Coding:
om
.c
Once the design process is complete, the actual computer program is written, i.e. the
t
vet
sy
Coding is generally a very small part of the entire program development process and also
a less time-consuming activity in reality.
In this process all the syntax errors i.e. errors related to spelling, missing commas,
undefined labels etc. are eliminated.
For effective coding some of the guidelines which are applied are :
o Use of meaningful names and labels of variables,
o Simple and clear expressions,
o Modularity with emphasis on making modules generalized,
o Making use of comments and indenting the code properly,
o Avoiding jumps in the program to transfer control.
iv. Debugging:
At this stage, the errors in the programs are detected and corrected.
521
This stage of program development is an important process. Debugging is also known as
program validation.
Some common errors which might occur in the programs include:
o Un initialization of variables.
o Reversing of an order of operands.
o Confusion of numbers and characters.
o Inverting of conditions eg jumping on zero instead of on not zero.
v. Testing:
data.
t .c
vet
sy
ea
vi. Documentation:
This ensures that future modifications if required can be done easily. Also, it is required during
redesigning and maintenance.
vii. Maintenance:
Updating and correction of the program for changed conditions and field experience are
accounted for in maintenance.
Maintenance becomes essential in the following situations:
o Change in the specification,
o Change in equipment,
o Errors are found during the actual execution of the program.
522
Styles of programing
Functional Programming
Object-Oriented Programming
Modular programming
Functional Programming
Here the problem, or the desired solution, is broken down into functional units. Each unit
performs its task and is self-sufficient. These units are then stitched together to form the
complete solution.
Example − A payroll processing can have functional units like employee data maintenance,
basic salary calculation, gross salary calculation, leave processing, loan repayment
om
processing, etc.
t.c
ve
Object-Oriented Programming
t
sy
ea
Here the solution revolves around entities or objects that are part of the problem. The
solution deals with how to store data related to the entities, how the entities behave, and how
they interact with each other to give a cohesive solution.
Example − If we have to develop a payroll management system, we will have entities like
employees, salary structure, leave rules, etc. around which the solution must be built.
Modular progrmming
special instructions
523
Using your computer, develop a detailed document to be used by a newly employed
person in your organization capturing the step by step process of Program Development
Life Cycle
6.2.2.5 Self-Assessment
-You are provided with the following questions for self -assessment, attempt them and check
your responses
1. What is PDLC?
2. Which are the Three major program development approaches used in PDLC?
3. What is the difference between Functional programming and Modular Programming?
4. Why is the Design phase important in Program Development Life Cycle?
5. Which are the five common errors that can occur in a program during program
development?
om
t.c
ve
Flow charts
ea
524
Computer Hardware. (n.d.). Retrieved September 30, 2020, from
https://web.stanford.edu/class/cs101/hardware-
Lehmann, S., & Schweitzer, B. (2006). Apparatus, system, and method for creating
customized workflow documentation (United States Patent No. US20060059423A1).
Nagar, T. (2019, December 3). What is software and types of software with
examples? YourStory.Com. https://yourstory.com/mystory/what-software-types-
examples
1. What is PDLC?
.c
t
ve
525
-The design phase is also helpful for specifying hardware & system requirements. It also
allows defining complete system architecture. The output is designed to document that
acts as an input for all the subsequent PDLC phases.
5. Which Five common errors that can occur in a program during program development
Un initialization of variables.
Reversing of an order of operands.
Confusion of numbers and characters.
Inverting of conditions eg jumping on zero instead of on not zero.
om
.c
t
tve
sy
ea
526
6.2.3 Learning Outcome 3: Identify Program design
6.2.3.1 Introduction to the learning outcome
This learning outcome specifies the content of competencies required to design a
computer program. It entails the description of Program design, various approaches for
designing a program, and Program design tools.
Program design
The program design is the process that an organization uses to develop a program. It is most
often an iterative process involving research, consultation, initial design, testing, and redesign. A
program design is the plan of action that results from that process.
https://youtu.be/aXPIxUafbM8
Top – Down
Bottom-Up
Data-Driven
527
Top-Down Design Model:
Top-down programming starts by implementing the most general modules and works
toward implementing those that provide specific functionality. In the top-down model, an
overview of the system is formulated without going into detail for any part of it. Each part of it
then refined into more details, defining it in yet more details until the entire specification is
detailed enough to validate the model. if we glance at a haul as a full, it’s going to appear not
possible as a result of it’s so complicated For example: Writing a University system program,
writing a word processor. Complicated issues may be resolved victimization high down style,
conjointly referred to as Stepwise refinement where,
1. We break the problem into parts,
2. Then break the parts into parts soon and now each of the parts will be easy to do.
Bottom-Up Design Model:
In this design, individual parts of the system are specified in detail. The parts
are linked to form larger components, which are in turn linked until a complete system is
om
functionality first and then integrates them by implementing the more general modules
t
sy
ea
Data-driven approach
When doing data-driven programming, one clearly distinguishes code from the data structures
on which it acts and designs both so that one can make changes to the logic of the program by
editing not the code but the data structure.
Data-driven programming is sometimes confused with object-orientation, another style in
which data organization is supposed to be central. There are at least two differences. One is that
in data-driven programming, the data is not merely the state of some object, but defines the
control flow of the program. Where the primary concern in OO is encapsulation, the primary
concern in data-driven programming is writing as little fixed code as possible. Unix has a
stronger tradition of data-driven programming than OO.
Programming data-driven style is also sometimes confused with writing state machines. It
is, in fact, possible to express the logic of a state machine as a table or data structure, but hand-
coded state machines are usually rigid blocks of code that are far harder to modify than a table.
An important rule when doing any kind of code generation or data-driven programming is this:
always push problems upstream. Don't hack the generated code or any intermediate
528
representations by hand — instead, think of a way to improve or replace your translation tool.
Otherwise, you're likely to find that hand-patching bits that should have been generated correctly
by the machine will have turned into an infinite time sink.
I. Algorithm
Characteristics of an Algorithm
Example of an algorithm
529
2. add the ones
3. add the numbers from steps 1 and 2
II. Flowchart
om
t
Use standard symbols and arrowhead to the direction of flow of data and instructions.
ve
t
sy
530
A rectangle represents a
process process
A diamond indicates a
Decision decision
Advantages
The flowchart helps programmers to explain the logic of a program to others easily.
The flowchart provides documentation support.
A flowchart helps detect and remove bugs in a program in s systematic manner.
With the reference of the Flowchart, the programmer can write a program and correspond
om
to the program.
t .c
ve
Disadvantages
t
sy
ea
531
III. Pseudocode
These are structured English-like phrases that indicate the program steps to be followed to solve
a given problem.
om
.c
The term “Code” usually refers to a computer program. This implies that, some of the words
t
ve
t
sy
used in pseudocode may be drawn from a certain programming language and then mixed with
ea
English to form structured statements that are easily understood by non-programmers, and also
make a lot of sense to programmers. However, pseudocodes are not executable by a computer.
Decision Tables
532
A Decision table represents conditions and the respective actions to be taken to address
them, in a structured tabular format.
It is a powerful tool to debug and prevent errors. It helps group similar information into a
single table and then by combining tables it delivers easy and convenient decision-
making.
To create the decision table, the developer must follow the basic four steps:
https://youtu.be/A5-w3mof-3I
t .c
ve
Practical activity
Using your computer,prepare detailed document to be used by a newly employed person
in your organization capturing the following program design tools;
i. Pseudocodes.
ii. Flowcharts.
iii. Decision Tables.
iv. Decision Trees
6.2.3.5 Self-Assessment
1. .What is the difference between Top-Down and Bottom-Up program design approaches?
2. What is the difference between pseudocode and flowchart program design tools
3. What are some of the disadvantages of a flowchart?
4. What are the rules of developing a flowchart
5. Write a structured algorithm that would prompt the user to enter the Length and Width of a
rectangle, calculate the Area and Perimeter, then display the result.
533
6.2.3.6 Tools, Equipment, Supplies and Materials
Flow charts
Data flow diagram
Decision table
Decision tree
Web Authoring tools
Notepad
Computer
Software
Digital instructional material including DVDs and CDs
6.2.3.7 References
Blignaut, A. S., Hinostroza, J. E., Els, C. J., & Brun, M. (2010). ICT in education policy
and practice in developing countries: South Africa and Chile compared through SITES
2006. Computers & Education, 55(4), 1552–1563.
om
.c
t
ve
https://web.stanford.edu/class/cs101/hardware-
ea
Lehmann, S., & Schweitzer, B. (2006). Apparatus, system, and method for creating
customized workflow documentation (United States Patent No. US20060059423A1).
Nagar, T. (2019, December 3). What is software and types of software with examples?
YourStory.Com. https://yourstory.com/mystory/what-software-types-examples
534
up approach, individual parts of the system are specified in detail. The parts
are linked to form larger components, which are in turn linked until a complete
system is formed
2. Give the difference between pseudocode and flowchart program design tools
-pseudocode is a method of documenting a program logic in which English-like
statements are used to describe the processing steps while flowchart while is a
diagram that demonstrates the logical sequence of events that must be performed to
solve a problem.
3. What are some of the disadvantages of a flowchart?
Flowcharts are complex, clumsy & become unclear, especially when the program
logic is complex.
If changes are to be made, the flowchart may require complete re-drawing.
No uniform practice is followed for drawing flowcharts as it is used as an aid to the
program.
om
Sometimes, it becomes difficult to establish the link between various conditions, and
t .c
ve
om
t.c
ve
t
sy
ea
536
6.2.4.3 Information Sheet
Programming Languages
A programming language is a set of words, symbols, and codes that enables a programmer to
communicate a solution algorithm to the computer. Just as humans understand a variety of
spoken languages (English, Spanish, French, and so on), computers recognize a variety of
programming languages.
Each programming language has its own grammatical (syntax) rules, which must be obeyed in
order to write valid programs, just as a natural language has its own rules for forming sentences.
om
t .c
I. Low-level languages
vet
sy
ea
These are the basic programming languages, which can easily be understood by the computer
directly, or which require little effort to be translated into computer understandable form.
They include:
Machine languages.
Assembly languages.
537
Machine languages (1st Generation computer languages)
-Machine language is written using machine codes (binary digits) that consist of 0’s & 1’s.
The computer can readily understand Machine code instructions without any translation.
A programmer is required to write his program in strings of 0’s & 1’s, calculate & allocate the
Assembly languages were developed to speed up programming (i.e., to overcome the difficulties
of understanding and using machine languages).
The vocabulary of Assembly languages is close to that of machine language, and its instructions
are symbolic representations of the machine language instructions.
om
Assembly language programs are easier to understand, use & modify compared to
t .c
ve
To write program statements in Assembly language, the programmer uses a set of predefined
symbols (operation codes) called Mnemonic codes.
538
Disadvantages of Low-level languages
Very few computer programs are written in a machine or Assembly language because of
the following reasons;
Low-level languages are difficult to learn, understand, and write programs in them.
Low-level language programs are difficult to debug (remove errors from).
The programs are very long; hence, writing a program in a low-level language is usually
tedious & time-consuming.
The programs are difficult to develop, maintain, and are also prone to errors (i.e., it
requires highly trained experts to develop and maintain the programs).
Low-level languages are machine-dependent (specific), hence non-portable. This implies
that they are designed for a specific machine & specific processor, and therefore, cannot
be transferred between machines with different hardware specifications.
om
.c
t
The grammar of High-level languages is very close to the vocabulary of the natural
languages used by human beings. Hence; they can be read and understood easily even by
people who are not experts in programming.
Most high-level languages are general-purpose & problem-oriented. They allow the
programmer to concentrate on the functional details of a program rather than the details
of the hardware on which the program will run.
539
It is close to the human being
It is easy to understand
It consists of an English language like structure
It does not depend upon the machine
It is easy to modify
The programs written in high-level languages is called source code Example of high-
level languages are BASIC, PASCAL, C/C++, etc.
High-level languages are not machine-oriented; hence, they do not use the CPU
and
hardware facilities efficiently.
om
hardware directly.
tve
sy
instructions. This
means that, they use more storage space, and it also takes more time to run the
program.
Their program statements are too general; hence, they execute slowly than their
machine code program equivalents.
They have to be interpreted or compiled to machine-readable form before the
computer can execute them.
The languages cannot be used on very small computers.
The source program written in a high-level language needs a Compiler, which is
loaded into the main memory of the computer, and thus occupies much of
memory space. This greatly reduces the memory available for a source program.
540
programmer with more programming tools, such as command buttons, forms, text boxes,
etc. The programmer simply selects graphical objects called controls on the screen and
then uses them to create designs on a form by dragging a mouse pointer.
The languages also use application generators (which are in the background) to generate
the necessary program codes; hence, the programmer is freed from the tedious work of
writing the code.
-4GLs are used to enquire & access the data stored in database systems; hence, they are
described as the Query Languages such as Structured Query Languages (SQL), Report
Generators, Application Generators, Decision-support languages & Graphics languages
Access Basic
t.c
ve
t
sy
ea
541
messages to an object to perform a procedure that is already embedded in it. The
process of having data & functions that operate on the data within an object is
called encapsulation.
OOP is greatly applied in the development of GUI operating systems &
application programs.
OOP enables rapid program development. Every object has properties such as
colour, size, data source, etc, which can be set easily without much effort.
Besides, every object has events associated with it that can be used to trigger
certain actions, e.g. remove the window from the screen by clicking the ‘Close’
button.
Examples of Object-oriented programming languages are: -
Simula
C++
Smalltalk
om
Java
.c
t
ve
Python
t
sy
ea
542
the code while the program is running.
-Programs created with Visual Basic can be designed to run on Windows, on the Web, within
Office applications, or on mobile devices. Visual Studio, the most comprehensive VB
development environment, or IDE can be used to create programs for all these mediums.
Visual Studio .NET provides development tools to create programs based on the .NET
framework, such as ASP.NET applications, which are often deployed on the Web.
The following factors should be considered when choosing a Programming language to use
in solving a problem:
i. The availability of the relevant translator. Translators help in converting the Source
codes (program statements written in any of the computer programming languages) to
their Object codes (computer language equivalents).
ii. Ease of learning and use. The programming language chosen should be the one that is
om
iii. Purpose of the program, i.e., application areas such as education, business, science,
t
sy
ea
etc.
iv. Execution time: - Applications that require a quick response are best programmed in
machine code or assembly language. High-level languages are not suitable for such an
application because they take longer to be translated & executed.
v. Development time: - Development time is the time a programmer takes to write and run
a program. High-level languages are easy to read, understand and develop; hence, they
require less development time. Machine code & Assembly languages are relatively
difficult to read, understand and develop; hence, they are time-consuming.
vi. Popularity: - The language selected should be suitable and/or successful in the market
concerning the problems to be solved.
vii. Documentation: - It should have accompanying documentation (descriptions) on how
to use the language or maintain the programs written in the language.
viii. Maintenance: - Programs are developed to solve specific problems, and the problems
keep on changing; hence, the programs are also changed to perform the new functions.
Program maintenance is the activity of incorporating more routines into the program,
543
modifying the existing routines, or removing the obsolete routines to make the program
adapt to a functionally enhanced environment. The maintenance is made easier if the
language used is easy to read and understand.
The term “Code” usually refers to a computer program. This implies that some of the
t
ve
t
sy
words used in pseudocode may be drawn from a certain programming language and then
ea
mixed with English to form structured statements that are easily understood by non-
programmers, and also make a lot of sense to programmers. However, pseudocodes are
not executable by a computer.
Guidelines for designing good pseudocode.
1. The statements must be short, clear, and readable.
2. The statements must not have more than one meaning (i.e., should not be ambiguous).
3. The pseudocode lines should be clearly outlined and indented.
4. A pseudocode must have a Begin and an end.
i.e., pseudocode should show clearly the start and stop of executable statements and the
control structures.
5. The input, output & processing statements should be clearly stated using keywords such
as PRINT, READ, INPUT, etc.
Flowcharts.
544
A Flowchart is a diagram that demonstrates the logical sequence of events that must be
performed to solve a problem.
It is a diagrammatic or pictorial representation of a program’s algorithm.
Types of Flowcharts.
There are 2 common types of Flowcharts:
1). System flowchart.
A System flowchart is a graphical model that illustrates each basic step of a data
processing system.
-It illustrates (in summary) the sequence of events in a system, showing the
department or function responsible for each event.
2). Program flowchart.
This is a diagram that describes, in sequence, all the operations required to process
data in a computer program.
-A program flowchart graphically represents the types of instructions contained in a
om
545
om
t.c
ve
t
sy
ea
546
moves through. DFDs are built using standardized symbols and notation to describe
various entities and their relationships.
Data flow diagrams visually represent systems and processes that would be hard to
describe in a chunk of text. You can use these diagrams to map out an existing system
and make it better or to plan out a new system for implementation. Visualizing each
element makes it easy to identify inefficiencies and produce the best possible system.
i. You need to calculate the area of the rectangle using its length and width. Draw a
flowchart and write pseudocode that will accept the length and width and
calculate and print the area of the rectangle. (area = length * width)
om
ii. Net salaries of employees are paid after the calculation of their deductions and
t .c
ve
allowances. The following rates are used for calculating these allowances and
t
sy
6.2.4.5 Self-Assessment
You are provided with the following questions for self -assessment, attempt them
and check your responses.
547
d. Give two advantages & three disadvantages of Machine language
programming.
e. Give the features/characteristics of high-level programming languages.
f. List 8 factors that need to be considered when selecting a programming
language.
g. Write pseudocode that will accept 25 integers and displays the number of
positive and negative numbers.
h. Write a pseudocode algorithm that will create a conversion table to
convert degrees Celsius to degree Fahrenheit. Prompt the user to enter the
temperature in degree Celsius and display the temperature in Fahrenheit.
(Fahrenheit = 32+ (9*Celcius/5)
6.2.4.6 Tools, Equipment, Supplies, and Materials
Flow charts
Data flow diagram
om
Decision table
t .c
ve
Decision tree
t
sy
ea
Nagar, T. (2019, December 3). What is software and types of software with examples?
YourStory.Com. https://yourstory.com/mystory/what-software-types-examples
The machine-level language comes at the The assembly language comes above the
lowest level in the hierarchy, so it has zero machine language means that it has less
abstraction level from the hardware. abstraction level from the hardware.
It cannot be easily understood by humans. It is easy to read, write, and maintain.
The machine-level language is written in The assembly language is written in simple
binary digits, i.e., 0 and 1. English language, so it is easily
understandable by the users.
It does not require any translator as the In assembly language, the assembler is used
machine code is directly executed by the to convert the assembly code into machine
computer. code.
It is a first-generation programming It is a second-generation programming
language. language.
549
d. What are the features/characteristics of high-level programming languages.
They contain statements that have an extensive vocabulary of words,
symbols, sentences & mathematical expressions, which are very similar to
the normal English language.
Allow modularization (use of sub-routines).
550
and develop; hence, they require less development time. Machine code &
Assembly languages are relatively difficult to read, understand and develop;
hence, they are time-consuming.
Popularity: - The language selected should be suitable and/or successful in
the market concerning the problems to be solved.
Documentation: - It should have accompanying documentation (descriptions)
on how to use the language or maintain the programs written in the language.
Maintenance: - Program maintenance is the activity of incorporating more
routines onto the program, modifying the existing routines, or removing the
obsolete routines to make the program adapt to a functionally enhanced
environment. The maintenance is made easier if the language used is easy to
read and understand.
f. Write pseudocode that will accept 25 integers and displays the number of positive and
negative numbers
om
Step 1: start
t.c
ve
Step 3: for i =1 to 25
Step 3: read num
Step 4: if num>0 then
poscount = poscount +1
else
negcount = negcount +1
endif
Step 5: end for
Step 6: write poscount,negcount
g. Write a pseudocode algorithm that will create a conversion table to convert degrees
Celsius to degree Fahrenheit. Prompt the user to enter the temperature in degree Celsius
and display the temperature in Fahrenheit. (Fahrenheit = 32+ (9*Celcius/5)
solution
Step 1: start
551
Step 2: write “Enter the temperature in degrees Celcius.”
Step 3: read Celsius
Step 4: Fahrenheit =32 + (9* celcius/5)
Step 5: write “The temperature in Fahrenheit is:”
Step 6: write Fahrenheit
Step 7: stop
om
.c
t
t ve
sy
ea
552
6.2.5 Learning Outcome 5: Perform Basic Structured programming using C language.
6.2.5.1 Introduction to the learning outcome
This learning outcome specifies the content of competencies required to design a
computer program. It entails information fundamentals of C programming, Control structures in
C programming, Subprograms of C language, C language concepts, C programming
environment, description of sub programming, C program format.
C Programming Language
History of C language: -
C language has evolved from three different structured language ALGOL, BCPL, and B
Language. It uses many concepts from these languages while introduced many new concepts
such as datatypes, struct, pointer, etc. In 1988, the language was formalized by the American
553
National Standard Institute (ANSI). In 1990, a version of the C language was approved by
the International Standard Organisation (ISO) and that version of C is also referred to as
C89.
The idea behind creating C language was to create an easy language that requires a simple
compiler and enables programmers to efficiently interact with the machine/system, just like
machine instructions.
Characteristics of C language
Low Level features: C's power and fast program execution come from its ability to
t
sy
ea
access low-level commands, similar to assembly language, but with high-level syntax.
Portability: C programs are portable i.e. they can run on any compiler with little or no
modification. Compiler and Preprocessor make it possible for the C program to run it on
different PC.
Bit Manipulation: C Programs can be manipulated using bits and it provides wide
554
Efficient Usage of Pointers: C supports the efficient use of pointers and pointers have
direct memory access.
Structure of a C program
Preprocessor directives
Global declarations
Main()
{
Local declaration Statements
}
Function 1()
{
Local declaration statements
}
om
Function n()
t .c
ve
{
t
sy
ea
Preprocessor directives
Below is the list of preprocessor directives that the C programming language offers.
555
Preprocessor Syntax/Description
MACRO
Syntax: #define
This macro defines constant value and can be any of the basic data types.
COMPILATION Set of commands are included or excluded in the source program before
t.c
ve
Example
#include<stdio.h>
#include<conio.h>
int add (int a, int b);
void main()
{
...…...........
}
556
i. #include<file>variant used for system header files.(searches for a file named file in a list of
directives.
ii. #include –used to paste code of a given file into the current one.
iii. #define macros –a segment of code used to replace the value of a macro.
iv. #undef –used to cancel the definition of a macro.
v. #ifndef-checks if a macro is not defined.
vi. #define const –used to define a constant
vii. #include<math.h> -a preprocessor directive used to add math libraries to a program.
Input
-The process of giving something to the computer is known as input. Input is mostly given
through the keyboard. Input functions are:
om
Scanf ()
t .c
ve
Gets ()
t
sy
ea
Getch ()
Getche ()
Output
The process of getting something from the computer is known as output. The output is mostly
displayed on monitors. Output functions are:
print ()
puts()
The functions used for input and output are stored in the header file stdio. h. If the programmer
uses any of the above function it is necessary to include the header file.
C keywords
They are reserved words with predefine meaning to the compiler. They include:
557
Table 44 C keywords
auto double int struct
do if static while
om
t .c
ve
t
sy
ea
Variables
Instead of remembering the complex address of that memory space where we have stored our
data, our operating system provides us with an option to create folders, name them, so that it
becomes easier for us to find it and access it.
Similarly, in C language, when we want to use some data value in our program, we can store
it in a memory space and name the memory space so that it becomes easier to access it.
Unlike constant, variables are changeable, we can change the value of a variable during
execution of a program. A programmer can choose a meaningful variable name.
558
Example: Height, age, are the meaningful variables that represent the purpose it is being used
for. Height variable can be used to store a height value. Age variable can be used to store the
age of a person
Datatype of Variable
Data types specify how we enter data into our programs and what type of data we enter. C
om
language has some predefined set of data types to handle various kinds of data that we can use in
t .c
ve
There are four data types in the C language. They are, It can be:
Table 45 C datatypes
559
Integer data type allows a variable to store numeric values.
The “int” keyword is used to refer to an integer data type.
The storage size of the int data type is 2 or 4 or 8 bytes.
It varies depending upon the processor in the CPU that we use. If we are using a 16-bit
processor, 2 bytes (16 bit) of memory will be allocated for the int data type.
Likewise, 4 byte (32 bit) of memory for 32 bit processor and 8 byte (64 bit) of memory
for 64 bit processor is allocated for int datatype.
int (2 byte) can store values from -32,768 to +32,767
int (4 byte) can store values from -2,147,483,648 to +2,147,483,647.
If you want to use the integer value that crosses the above limit, you can go for “long int” and
“long int” for which the limits are very high.
Storage size of character data type is 1. We can store only one character using a character data
t
sy
type.
ea
For example, ‘A’ can be stored using char datatype. You can’t store more than one character
using a char data type.
Please refer C – Strings topic to know how to store more than one characters in a variable.
1. float
2. double
Float:
560
Storage size of float data type is 4. This also varies depending upon the processor in the CPU
as “int” data type.
We can use up to 6 digits after decimal using float data type.
For example, 10.456789 can be stored in a variable using a float data type.
Double:
A double data type is also the same as float data type which allows up to 10 digits after the
decimal.
The range for double datatype is from 1E–37 to 1E+37.
i. Arithmetic Operators
t.c
* Multiplication
/ Division
561
% Remainder after division (modulo division)
++ a; //pre increment
Assignment Operators:
om
.c
t
1. Simple Assignment
2. Compound Assignment
Simple Assignment
= Assignment Operator
e.g. x=5
5 is assigned to x
Compound Assignment
+= a += b is equivalent to a = a + b
-= a -= b is equivalent to a = a - b
562
*= a *= b is equivalent to a = a * b
/= a /= b is equivalent to a = a / b
%= a %= b is equivalent to a = a % b
|= a |= b is equivalent to a = a | b
^= a ^= b is equivalent to a = a ^ b
Relational Operators:
Relational Operators are used to check the relationship between two operands. If
om
the relation is
t.c
ve
t
sy
true, it returns value 1 and if the relation is false, it returns value 0. Relational
ea
== Equal to
!= Not equal to
563
5 != 3 returns true or 1
Logical Operators:
logical operators:
|| Logical OR
! Logical NOT
Conditional Operator:
564
The conditional operator takes three operands and consists of two symbols? and.
Conditional
If c is greater than 0, the value of c will be 10 but, if c is less than 0, the value of c
will be 20.
Bitwise Operators:
| Bitwise OR
t
sy
ea
^ Bitwise Exclusive OR
C expressions
565
An expression is a formula in which operands are linked to each other by the use of
operators to compute a value. An operand can be a function reference, a variable, an array
element, or a constant.
Types of C Expressions .c
om
Arithmetic Expressions
t
ve
t
sy
ea
When an expression contains only integral operands, then it is known as pure integer
expression when it contains only real operands, it is known as pure real expression, and
when it contains both integral and real operands, it is known as mixed-mode expression
Example
566
6*2/(2+2/3 + 6) + 8 2 is multiplied by 1, giving value 2.
* (8/4)
Relational Expressions
It is a condition that is used to decide whether the action should be taken or not.
t .c
o In relational expressions, a numeric value cannot be compared with the string value.
ve
t
sy
ea
o The result of the relational expression can be either zero or non-zero value. Here, the zero
value is equivalent to a false, and the non-zero value is equivalent to a true.
Relational Description
Expression
x%2 = = 0 This condition is used to check whether the x is an even number or not. The
relational expression results in value 1 if x is an even number otherwise results in
value 0.
a!=b It is used to check whether a is not equal to b. This relational expression results in
1 if a is not equal to b otherwise 0.
a+b = = x+y It is used to check whether the expression "a+b" is equal to the expression "x+y".
a>=9 It is used to check whether the value of a is greater than or equal to 9.
Logical Expressions
567
Let's see some examples of logical expressions.
Logical Description
Expressions
( x > 4 ) It is a test condition to check whether the x is greater than 4 and x is less
&& ( x < 6 than 6. The result of the condition is true only when both conditions are
) true.
! ( x > 10 ) It is a test condition used to check whether x is not greater than 10 and y is
&& ( y = = equal to 2. The result of the condition is true if both conditions are true.
2)
om
t.c
ve
t
sy
Conditional Expressions
ea
exp1 ? exp2 : ex
Control structures
Control structures are blocks of statements that determine how program statements are to be
executed.
568
-Control statements deal with situations where processes are to be repeated several numbers of
There are 3 control structures used in most of the structured programming languages:
i. Sequence.
ii. Selection.
iii. Iteration (looping).
-In Sequence program execution, the program statements are executed one after another in the
order in which they are written. In other words, the computer reads instructions from a program
file line-by-line starting from the first line sequentially towards the end of the file.
om
.c
t
tve
sy
569
There are 4 types of selection control structures used in most high-level programming.
languages:
a. IF – THEN
b. IF – THEN – ELSE
c. Nested IF
d. CASE – OF
IF – THEN
IF – THEN structure is used if only one option is available, i.e., it is used to perform a
certain action if the condition is true but does nothing if the condition is false.
The general format of the IF-THEN structure is:
IF < Condition > THEN
Program statement to be executed if the condition is true;
om
ENDIF
t .c
If the condition is TRUE, the program executes the part following the keyword ‘THEN’.
ve
t
sy
If the condition is FALSE, the statement part of the structure is ignored, and the program
ea
continues.
with the statements below the ENDIF.
Example
In a school, the administration may decide to reward only those students who attain a
mean mark of 80% and above.
Pseudocode
IF Mark > 80 THEN
Yes Print “ Give reward”
ENDIF
IF – THEN -ELSE
The IF-THEN-ELSE structure is suitable when there are 2 available options to select
from.
570
The general format of the IF-THEN-ELSE structure is:
IF < Condition > THEN
Statement 1; (called the THEN part)
ELSE
Statement 2; (called the ELSE part)
ENDIF (indicates the end of the control structure)
NESTED IF
-Nested IF structure is used where 2 or more options have to be considered to make a
selection.
The general format of the Nested IF structure is:
IF < Condition 1 > THEN
Statement 1
ELSE
om
Statement 2
t
sy
ea
ELSE
571
The general format of the CASE structure is:
CASE Expression OF
Label 1: statement 1
Label 2: statement 2
Label 3: statement 3
.
.
Label n: statement n
ELSE
Statement m
ENDCASE
-Looping refers to the repeated execution of the same sequence of statements to process
t
tve
sy
individual data.
ea
-The program is designed to execute the same group of statements repeatedly for a
specified number of times or until a certain condition is met/satisfied.
2). Loop control, which specifies the number of times the loop body is to be repeated.
Consider following the link below for further reading on Loop Structures
https://youtu.be/qUPXsPtWGoY
Subprograms
-Also called sub procedures – a group of statements that together perform a given task. They are:
572
Procedures and functions
Global variables
Local variables
Call by value
Call by reference
C program format
Structure of c language
om
.c
# include<stdio.h>
void main (void)
{
print (“ ”);
getch();
}
#preprocessor
This symbol directs the compiler that content on this line is already processed.
include
This directive indicates that the standard library object file has to be attached to the program.
<stdio.h>
This is a header file which contains instruction for the predefined functions of the language.
573
Standard input/output header file contains the instruction for getting and displaying data on a
screen.
Main Function
This directs the compiler to start the compiling from the point.
program.
t
t ve
sy
ea
{} Delimiters
The body of the program is written in between these delimiters.
Body of program
Body of the program consists of statements or a set of statements. Each statement ends
with a semicolon (;) known as terminator which tells the compiler where one statement is
ended.
Printf(" ")
Printf() function is used to display content written in double-quotes on screen.
574
6.2.5.4 Learning Activities
Practical activity
Using your personal computer, perform the following activity
A class trainer designed a simple program that would help her do the following:
(a) Enter marks obtained in 4 subjects and calculate the average marks for each student.
(b) Depending on the Average mark obtained, the program should assign grade as follows:
Between 80 and 100 – A
Between 70 and 79 – B
Between 60 and 69 – C
Between 50 and 59 – D
Below 50 – E
(c) The program should then display the Average grade.
Using pseudocode and a flowchart, write an algorithm that shows the design of the program.
om
t.c
ve
6.2.5.6 Self-Assessment
t
sy
ea
You are provided with the following questions for self -assessment, attempt them and
check your responses
a) C keywords
b) Variables
c) C operators
d) C expressions
575
5. A lady deposits 2,000 shillings in a Microfinance company at an interest rate
of 20% per annum. At the end of each year, the interest earned is added to the
deposit and the new amount becomes the deposit for that year.
Write pseudocode for a program that would track the growth of the deposits
over seven years.
compiler
t.c
ve
6.2.5.7 References
Blignaut, A. S., Hinostroza, J. E., Els, C. J., & Brun, M. (2010). ICT in education policy and
practice in developing countries: South Africa and Chile compared through SITES 2006.
Computers & Education, 55(4), 1552–1563.
Lehmann, S., & Schweitzer, B. (2006). Apparatus, system, and method for creating
customized workflow documentation (United States Patent No. US20060059423A1).
576
Nagar, T. (2019, December 3). What is software and types of software with examples?
YourStory.Com. https://yourstory.com/mystory/what-software-types-examples
different PC.
t
ve
t
sy
Bit Manipulation: C Programs can be manipulated using bits and it provides a wide
ea
e) C keywords
--Keywords are predefined, reserved words used in programming that have special meanings
to the compiler. Keywords are part of the syntax and they cannot be used as an identifier
f) Variables
577
- A variable is a named storage location Variables which is used to store information to be
referenced and manipulated in a computer program. Example of variable include height, age
etc
g) C operators
An operator is a symbol that tells the compiler to perform specific mathematical or logical
functions. Example of C operators include arithmetic operators, assignment operators,
relational operators, logical operators etc
h) C expressions
- An expression is a formula in which operands are linked to each other by the use of
operators to compute a value. An operand can be a function reference, a variable, an array
element or a constant. Examples include arithmetic expressions, logical expressions,
conditional operators etc
programming
t
t ve
sy
- In Sequence program execution, the program statements are executed one after another in
ea
the order in which they are written while in Selection control, a logical test is carried out,
and one or more statements are usually selected
4. A lady deposits 2,000 shillings in a Microfinance company at an interest rate of 20% per
annum. At the end of each year, the interest earned is added to the deposit and the new
amount becomes the deposit for that year.
Write pseudocode for a program that would track the growth of the deposits over seven
years.
SET Year to 0
578
WHILE Year <= 7 DO
Year = Year + 1
ENDWHILE
STOP
om
.c
t
tve
sy
ea
579
6.2.6 Learning Outcome 6: Perform Basic Internet programming
6.2.6.1 Introduction to the learning outcome
This learning outcome specifies the content of competencies required to perform basic internet
programming internet-based programming concepts, web programming approaches, web
programming languages, web programming interfaces, and HTML coding.
6.2.6.2 Performance Standard
6.2.6.2.1 Internet-based programming concepts are identified.
6.2.6.2.2 Web programming approaches are identified.
6.2.6.2.3 Web programming languages are identified.
6.2.6.2.4 Web programming interfaces are identified.
6.2.6.2.5 HTML coding is done.
Network concepts
Web concepts
Internet addresses
Sockets
Programming network applications
Network concepts
Inode, a machine that is connected to the network (computer, printer, bridge, vending
machine)
host, a fully autonomous computer connected to the network
580
address, each node has a unique address (several bytes)
packet, modern networks are packet-based, meaning that the information is broken down
to and sent as small chunks, each chunk of information handled separately.
protocol, rules, specifying how to perform communication.
Web services
A web application (or web app), unlike standalone application, runs over the Internet. Examples
of web apps are google, amazon, eBay, Facebook and the UCT website. A web app is typically a
3-tier (or multi-tier) client-server database application run over the Internet and it comprises five
components:
Basic Concepts
• HTTP Server: E.g., Apache HTTP Server, Apache Tomcat Server, Microsoft Internet
om
.c
Information Server (IIS), Nginx, Google Web Server (GWS), and others. You will learn how to
t
ve
t
sy
install Apache HTTP and Tomcat web servers in the next chapter.
ea
• HTTP Client (or Web Browser): E.g., Internet Explorer (MSIE), Firefox, Chrome, Safari,
and others.
• Client-Side Programs: could be written in HTML Form, JavaScript, VBScript, Flash, and
others.
• Server-Side Programs: could be written in Java Servlet/JSP, ASP, PHP, Perl, Python, CGI,
and others.
-Alongside the technical ”evolution”, communication between the application and also between
parts of applications residing on a different computer become more and more common
581
Examples of asynchronously communicating applications: web browsers, e-mail, news.
Some other examples: Distributed databases, sound, radio, video and internet telephony.
Need for applications where the participants are aware of each other:
Shared bulletin boards, whiteboards, shared word processors, control systems (eg. robots), and
(not the least) games (like RuneScape and world of warcraft).
There is support in the networks, where we will look closer on the internet
E-mail
News
Web-based databases
Client-server,
om
per-to-peer
t .c
ve
Telephone
t
sy
ea
Video
Internet addresses
In 1987 – 28000,
In 1989 – 100000,
In 1990 – 300000,
582
In 2009 – 1.67 billion (a rough estimate on June 30)Layers
IP, Internet Protocol- the network layer protocol (the reason for the name ”Internet”)
TCP, Transport Control Protocol-a connection-based protocol which ensures correct data
exchange between two nodes
UDP, User Datagram Protocol-a protocol which allows the transmission of independent packets
from one node to another with no guarantee concerning delivery or order of delivery
Sockets
A socket is one endpoint of a two-way communication link between two programs running on
the network. A socket is bound to a port number so that the TCP layer can identify the
application that data is destined to be sent to. An endpoint is a combination of an IP address and
om
a port number.
t .c
ve
t
sy
Server-side
The Server-side is the systems that run on the server, and the client-side is the software that runs
on a user’s web browser. The basic hosting of your files is achieved through a web server whose
responsibilities are described below.
Server-side development is much more than web hosting: it involves the use of a programming
technology like PHP or ASP.NET to create scripts that dynamically generate content.
It is important to remember that when developing server-side scripts, you are writing software,
just like a C or Java programmer would do, with the major distinction that your software runs on
a web server and uses the HTTP request-response loop for most interactions with the clients.
This distinction is significant, since it invalidates many classic software development patterns,
and requires different thinking for many seemingly simple software principles like data storage
and memory management.
Client-side
583
Client-side web development involves interactivity and displaying data, server-side is about
working behind the scenes to manage data. The idea of client-side scripting is an important one
in web development. It refers to the client machine (i.e., the browser) running code locally rather
than relying on the server to execute code and return the result. Many client-side languages have
come into use over the past decade including Flash, VBScript, Java, and JavaScript. Some of
these technologies only work in certain browsers, while others require plug-ins to function.
HTML
-HTML (HyperText Markup Language) a language used to develop web pages.
Hypertext means that some text in the HTML document carries a link to a different location,
which can be on the same page or another page. On clicking this 'hot spot', the viewer is
transferred to that location.
Markup means that specific portions of a document are marked up to indicate how they should
om
-HTML simply consists of tags that are placed around elements, which then changes the
t
sy
ea
properties of these enclosed elements. There are hundreds of HTML tags and some of these are
proprietary, which means that only some browsers recognize them.
<html>
<head>
<title>Internet programming</title>
</head>
<body>
</body>
</html>
For further reading on HTML,click on the link below
https://youtu.be/UB1O30fR-EE
PHP
584
Open source
PHP not only carries all the goodness of ASP but also is more secure and handles databases more
easily. It is a known fact that PHP on Apache Web server runs faster than ASP. PHP code is
embedded inside the HTML page and can link to databases to generate dynamic HTML content.
PHP scripts can be made to run on any operating system with little or no modification.
Pros
Can be embedded in HTML; seen as a dedicated web language.
Deceptively simple to learn.
Touted as a good beginner language.
Large array of built-in functions for everything from PDF creation to credit-card
transactions to database interaction
Available at a majority of hosting services
Relatively good integration with apache.
om
t.c
ve
Cons
t
sy
ea
While the runtime services are good, the language itself is quite horrible
Encourages writing bad code ^2 {too vague}'
PHP implementation is full of bugs and might change semantics without a note, causing
constant security upgrades that break your code
PHP encourages writing web programs in an insecure manner
Not too fast (good for building database interfaces, not making calculations)
JAVASCRIPT
Javascript is a programming language that runs on a web browser. Jscript is Microsoft’s'
implementation of Javascript for Internet Explorer. Javascript is not a subset of Java, in fact,
the two languages share little in common. Javascript runs on the browser (client) and does
not require any server software. Thus, it is a client-side scripting language. Since all
execution takes place on the browser, Javascript is responsible for most of the interactivity on
a web page. Image change or text color change on mouse-over, creating mouse trails are all
585
possible through Javascript. The language has also been widely used for basic form
validation.
Javascript is commonly embedded inside the HTML page and is thus visible to the visitor.
Javascript can also be written to run on a server and this is based on the ASP model promoted
by Microsoft.
Pros
Most web developers familiar with language from the client-side.
Cons
Server-side standards not settled
Consider the following video links for further reading on Javascript
https://youtu.be/uDwSnnhl1Ng
https://youtu.be/2nZiB1JItbY
CCI defines is a set of interfaces and classes whose methods allow a client to perform typical
t
sy
ea
data access operations. The following CCI interfaces and classes illustrate how to use the CCI
586
Indexed Record: Represents an ordered collection of Record instances based on the java.
util.List interface.
A client or application component that uses the CCI to interact with an underlying EIS does so in
a prescribed manner. The component must establish a connection to the EIS's resource manager,
and it does so using the ConnectionFactory. The Connection object represents the actual
connection to the EIS and it is used for subsequent interactions with the EIS.
commonly known as CGI. CGI is the part of the Web server that can communicate with other
t.c
ve
programs running on the server. With CGI, the Web server can call up a program, while passing
t
sy
user-specific data to the program (such as what host the user is connecting from, or input the user
ea
has supplied using HTML form syntax). The program then processes that data and the server
passes the program's response back to the Web browser.
HTML
Tags
An HTML element is identified in the HTML document by tags. A tag consists of the element
name within angle brackets. The element name appears in both the beginning tag and the closing
tag, which contains a forward slash followed by the element’s name, again all enclosed within
angle brackets. The closing tag acts like an off-switch for the on-switch that is the start tag
Parcelling
Coding
6.2.6.4 Learning Activities
Practical activity
Instructions
In your institutions’ computer lab perform the following practicals
587
i. Write a basic structure of an HTML document and give a complete explanation of
each of the tags used
ii. Create your first web page which will print the text “Hello World!” on the screen.
6.2.6.5 Self-Assessment
1. What is a web programming language?
2. Give the meaning of the following Network Concepts.
i. Node
ii. Host
iii. Packet
iv. Protocol
3. What is the role of web programming language?
4. What is the difference between Client-side and Server-side web programming
approaches?
om
t.c
ve
t
sy
Flow charts
Data flow diagram
Decision table
Decision tree
Web Authoring tools
Notepad
Computer
Software
Digital instructional material including DVDs and CDs
6.2.6.7 References
Alzahrani, A. A. (2020). 4GL Code Generation: A Systematic Review. (IJACSA)
International Journal of Advanced Computer Science and Applications. 6(11). Retrieved
fromhttps://www.researchgate.net/profile/Abdullah_Alzahrani13/publication/342652608
588
_4GL_Code_Generation_A_Systematic_Review/links/5f48e73892851c6cfdf046e6/4GL-
Code-Generation-A-Systematic-Review.pdf.
Connolly, R. (2015). Fundamentals of web development. Pearson Education.
Kumar, H. (2019). Programming software and Computer Languages. International
journal of advance research and innovative ideas in education. 3(5).
Selby, C. (2011). Four approaches to teaching programming. Retrieved from
Shaydulin, R., & Sybrandt, J. (2017). To agile, or not too agile: A comparison of software
development methodologies. arXiv preprint arXiv:1704.07469.
i. Node,-a machine that is connected to the network (computer, printer, bridge, vending
machine)
ii. Host -a fully autonomous computer connected to the network
iii. packet,- information that is broken down to and sent as small chunks, each chunk of
information handled separately.
iv. Protocol-rules, specifying how to perform communication in a networked environment
3. What is the role of web programming language
--The capabilities of the Internet have been enhanced and extended by using programming
languages with HTML. These languages have been responsible for the dynamic and
interactive nature of the Net. New languages and language extensions are being
developed to increase the usability of the Internet
4. Give the difference between Client-side and Server-side web programming approaches
--Client-side scripting generally refers to the class of computer programs on the web that
are executed client-side, by the user's web browser. Client-side scripts are often
589
embedded within an HTML or XHTML document (hence known as an "embedded
script"), but they may also be contained in a separate file, to which the document (or
documents) that use it make reference (hence known as an "external script") while
-server-side scripting are executed by the web server when the user requests a
document. They produce output in a format understandable by web browsers (usually
HTML), which is then sent to the user's computer.
-The user cannot see the script's source code (unless the author publishes the code
separately), and may not even be aware that a script was executed. Documents
produced by server-side scripts may, in turn, contain client-side scripts.
5. Give a brief description of the following web programming interfaces
i. Common client Interface(CCI)
ii. Common Gateway Interface (CGI)
om
t.c
ve
t
sy
ea
590