Comsats Institute of Information Technology: Department of Computer Sciences
Comsats Institute of Information Technology: Department of Computer Sciences
INFORMATION TECHNOLOGY
Answer:
Structured
Structured programming helps code in a systematic and organized manner.
It combines the principles of top-down design, and, modularity. It has three
fundamental elements. Sequencing, meaning each step must logically must
progress in a logical manner without any undesired effects. Selection,
basically by applying specific conditions using if or else statements. The
third beings loops, by using for or while statements to tell how long a piece
of code is to be contentiously executed.
Modular programming
Modular programming is simply a programming technique which
emphasizes separating the functionality of a programming into
independent interchangeable modules. Modules being small chunks of
code which help lessen the complexity of a program and allow for
reusability of code. It uses the system of top-down design.
Functional programming
In Functional programming, the computation is treated as the evaluation of
mathematical functions and avoids using variables and mutable data,
primarily based on a theoretical framework like lambda calculus. It is a type
of Declarative Programming. Some examples of Functional Programming
are Lisp and Haskell.
QUESTION 2:
Highlight similarities and dissimilarities between them.
ANSWER:
SIMILARITIES:
DISSIMILARITIES:
QUESTION 3:
Merits and demerits of the 3 paradigms.
ANSWER:
Structured Programming:
It is less complex, it uses modularity thus allowing complex problems to be
solved logically by being broken down into small chunks or steps and be
solved more easily. Also using it makes the flow of control clear.
Its demerits include lack of reusability of code and using of top-down
method, thus restricting it to always starting from the top.
Modular Programming:
Since it uses modules for making programming, more than one
programmer can work on it at a time. Errors can be easily solved since only
the module will need to be fixed instead of the whole program.
Its demerits are that any mistake in linking multiple modules together can
lead to an error. Modules must be properly documented or else it can lead
to more problems.
Functional Programming
Functional programming is architecture independent. Users with a
mathematical background find it easier to use.
Since it doesn’t use any memory, each calculation must be carried out
multiple times, hence wasting the computers processing time.