Está en la página 1de 10

Name: Immam Sulyman Ishiaka

Matric No: Plasu/2012/Nas/0033


Department: Computer Science
Level: 400L
Question: find more examples on programming languages paradigms
and their characteristics;
1.
2.
3.
4.
5.
6.

Imperative programming
Declarative programming
Object oriented programming
Functional programming
Event driven programming
Automata based programming

Submitted to Dr. Nentaweh maurice

1. Imperative programming
The imperative (or procedural) paradigm is the closest to the structure of actual computers.
-

It is a model that is based on moving bits around and changing machine state

Programming languages based on the imperative paradigm have the following characteristics:
i.

The basic unit of abstraction is the PROCEDURE, whose basic structure is a sequence of
statements that are executed in succession, abstracting the way that the program counter
is incremented so as to proceed through a series of machine instructions residing in
sequential hardware memory cells.
The sequential flow of execution can be modified by conditional and looping statements

ii.

(as well as by the very low-level goto statement found in many imperative languages),
which abstract the conditional and unconditional branch instructions found in the
iii.

underlying machine instruction set.


Variables play a key role, and serve as abstractions of hardware memory cells. Typically,
a given variable may assume many different values of the course of the execution of a
program, just as a hardware memory cell may contain many different values. Thus, the
assignment statement is a very important and frequently used statement.

Examples of imperative languages:


Ada,ALGOL,BASIC,Blue,C,C+
+,C#,Ceylon,COBOL,D,eC,FORTRAN,GAUSS,Go,Groovy,

Julia,

Lua,

MATLAB,

Machine language, Modula-2, Modula-3, MUMP, Nim, Oberon, Object Pascal, OCaml,
Pascal, Perl, PHP, PROSE, Python, Ruby, Rust, Wolfram Language
2. Functional programming
Functional programming is a programming paradigma style of building the structure and
elements of computer programsthat treats computation as the evaluation of mathematical
functions and avoids changing-state and mutable data

Functional programming languages were originally developed specifically to handle symbolic


computation and list-processing applications.
In FPLs the programmer is concerned only with functionality, not with memory-related variable
storage and assignment sequences.

Functional programming characteristics:


Functional programming languages are modeled on the concept of mathematical functions, and
use only conditional expressions and recursion to effect computation.
In the purest form they use neither variables nor assignment statements, although this is relaxed
somewhat in most applied functional languages.
The concept of side effects is also alien to purely functional programming: a function is given
values and returns a value, there are no variables to manipulate and hence no possibility for side
effects.
Programs are constructed by composing function applications - the values produced by one or
more functions become the parameters to another.
For reasons of efficiency (because the underlying machine is, in fact, imperative) most
functional languages provide some imperative-style capabilities, including variables with
assignment, sequences of statements, and imperative style loop structures.
Note that the functional paradigm can also be used with some imperative languages - e.g. C has
both a conditional expression and support for recursion - so the factorial function code be coded
in functional style in C (or C++ or Java) as follows: int fact(int x){ return (x == 0) ? 1 : x * fact(x
- 1); }

Functional programming languages define programs and subroutines as mathematical functions.


Many so-called functional languages are "impure", containing imperative features.

Many functional languages are tied to mathematical calculation tools. Functional languages
include:
Pure:
Agda, Charity, Clean, Coq (Gallina), Curry, Elm, Frege, Haskell, Hope, Joy, Mercury, Miranda,
Idris, SequenceL.
Impure:
APL, ATS, CAL, C, C++, C#, Ceylon, D, Dart, Curl, ECMAScript (ActionScript,
ECMAScript for XML, JavaScript and Jscript), Elm, Erlang (Elixir and LFE), F#, FPr, Groovy,
Hop, J, Java, Julia, Lisp, Tea, Mathematica, ML, Nemerle, Opal, OPS5, poplog, python, Q
( equational programming languages), Q (programming language from Kx systems), R, REBOL,
ruby, REFAL, rust, Scala, Spreadsheets, Wolfram languages.
3. Object Oriented Programming

FEATURES OF OOP:
1. Object
2. Class
3. Data Hiding and Encapsulation
4. Dynamic Binding
5. Message Passing
6. Inheritance
7. Polymorphism
OBJECT: Object is a collection of number of entities. Objects take up space in the memory.
Objects are instances of classes. When a program is executed, the objects interact by sending

messages to one another. Each object contain data and code to manipulate the data. Objects can
interact without having known details of each others data or code.
CLASS: Class is a collection of objects of similar type. Objects are variables of the type class.
Once a class has been defined, we can create any number of objects belonging to that class. Eg:
grapes bannans and orange are the member of class fruit.
DATA ABSTRACTION AND ENCAPSULATION:
Combining data and functions into a single unit called class and the process is known as
Encapsulation. Data encapsulation is important feature of a class. Class contains both data and
functions. Data is not accessible from the outside world and only those function which are
present in the class can access the data. The insulation of the data from direct access by the
program is called data hiding or information hiding. Hiding the complexity of program is called
Abstraction and only essential features are represented. In short we can say that internal
working is hidden.
DYNAMIC BINDING: Refers to linking of function call with function definition is called
binding and when it is take place at run time called dynamic binding.
MESSAGE PASSING: The process by which one object can interact with other object is called
message passing.
INHERITANCE: it is the process by which object of one class aquire the properties or features
of objects of another class. The concept of inheritance provide the idea of reusability means we
can add additional features to an existing class without modifying it. This is possible by driving a
new class from the existing one. The new class will have the combined features of both the
classes.
POLYMORPHISM: A Greek term means ability to take more than one form. An operation may
exhibit different behaviors in different instances. The behavior depends upon the types of data
used in the operation.
Examples of Object oriented programming
ActionScript 3.0, Actor, Ada 95 and Ada 2005, BETA, Blue, C++, C#, Ceylon,
Oxygene( formerly known as Chrome), Chuck, Cobra, ColdFusion, Curl, D, DASL, Delphi, E,

GNU E, eC, Eiffel, F-Script, Fortran 2003, Fortress, FPr, Gambas, Game maker language,
Harbour, J, Java, LabVIEW, Lava, Lua, Modula-2, Modula-3, Nemerle, IBM NetRexx, Oberon2, Object Pascal, Object REXX, Objective-C, OCaml, Oz, Mozart programming System, Perl 5,
PHP, Pike, Prograph, Python, Realbasic, Ruby, Scala, Simula, Smalltalk, SPIN, SuperColider,
Transcript, VBScript, Visual DataFlex, Visual FoxPro, Visual Prolog, X++, XOTcl.

4. Declarative programming
Declarative programming is a programming paradigm that deals with the style of building the
structure and elements of computer programs- that expresses the logic of a computation
without describing its control flow.
Declarative languages allow the programmer to concentrate on the logic of an algorithm
(declarative languages are goal driven, control is not the concern of the programmer). These are
the following features of declarative programming languages:
1. Assignment
2. Data structures
3. Order of execution
4. Expressions and definitions as values
5. Control
Examples of declarative programming language consists:
C++, Clojure, Coffeescript,[2] Elixir, Erlang, F#, Haskell, Lisp, Python, Ruby, Scala,
SequenceL, SML, SQL, regular expressions, CSS, Prolog, OWL, SPARQL

5. Event Driven Programming


Key features of event driven programming
1. Forms & Controls
2. Trigger functions
3. Event handlers
4. Event loops

Forms and Controls


A GUI (graphical user interface) is what the user sees when the program runs and usually
consists of one or several forms
Each form contains various controls which allow the user to interact with the program in
different ways e.g. Textboxes, Menus, Buttons
Each type of control has its own events e.g. a Form events include:
Load (open for first time, set default values)
KeyDown (when the user presses a key)
Trigger Functions
-

Event driven programs respond to events triggered by the user via the mouse or

keyboard
Common user events include clicking the mouse, pressing a key, changing text
Different controls have different events (events for a text box not the same for a

button)
The programmer chooses which event(s) to respond to by selecting the appropriate
trigger function.

Event Handlers
-

An event triggers the appropriate event handler


Event handlers contain the code that runs when an event occurs

These event handlers are self-contained sections of code also called

Procedures

or Subroutines
VB.NET uses Sub /End Sub to start and end the code
This allows the programmer to work on one event of one control at a time and makes
testing easier

Event Loops
-

Programmers not normally aware of these


The Event loop keeps testing the user interface to see if anything has happened (e.g.

clicking on a button or pressing a key)


When detected, the event is passed to the trigger function which then finds the

appropriate event handler to run the code written for this purpose
Other (non user) activities can also cause an event to trigger typically used in
networking and when reading from or writing to files

Examples of Event-driven programming are:


Javascript, ActionScript, Visual Basic, Elm.

6. Automata Based Programming


Automata-based programming is a programming paradigm in which the program or part of it
is thought of as a model of a finite state machine (FSM) or any other (often more complicated)
formal automaton. Sometimes a potentially infinite set of possible states is introduced, and such
a set can have a complicated structure, not just an enumeration.
The following properties are key indicators for automata-based programming:
The time period of the program's execution is clearly separated down to the steps of the
automaton. Each of the steps is effectively an execution of a code section (same for all the steps),
which has a single entry point. Such a section can be a function or other routine, or just a cycle

body. The step section might be divided down to subsections to be executed depending on
different states, although this is not necessary.
Any communication between the steps is only possible via the explicitly noted set of variables
named the state. Between any two steps, the program (or its part created using the automatabased technique) cannot have implicit components of its state, such as local (stack) variables'
values, return addresses, the current instruction pointer, etc. That is, the state of the whole
program, taken at any two moments of entering the step of the automaton, can only differ in the
values of the variables being considered as the state of the automaton.
Examples of Automata based Programming is AsmL.

References:
i.
ii.
iii.
iv.
v.
vi.
vii.
viii.

https://en.wikipedia.org/wiki/Comparison_of_programming_paradigm
s
https://en.wikipedia.org/wiki/Object-oriented_programming
https://en.wikipedia.org/wiki/Imperative_programming
https://en.wikipedia.org/wiki/Functional_programming
https://en.wikipedia.org/wiki/Event-driven_programming
https://en.wikipedia.org/wiki/Automata-based_programming
http://www.slideshare.net/nileshdalvi01/basics-concepts-of-oops
http://www.slideshare.net/nileshdalvi01/eventdriventheory

También podría gustarte