The Programming are of Diffrent Ways or we can say Programming Paradisim.
- Imperative Programming (e.g., standard Pascal or C).
A program is thought of as a sequence of
instructions, normally organised in a structured manner using
procedures, functions. Running a program involves going through
the sequence of instructions.
- Functional Programming (e.g., ML, Lisp).
A program is a set of function definitions.
Running a program involves calling a function with some arguments to get
a result.
- Logic Programming. A program is a set of statements in some logic.
Running a program involves giving the system a fact to prove.
- Object Oriented Programming. A program is seen as a set of
objects which exchange information with each other. Running a program involves
sending a 'message' to an object.
It is important to be aware of these different approaches to programming.
A given programming language typically supports more than one paradigm,
and it is to some extent up to the programmer what style of programming
they adopt even in a given language. For different problems, different
approaches are more natural, so there is no panacaea. However,
imperative and object oriented approaches are arguably the most important,
and widely applicable.
C supports both imperative and
object-oriented programming. You can write C programs which
don't exploit its object oriented features, however very often there
will be a cleaner solution that uses objects.
Object-oriented programming can be viewed as an extension of the idea of
abstract datatypes. An abstract datatype involves a data structure
with a set of defined operations on that data structure. The
data structure is only accessed or modified through these operations.
The main extension of these idea in object oriented programming
is that a given datatype (say, t1) may be a
subtype of another (say,
t2), and so access the operations and data of that other type.
If an operation (or data field) is
defined for both t1 and t2, in different ways,
the version for t1
overrides the version for t2, and is the one
used.
This simple feature introduces a great deal of flexibility, and
more importantly makes it relatively easy to
re-use code in
different applications, where minor variations of a basic approach
are required. Libraries of generally useful datatypes (objects) are
made available, but the programmer can easily define special customised
versions with slightly different behaviour.
abstract data type(definition)
Definition: A set of data values and associated operations that are precisely specified independent of any particular implementation.
Note: Since the data values and operations are defined with mathematical precision, rather than as an implementation in a computer language, we may reason about effects of the operations, relations to other abstract data types, whether a program implements the data type, etc.
One of the simplest abstract data types is the stack. The operations new(), push(v, S), top(S), and popOff(S) may be defined with axiomatic semantics as following.
1. new() returns a stack
2. popOff(push(v, S)) = S
3. top(push(v, S)) = v
where S is a stack and v is a value. (The usual pop operation is a combination of top, to return the top value, and popOff, to remove the top value.) Contrast this with the axiomatic semantics definition of a set, a dictionary, or a queue.
From these axioms, one may define equality between stacks, define a pop function which returns the top value in a non-empty stack, etc. For instance, the predicate isEmpty(S) may be added and defined with the following additional axioms.
4. isEmpty(new()) = true
5. isEmpty(push(v, S)) = false
(Through This You Must answer these question then only move forward)
Q1.Different Ways of Programming Concept ?
Q2. What is a Abstract DataType ?