This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.
In the imperative, or procedural the two terms are usually interchangeable, paradigm, the primary orientation is toward variables and the sequential execution of statements that change the values of those variables. The imperative paradigm corresponds closely to the organization of a standard (Von Neumann) computer. The state of a computation is defined by the current values of all of the variables of the program (including external files and also possibly also including the values to be assumed by uninitialized variables during program execution), the location of the next statement to be executed, and the internal data needed to return from subprogram calls that are currently active. The execution of each statement changes these values, and hence changes the state. Thus the execution of an imperative program can be viewed as the execution of a sequence of statements
. . .
where each statement Si is a function
Si: state -> state
If we let Si be the state after statement Si executes, then we also can view the execution of an imperative program as a sequence of states
S0, S1, S2, S3, ..., Sn-1, Sn
Example : Imperative Programming is what most professional programmers use in their day-to-day jobs. It's the name given to languages like C, C++, Java, COBOL, etc. In imperative programming,
Discipline and idea
Digital hardware technology and the ideas of Von Neumann
Incremental change of the program state as a function of time.
Execution of computational steps in an order governed by control structures
We call the steps for commands
Straightforward abstractions of the way a traditional Von Neumann computer works
Similar to descriptions of everyday routines, such as food recipes and car repair
Typical commands offered by imperative languages
Assignment, IO, procedure calls
Fortran, Algol, Pascal, Basic, C
The natural abstraction is the procedure
Abstracts one or more actions to a procedure, which can be called as a single command.
The logic paradigm :
The logic paradigm is dramatically different from the other three main programming paradigms. The logic paradigm fits extremely well when applied in problem domains that deal with the extraction of knowledge from basic facts and relations. The logical paradigm seems less natural in the more general areas of computation.
Discipline and idea
Automatic proofs within artificial intelligence
Based on axioms, inference rules, and queries.
Program execution becomes a systematic search in a set of facts, making use of a set of inference rules
Main loop, event handlers, asynchronous processes
Example : focus is on what the computer should do rather than how it should do it (ex. SQL)
The functional paradigm :
Functional programming is in many respects a simpler and more clean programming paradigm than the imperative one. The reason is that the paradigm originates from a purely mathematical discipline: the theory of functions. Its a subset of declarative languages that has heavy focus on recursion. The primary orientation of the applicative/functional paradigm is toward values (as opposed to variables for the imperative paradigm) and the evaluation of expressions (as opposed to the execution of statements in the imperative paradigm). The execution of a program is essentially the evaluation of an expression, which is usually a function applied to an argument list. Successive states are not of interest in the functional paradigm. Each value that is produced as the result of an intermediate evaluation is used in later evaluations, rather than being saved as the value of a program variable.
Discipline and idea
Mathematics and the theory of functions
The values produced are non-mutable
Impossible to change any constituent of a composite value
As a remedy, it is possible to make a revised copy of composite value
Time only plays a minor role compared to the imperative paradigm
All computations are done by applying (calling) functions
The natural abstraction is the function
Abstracts a single expression to a function which can be evaluated as an expression
Functions are first class values
Functions are full-fledged data just like numbers, lists, ...
Fits well with computations driven by needs
Opens a new world of possibilities
Examples of functional programming languages are Lisp, Scheme, ML, Ocaml, and Haskell.
Definition of Object Oriented Paradigm
Object Oriented Paradigm is a programming paradigm that uses 'Objects' to design applications and computer programs, it models the real world. This includes some unique concepts which overcome the drawbacks of fellow programming paradigms. In OOP, the emphasis is on data and not on procedures. C++ is a programming language which obey OOP features.
General Features of OOP Programming:
Discipline and idea
The theory of concepts, and models of human interaction with real world phenomena
Data as well as operations are encapsulated in objects
Information hiding is used to protect internal properties of an object
Objects interact by means of message passing
A metaphor for applying an operation on an object
In most object-oriented languages objects are grouped in classes
Objects in classes are similar enough to allow programming of the classes, as opposed to programming of the individual objects
Classes represent concepts whereas objects represent phenomena
Classes are organized in inheritance hierarchies
Provides for class extension or specialization
B. Your choice of paradigm and why you choose that particular paradigm ?
Java, C#, and C++ are imperative languages as well as being object oriented. Object-oriented-ness is just a way of packaging code with its related data as opposed to separating the two.
My choiceble programming paradiagm for Ambulance Service is object oriented which is Java.
The reason :
The reason behind the surge in popularity of this paradigm is its relevance to organizing the design and construction of large software systems, its ability to support user-defined data abstractions, and the ability to provide a facility for reuse of program code. These are aside from the fact that many of the entities that have to be dealt with in a computer system are naturally modeled as "objects". Ubiquitous examples of objects are the images and windows that appear on the screen of a typical personal computer or workstation environment. These have the characteristics that they
maintain their own state information;
(ii) can be created dynamically by the program;
(iii) need to interact with other objects as a manner of course.
Data structures are considered to be separate from the procedures. This introduces management problems of how to ensure that the data are operated on only by appropriate procedures, and indeed, problems of how to define what appropriate means for particular data. In the second figure, many of the procedures have been folded inside the data, the result being called "objects" .
Figure 79: Object-oriented paradigm
Thus each object can be accessed only through its accompanying procedures (called methods). Sometimes the access is referred to as "sending a message" and "receiving a reply" rather than calling a procedure, and sometimes it is implemented quite differently.
Figure 80: State transition in a graphical object as the result of sending it a resize message
In any case, an enforced connection between procedures and data solves the issue of what procedures are appropriate to what data and the issue of controlling access to the data.
Objects are the principal vehicles for providing data abstractions in Java: Each object can contain data values, such as those of attributes, that define its state. An object may also provide access to those values and the provide ability to change them. These things are preferably done by the methods associated with the object, rather than through direct access to the state values themselves, although Java does not prevent the latter type of access. By accessing attribute values only through methods, the representation of the state of the object can be changed while leaving the procedural interface intact. There are numerous benefits of providing a methods-only barrier between the object and its users or clients:
Principle of Modularity ("separation of concerns"): This principle asserts that it is easier to develop complex programs if we have techniques for separating the functionality into pieces of more primitive functionality. Objects provide one way of achieving this separation.
Evolutionary Development: The process of developing a program might begin with simple implementations of objects for testing purposes, then evolve to more efficient or robust implementations concurrently with testing and further development.
Flexibility in Data Representations: An object might admit several different data representations, which could change in the interest of efficiency while the program is running. The object notion provides a uniform means of providing access to such changing objects.
Objects in Java are always dynamically allocated (created). It is also possible for the object to reallocate dynamically memory used for its own variables.
Using Java as an example language, these are the aspects of objects, as defined by a common class declaration that will be of interest:
Name Each class has a name, a Java identifier. The name effectively
becomes a type name, so is usable anywhere a type would be
Constructor The constructor identifies the parameters and code for initializing
an object and called when an object is created dynamically or automatically.
Methods Methods are like procedures that provide the interface between the
object and the program using the object. As with ordinary
procedures, each method has an explicit return type, or specifies
the return type void.
Variables Each time an object is created as a "member" of a class, the system
allocates a separate set of variables internal to it.
C. If you were to choose an alternative programming language other than the one you have chosen for the implementation, which one would that be and why? [Second best choice]
My second best choice programming language is lisp which is functional programming paradigm inducted.
The Macintosh Common Lisp environment then became, and still is now, a friendly and powerful development environment for prototyping code and delivering tools. LISP part of the system to the Mac. As the Mac got more powerful, I again moved the image processing part of the system to LISP on the Mac, so that the program ran entirely on a desktop computer
The reason why I choice Lisp :
ï‚· Common Lisp is
a general-purpose programming language and an AI language
ï‚· Common Lisp programs are
easy to test (interactive)
easy to maintain (depending on programming style)
portable across hardware/OS platforms and implementations (there is a standard for the language and the library functions)
ï‚· Common Lisp provides
clear syntax, carefully designed semantics
several data types: numbers, strings, arrays, lists, characters, symbols, structures, streams etc.
runtime typing: the programmer need not bother about type declarations, but he gets notified on type violations.
many generic functions: 88 arithmetic functions for all kinds of numbers (integers, ratios, floating point numbers, complex numbers), 44 search/filter/sort functions for lists, arrays and strings
automatic memory management (garbage collection)
packaging of programs into modules
an object system, generic functions with powerful method combination (Common Lisp was the first ANSI standard object oriented programming language. DSB)
macros: every programmer can make his own language extensions
Moreover, Common Lisp is well suited to large programming projects and explorative programming. The language has a dynamic semantics which distinguishes it from languages such as C and Ada. It features automatic memory management, an interactive incremental development environment, a module system, a large number of powerful data structures, a large standard library of useful functions, a sophisticated object system supporting multiple inheritance and generic functions, an exception system, user-defined types and a macro system which allows programmers to extend the language.