Professional Documents
Culture Documents
• Programming strategies
A programme strategy is a coherent set of programme activities designed to achieve a specified goal
or set of objectives. Computer programming is the process of writing code to facilitate specific actions
in a computer, application or software program, and instructs them on how to perform. Programming
is the implementation of logic to facilitate specified computing operations and functionality. It occurs
in one or more languages, which differ by application, domain and programming model. Programming
language semantics and syntax are used when constructing an application. Thus, programming
requires knowledge of application domains, algorithms and programming language expertise.
Programming language logic differs by developer. From a high level, good code can be evaluated with
factors such as:
Advantages of Programming
Disadvantages of Programming
Programming Paradigms
Programming paradigms are different ways or styles in which a given program or programming
language can be organized. Each paradigm consists of certain structures, features, and opinions about
how common programming problems should be tackled.
Imperative programming is a programming paradigm that uses statements that change a program's
state. An imperative program consists of commands for the computer to perform. It describes the
detail of how the results are to be obtained. How means describing the inputs and describing how the
outputs are produced.
Examples of imperative programming paradigm are C, Fortran, Basic, Java, C++, Python, Ruby, PHP,
etc.
Advantages
o Easy to implement.
o It contains loops, variables, etc.
o It is efficient.
Disadvantages
o Object-oriented Programming
o Procedural Programming
o Parallel Processing Approach
Object-oriented Programming
The object-oriented programming paradigm is based on the concept of object. An object contains
data in the form of fields that are known as attributes and the procedures are known as methods.
Since objects work independently, they are encapsulated into modules. we can communicate with an
object by using message passing.
Object-oriented programming can be achieved by using programming languages such as Java, C++,
C#, PHP, and Python, etc.
Procedural Programming
The paradigm deals with procedure calls that are called routines or functions. the functions contain a
series of computational commands to be carried out to achieve a certain outcome.
It is just like a procedure, with a list of step-by-step instructions for the computer program to follow.
The code can easily be reused in different parts of the program. The advantage of the paradigm is that
the code can be easy to learn and read in simple programs. Though, while dealing with a complex
problem, we run the risk of ending up with a huge volume of code.
The parallel programming paradigm breaks the problem or task into chunks that are distributed
among multiple processors. These chunks work on the same problem, simultaneously. It reduces the
total time to solve a problem. It connects multiple processors to the memory. It is either pooled across
all processors or distributed over a network.
Example of parallel programming paradigm is SISAL, Parallel Haskell, SequenceL, System C (for
FPGAs), Mitrion-C, VHDL, and Verilog, MPI.
Declarative programming is a style of building the structure and elements of computer programs. It
expresses the logic of a computation without describing its control flow. In other words, styles of
programming that are not imperative are called declarative programming paradigm. It
emphasizes what the program should accomplish.
Examples of declarative programming paradigm are Scala, Haskell, Erlang, Lisp, ML, Closure,
SQL, XSQL, etc.
Advantages
Disadvantages
o Difficult to understand.
o It is abed on an unfamiliar conceptual model.
o Difficult to accept characteristics of specific applications into account while programming.
o Functional Programming
o Logical Programming
o Database Processing Approach
Functional Programming
It is a subset of declarative programming. Programs that are written using the paradigm use functions,
blocks of codes, intended to behave like mathematical functions. It discourages changes in the value
of variables through the assignment. Instead makes a great deal with recursion.
Examples of functional programming Haskell, SML, Clojure, Scala, Erlang, Clean, F#, etc.
The Logical Paradigm adopts a decisive strategy to critical thinking. Different consistent declarations
about a circumstance are made, setting up totally known realities. The paradigm is divided into three
sections:
The data-driven programming paradigm depends on information and its development. In this
paradigm, the program statements are characterized by data instead of hard-coding a progression of
steps. A data set program is the core of a business data framework and gives document creation,
information section, update, query, and reporting functions.
There are a few programming dialects that are developed for the most part for data set applications.
For example, SQL. It is applied to surges of organized information, for filtering, transforming,
aggregating, or calling different projects. So, it has its own wide application.
Apart from the imperative and declarative programming approach, there is another paradigm that is
known as the multi-paradigm.
Multi-Paradigm
The programming languages that support more than one programming paradigm fall into this
category. The design goal of such languages is to allow programmers to use the most suitable
programming style associated with languages constructs for a given job.
The example of multi-paradigm programming languages is C++, Java, Python, etc. The languages
support object-oriented programming greater or lesser degree, typically in combination with
imperative and declarative programming paradigm.
Logic Predicate Logic formulas: axioms Logic proving of the Failure of success of
and a theorem theorem proving
Object-oriented Java, Python, C++, C#, Kotlin, Scala, Swift, Ruby, Perl, etc.
Parallel Processing SISAL, Parallel Haskell, SequenceL, System C (for FPGAs), Mitrion-C,
VHDL, and Verilog, MPI.
An abstract data type (ADT) is the specification of a data type within some language, independent of
an implementation. The interface for the ADT is defined in terms of a type and a set of operations on
that type. The behavior of each operation is determined by its inputs and outputs. An ADT does not
specify how the data type is implemented. These implementation details are hidden from the user of
the ADT and protected from outside access, a concept referred to as encapsulation. An object,
in object-oriented programming (OOP), is an abstract data type created by a developer. It can include
multiple properties and methods and may even contain other objects. In most programming
languages, objects are defined as classes.
A simple example of an object may be a user account created for a website. The object might define
as class user Account and contain attributes such as:
• first name
• last name
• email address
• password
• age
• location
• photo
Instead of recreating these properties each time a new user account is created, a web script can simply
instantiate a user Account object. Data assigned to the object may be stored in a database if the user
account is saved.
• Data Structures
A data structure is a storage that is used to store and organize data. It is a way of arranging data
on a computer so that it can be accessed and updated efficiently. A data structure is not only used
for organizing the data. It is also used for processing, retrieving, and storing data. There are
different basic and advanced types of data structures that are used in almost every program or
software system that has been developed.
Data Structures help programmers manage the data efficiently. They are a vital component of many
computer algorithms. With a data structure, vital operations can be performed with fewer resources.
An informed selection of data structures can improve the performance of a computer program or
software.
Computational complexity is a continuum, in that some algorithms require linear time (that is, the
time required increases directly with the number of items or nodes in the list, graph, or network
being processed), whereas others require quadratic or even exponential time to complete (that is, the
time required increases with the number of items squared or with the exponential of that number).
Generally, there is always more than one way to solve a problem in computer science with
different algorithms. Therefore, it is highly required to use a method to compare the solutions in
order to judge which one is more optimal. The method must be:
• Independent of the machine and its configuration, on which the algorithm is running
on.
• Shows a direct correlation with the number of inputs.
• Can distinguish two algorithms clearly without ambiguity.
There are two such methods used, time complexity and space complexity:
Time Complexity: The time complexity of an algorithm quantifies the amount of time taken by
an algorithm to run as a function of the length of the input. Note that the time to run is a function
of the length of the input and not the actual execution time of the machine on which the
algorithm is running on.
Space Complexity: The space complexity of an algorithm quantifies the amount of space taken
by an algorithm to run as a function of the length of the input.
We have declared a method named addNumbers() in a program. Now, to use the method, we need
to call it.