0% found this document useful (0 votes)
11 views

CSC 315 Lecture 3

Uploaded by

favouruturu03
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

CSC 315 Lecture 3

Uploaded by

favouruturu03
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

CSC 315 SURVEY OF PROGRAMMING LANGUAGES

BRIEF SURVEY OF PROGRAMMING PARADIGMS


A Paradigm is an example that serves as a pattern or model , Paradigms
are groups that differentiate one class of similar languages from others in
some high level way, usually focused features that exhibit common
behaviors.

MAIN PROGRAMMMING PARADIGMS

A. PROCCEDURAL LANGUAGE
B. FUNCTIONAL LANGUAGE
C. DECLARATIVE NON ALGORITHMIC LANGUAGE
D. SCRIPTING LANGUAGES

a. PROCEDURAL PROGRAMMING
This is a type of computer programming language that describes a set
of wellstructured steps and methods within its programming context
to build a program. It consists a regular order of statements, functions
and commands to complete a computational task or program. A
procedural language is also understood as an imperative language.
They create a use of functions, conditional statements and variables
for developing programs that enable a computer to calculate and
display the required or desired output.
Key Features of Procedural Languages
i. Predefined function ii. Local variable iii. Global variable iv.
Modularity
v. Parameter passing

i. Predefined function; these are built into higher level


programming languages they are instructions identified by a name,
they are derived from the library or registry rather than the
program.
ii. Local Variable; A local variable is a name assigned to a storage
area that a program can manipulate. A variable size determines the
size and layout of the variables memory, it also determines the
range of values which need to be stored inside that memory and
the nature of operations that can be applied to that variable. A
local variable is a type of variable declared within the programming
blocks or subroutines. It can only be used inside the subroutine or
code block in which it is declared. It exists until the block of
function is under execution after that it will be destroyed
automatically.
iii. Global Variable; A global variable is a variable defined outside the
subroutine or function. It has a global scope, meaning it holds its
value throughout the life time of the program. Hence it can be
accessed throughout
the program by any function defined within the program unless it is
overshadowed.
iv. Modularity; this is a property that describes how replaceable the
components or module of a paradigm are, a computer software is
modular if the sections of a code can be added or removed as
needed. Computer programming languages refer to their libraries
as modules, including a module in a program adds new features of
abilities by granting access to prewritten code objects e.g in python
programming language, the random module provides access to
many powerful /PRNG / Pseudorandom number generator
functions. Linux kernel is also modular its kernel modules can be
loaded or unloaded by the system administrator altering the
features or abilities of the operating system without needing to
reboot the computer.
v. Parameter Passing; Parameter passing involves passing input
parameters into a module and receiving output parameters back
from the module /a function in C and a function and procedure in
Pascal.

b. FUNCTIONAL PROGRAMMING; this differs from procedural


programming and object oriented programming as it makes use of
mathematical functions. Functional programming paradigm express
computation as the evaluation of mathematical functions and it avoids
changing state and mutable data. It is a method of building the structure
and components of computer programs. It performs on the base of input
not temporary or hidden input.
Advantages
i. It allows a protected environment
ii. Since this paradigm is only dependent on the input arguments
there are no side effects
iii. This paradigm reduces the requirement for a huge amount of
code required to define states.

Characteristics
i. The discipline and idea of this paradigm is based on mathematics
and the theory of functions
ii. The values produced are non-mutable meaning it is impossible to
change the constituent of a composite value, it is however possible
to make a revised copy of composite value
iii. Functions in this paradigm are first class values, they are full-
fledged data just like numbers, lists, etc.
iv. It fits well with computations driven by needs, thereby opening a
new world of possibilities.

c. DECLARATIVE NON ALGORITHMIC LANGUAGE


Declarative programming paradigm is a style of building the structure
and elements of computer programs that expresses logic of a
computation without describing its control flow.
It is a non-imperative style of programming in which programs
describe their desired results without explicitly listing commands or
steps that must be performed. Functional programming languages
characterized by a declarative programming style. The non-
algorithmic computer programs that exist are declarative computer
programs. Declarative programming is an alternative problem solving
philosophy which solves problems by presenting a clear description of
the solution rather than stating a procedure detailing how to arrive at
the solution like algorithms do. Non algorithmic can be mechanically
interpreted by problem solving mechanisms. Logic and functional
programming are examples of programming paradigms using the non-
algorithmic declarative problem solving philosophy. Examples of
declarative languages are HTML, XML, CSS, JSON, and SQL most
declarative languages are non-algorithmic.

d. SCRIPTING LANGUAGES

A scripting language is a programming language that is interpreted. It is


translated into machine code when the code is run rather than beforehand.
Scripting languages are a series of commands that are able to be executed
without need for compiling. Scripting languages are often used for short
scripts over full computer programs while all scripting languages are
programming languages not all scripting languages are programming
languages. PHP, Python, Perl, java script and ruby are all examples of
scripting languages. Scripting languages use a program known as an
interpreter to translate commands and are directly interpreted from the
source code not requiring a compilation step, other programming languages
on the other hand may require a compiler to translate commands to
machine code before it can execute those commands. It is important to
know the difference between interpreted and compiled programming
languages. However, advanced hardware and coding practices are
beginning to make the differences somewhat obsolete.

Interpreted vs. Compiled languages

An interpreted programming language is a language designed to execute


source codes directly without the need to compile a program into machine
language instructions. An interpreter will execute the program by
translating statements into a series of one or more subroutines before
finally translating them into another language such as machine code.

In compiled programming languages a compiler program translates codes


written in high level programming languages to a lower level language in
order for the program to execute. C or Java programs must usually be
compiled first in order to run, two wellknown compilers are eclipse for java
and gcc for C and C++.

The easier way to understand how a compiler functions is to think about


various operating systems for instance, windows programs are compiled to
run on windows platforms therefore are not compatible with mac.

There are two types of scripting languages

a. Server side scripting


b. Client side scripting
Server side scripting languages run on a webserver, when a client sends a
request, the server responds by sending content via http, in contrast client
side scripting languages run on the client end /.on the web browser. The
benefit of client side script is that they reduce demand on the server,
allowing web pages to load faster, a significant benefit of server side scripts
is that they are not viewable by the public like client side scripts are.
Examples of Server-Side Scripting Languages ;

Languag Comments
e

HTML The foundation of web development.


Improves appearance and graphics on pages in your web
CSS
browser.

JavaScrip Though typically client-side, can occasionally be used on server-


t side as well.

Client side scripting is more focused on user interface and functionality.


Conversely, server side scripting focuses on faster processing, access to
data and resolving errors. Examples of Client-Side Scripting Languages are;

APPLICATIONS OF SCRIPTING LANGUAGES

a. They are used in web applications in addition to server side and client
side applications.
b. Scripting languages are also used to create plugins and extensions for
existing applications.
c. Scripting languages can be used in system administration. Examples
of scripts in system administration are shell, Perl, and python.
d. It is used in games application and multimedia.

You might also like