You are on page 1of 7

he Ba

The Basic Model of Computation, Programming Paradigms

s Computational Model:
A computational model is a mathematical model in computational science that
requires extensive computational resources to study the behavior of a complex system
by computer simulation. The common basis of programming language and computer
architecture is known as computational model. Provides a higher level of abstraction
than the programming language and the architecture.Computational model is the
combination of computer language and computer Architecture.

Algorithms are the most important and durable part of computer science because they
can be studied in a language- and machine- independent way. This means that we
need techniques that capable us to compare the efficiency of algorithms without
implementing them.

Our two most important tools are:

● The RAM model of computation and,


● The asymptotic analysis of worst-case complexity.

1.The RAM Model Random Access Machine (not R.A. Memory)


● An idealized notion of how the computer works
● Each "simple" operation (+, -, =, if) takes exactly 1 step.
● Each memory access takes exactly 1 step
● Loops and method calls are not simple operations, but depend upon the size of
the data and the contents of the method.

2.Measure the run time of an algorithm by counting the number of steps.

3.The program for RAM is not stored in memory. Thus we are assuming that the
program does not modify itself.

Fig: RAM Model

Introduction of Programming Paradigms


The term programming paradigm refers to a style of programming. It does not
refer to a specific language, but rather it refers to the way you program.There are lots of
programming languages that are well-known but all of them need to follow some
strategy when they are implemented. And that strategy is a paradigm.

The types of programming paradigms:

1.Imperative programming paradigm


The word “imperative” comes from the Latin “impero” meaning “I command”.It’s
the same word we get “emperor” from, and that’s quite apt. You’re the emperor.

You give the computer little orders to do and it does them one at a time and
reports back.The paradigm consists of several statements, and after the execution of all
of them, the result is stored. It’s about writing a list of instructions to tell the computer
what to do step by step.I
In an imperative programming paradigm, the order of the steps is crucial,
because a given step will have different consequences depending on the current values
of variables when the step is executed.Find the sum of first ten natural numbers in the
imperative paradigm approach.

i.Procedural programming paradigm


Procedural programming (which is also imperative) allows splitting those
instructions into procedures.Procedures aren't functions. The difference between them
is that functions return a value, and procedures do not.

A great example of procedures would be the well known for loop. The for loop's
main purpose is to cause side effects and it does not return a value.

Languages that support the procedural programming paradigm are:

C,C++,Fortran Cobal

ii.Object-oriented programming paradigm


The smallest and basic entity is an object and all kinds of computation is
performed on the objects only. More emphasis is on data rather than procedure. The
program is written as a collection of classes and objects which are meant for
communication.It can handle almost all kinds of real life problems which are today in
scenario.
iii.Parallel processing approach
Parallel processing is the processing of program instructions by dividing them
among multiple processors.A parallel processing system allows many processors to run
a program in less time by dividing them up.

● Speeds up performance.
● It makes it easy to solve problems since this approach seems to be like a divide
and conquer method.

Languages that support the Parallel processing approach:

NESL (one of the oldest one)

● C/C++

2.Declarative programming paradigm


It is divided as Logic, Functional, Database. In computer science the declarative
programming is a style of building programs that expresses logic of computation without
talking about its control flow.
Declarative programming is a programming paradigm in which the programmer defines
what needs to be accomplished by the program without defining how it needs to be
implemented. In other words, the approach focuses on what needs to be achieved
instead of instructing how to achieve it.

So the main differences are that imperative tells you how to do something and
declarative tells you what to do.
i.Logic programming paradigms

It would solve logical problems like puzzles, series etc. In logic programming we
have a knowledge base which we know before and along with the question and
knowledge base which is given to the machine, it produces results. In normal
programming languages, such concept of knowledge base is not available but while
using the concept of artificial intelligence, machine learning we have some models like
Perception model which is using the same mechanism

In logical programming the main emphasis is on knowledge base and the problem.

To give you an idea, John is Bill's and Lisa's father. Mary is Bill's and Lisa's
mother. Now, if someone asks a question like "who is the father of Bill and Lisa?" or
"who is the mother of Bill and Lisa?" we can teach the computer to answer these
questions using logic programming.

ii.Functional programming paradigms

The functional programming paradigm has its roots in mathematics and it is


language independent. The key principle of this paradigm is the execution of a series of
mathematical functions.

You compose your program of short functions. All code is within a function. All
variables are scoped to the function.In the functional programming paradigm, the
functions do not modify any values outside the scope of that function and the functions
themselves are not affected by any values outside their scope.Some of the languages
like perl, javascript mostly uses this paradigm.

iii.Database processing approach


This programming methodology is based on data and its movement. Program
statements are defined by data rather than hard-coding a series of steps. A database
program is the heart of a business information system and provides file creation, data
entry, update, query and reporting functions. There are several programming languages
that are developed mostly for database application. For example SQL. It is applied to
streams of structured data, for filtering, transforming, aggregating (such as computing
statistics), or calling other programs. So it has its own wide application.

You might also like