Computer Programming One
Computer Programming One
Computer Programming One
DEPARTMENT; TIE
ASSIGNMENT
GROUP MEMBERS:
1. OOP PROGRAMMING
Object-oriented programming (OOP) is a computer programming model that organizes
software design around data, or objects, rather than functions and logic. An object can be
defined as a data field that has unique attributes and behavior.OOP focuses on the objects
that developers want to manipulate rather than the logic required to manipulate
them.OOP PROGRAMMING
2. IMPERATIVE PROGRAMMING
Imperative programming is a paradigm of computer programming where the program
describes steps that change the state of the computer. Unlike declarative programming,
which describes "what" a program should accomplish, imperative programming explicitly
tells the computer "how" to accomplish it. Programs written this way often compile to
binary executables that run more efficiently since all CPU instructions are themselves
imperative statements.
Characteristics
a. 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.
b. The sequential flow of execution can be modified by conditional and looping
statements (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 underlying machine instruction set.
c. 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.
3. Structured Programming
It is a programming with a specific structure of the program and modular programming is added
with structured language to add different functions. These are high level imperative languages
with assignment statements, calculative statements, evaluation statements to execute complex
expressions which may have arithmetic, relational & logical operators and function evaluations,
and the assignment of the resulting value to memory.
Looping statements like while, do while, for loop, etc. used to execute sequence, conditional
branching, switch case statements and looping statements and subroutine or procedure call.
Imperative languages are like Fortran, BASIC, Pascal, COBOL, ALGOL language for
mathematical algorithms and C language,
4. procedural Programming
Procedural programming is the standard approach used in traditional computer language such as
C, Pascal, FORTRAN & BASIC. The basic idea is to have a program specify the sequence of
steps that implements a particular algorithm . Procedural programming is a term used to denote
the way in which a computer programmer writes a program.
This method of developing software, which also is called an application, revolves around
keeping code as concise as possible. It also focuses on a very specific end result to be achieved.
Procedural programming creates a step by step program that guides the application through a
sequence of instructions. Each instruction is executed in order.
Most declarative programming languages stem from work in artificial intelligence and automated
theorem proving, areas where the need for a higher level of abstraction and a clear semantic
model of programs is obvious. The basic property of a declarative programming language is that
a program is a theory in some suitable logic. This property immediately gives a precise meaning
to programs written in the language. From a programmers point of the the basic property is that
programming is lifted to a higher level of abstraction. At this higher level of abstraction the
programmer can concentrate on stating what is to be computed, not necessarily how it is to be
computed.
The programmer gives the logic but not necessarily the control. Declarative programming can be
understood in in a weak and a strong sense. Declarative programming in the strong sense then
means that the programmer only has to supply the logic of an algorithm and that all control
information is supplied automatically by the system. Declarative programming in the weak sense
means that the programmer apart from the logic of a program also must give control information
to yield an efficient program
6. Functional programming
In functional programming languages programs are built from function definitions. To give
meaning to programs they are typically mapped on some version of the λ-calculus which is then
given a denotational semantics. There are both impure (strict) functional languages like Standard
ML allowing things like assignment and pure (lazy) functional languages like Haskell.
Modern functional languages like Haskell come rather close to achieving declarative
programming in the strong sense since programmers rarely need to be aware of control. On the
other hand the execution order of lazy evaluation is not very easy to understand and the real
computational content of a program is hidden under layers and layers of syntactic sugar and
program transformations. As a consequence the programmer loses control of what is really going
on and may need special tools like heap-profilers to find out why a program consumes memory
in an unexpected way.
To fix the behavior of programs the programmer may be forced to rewrite the declarative
description of the problem in some way better suited to the particular underlying implementation.
Thus, an important feature of declarative programming may be lost – the programmer does not
only have to be concerned with how a program is executed but has to understand a model that is
difficult to understand and very different from the intuitive understanding of the program.
7. Logic programming
For practical applications there exists one logic programming in use: Prolog. Prolog is used for a
wide variety of applications in artificial intelligence, knowledge based systems, and natural
language processing.
A (pure) Prolog program is understood as a set of horn clauses, a subset of first order predicate
logic, which can be given a model-theoretic semantics. Programs are evaluated by proving
queries with respect to the given program. From a programming point of view Prolog provides
two features not present in functional languages, built-in search and the ability to compute with
partial information. This is in contrast to functional languages where computations always are
directed, require all arguments to be known and give exactly one answer.
These languages are imperative style with object based events handlers like Visual Basic &
PHP with Web designating languages.Programs with GUIs often use Event-Driven Programming
. Program waits for events to occur and then responds
Examples of events: