Javatpoint Logo
Javatpoint Logo

What is programming?

Programming is an exercise or practice that boost our logical thinking and improves a problem-solving skill. It teaches us how to accomplish a task with the help of a computer program or software. Therefore, in simple terms, programming is a task to implement a solution to a problem in the form of computer language. In this section, we will discuss the word programming, programming languages, its type, advantages, disadvantages, and their uses.

What is programming

Definition of Programming

In computer science fields, the word program characterizes what a computer actually does and this process is known as programming.

We can also define the term programming as it is the process that models or structure the set of instructions that instruct the machine how to perform a task and what to perform. It can be done using a variety of programming languages such as C, C++, C#, Python, Java, etc.

Advantages of Programming

  • It enhances problem-solving skills.
  • Using programming, we can solve complex problems.
  • It is also learning with fun.
  • It can perform multiple tasks can be bundled into one module.
  • It saves time and effort.

Disadvantages of Programming

  • Knowledge of computer is mandatory.
  • Logical thinking should be strong.

Programming Paradigms

In layman's terms, programming paradigms are a fundamental style of computer programming.

In technical terms, a programming paradigm is a way to deal with tackle issues utilizing some programming language. Additionally, we can say that it is a strategy to take care of an issue using tools and techniques that are accessible to us following some methodology.

It differs in the concepts and methods that are used to represent the elements (such as objects, variables, functions, and constraints) of a program. And the steps that involve a calculation (like assignations, evaluation, continuations, and data flows). The lowest programming paradigm is machine code.

There are lots of things for programming languages that are known. However, every one of them needs to follow some procedure when they are executed and this approach/methodology is a paradigm.

Types of Programming Paradigms

There is the following two programming paradigm:

  • Imperative Programming Paradigm
  • Declarative Programming Paradigm
What is programming

Imperative Programming Paradigm

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

  • Easy to implement.
  • It contains loops, variables, etc.
  • It is efficient.

Disadvantages

  • We cannot choose it for solving complex problems.
  • It is less efficient and less productive.
  • It is not suitable for parallel programming.
  • Order is crucial.

Types of Imperative Programming Paradigm

There are the following types of imperative programming paradigms:

  • Object-oriented Programming
  • Procedural Programming
  • 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.

Example of procedural programming is BASIC, C, and Pascal.

Parallel Processing Approach

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.

There are several programming languages that support parallel processing.

Example of parallel programming paradigm is SISAL, Parallel Haskell, SequenceL, System C (for FPGAs), Mitrion-C, VHDL, and Verilog, MPI.

Declarative Programming Paradigm

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

  • Efficient and shortcode
  • Referential Transparency
  • Idempotence
  • Error recovery
  • Readability
  • Commutativity
  • Easy optimization

Disadvantages

  • Difficult to understand.
  • It is abed on an unfamiliar conceptual model.
  • Difficult to accept characteristics of specific applications into account while programming.

Types of Declarative Programming Paradigms

  • Functional Programming
  • Logical Programming
  • 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.

Logical Programming

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:

  1. A series of definitions/affirmations that characterize the problem domain
  2. Statements of facts that are relevant
  3. Statement of objectives or goals in the form of query

Example of logical programming is PROLOG, SQL, etc.

Database Processing Approach

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.

Example of database processing approach programming is SQL (only DQL), QML, RDQL, and SPARQL.

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.

Usually, in a program, distinctive programming standards are utilized. Henceforth, programming dialects offer help (with various degrees) for the different standards.

The following table provides a brief description of programming paradigms.

Paradigms Key Concept Program Program Execution Result
Procedural Command Sequence of commands Execution of commands Final state of computer memory
Functional Function Collections of functions Executions of functions Value of the main function
Logic Predicate Logic formulas: axioms and a theorem Logic proving of the theorem Failure of success of proving
Object-oriented Object Collections of classes of objects Exchange of messages between the objects Final state of the object's state

The object-oriented paradigms state is the most abstract, as it's basic ideas can be easily combined with the principles and programming techniques of the other styles.

Programming Paradigm Programming Languages
Procedural FORTRAN, COBOL, ALGOL, BASIC, C, and Pascal.
Functional Haskell, SML, Clojure, Scala, Erlang, Clean, F#, etc.
Object-oriented Java, Python, C++, C#, Kotlin, Scala, Swift, Ruby, Perl, etc.
Logical PROLOG, SQL, etc.
Parallel Processing SISAL, Parallel Haskell, SequenceL, System C (for FPGAs), Mitrion-C, VHDL, and Verilog, MPI.
Database Processing Approach SQL (only DQL), QML, RDQL, and SPARQL.

Imperative Vs. Declarative Programming Paradigm

The following table describes the key differences between the imperative and declarative programming paradigm.

What is programming
Basis of Comparison Imperative Paradigm Declarative Paradigm
Programming Style Its style is step by step. Define what the problem is and what data transformations are needed.
Approach It follows a traditional approach. It follows a non-traditional approach.
Programmer Focuses It describes how to solve problems. It describes what the problem is.
Decision Capability The user makes decisions and instructs the compiler. It allows the compiler to make decisions.
Consist of It is a sequence of commands. It is a set of statements.
Flow It expresses control flow. It expresses data flow.
State Change It is important. It does not exist.
Primary Manipulation Unit Instances of classes and structure. Functions as first-class object and data collections.
Order of execution Order of execution is important. Order of execution is not important.
Example C, FORTRAN, Ada, Python, etc. PROLOG, LISP, Haskell, ASP, etc.

Code Comparison

Imperative Paradigm Declarative Paradigm
let array = [1, 2, 3, 4, 5, 6]
var sum = 0
var odd = []
for element in array
{
sum = sum + element
if element % 2 == 1
{
odds.append(element)
}
}
let numbers = [1, 2, 3, 4, 5, 6]
let sum = reduce(numbers, 0, +)
let odds = filter(numbers, {$0%2 == 1})

What is programming used for?

Computer programming is important nowadays because so much of our world is automated.

Humans need to be able to control the interaction between people and machines. Since computers and machines are able to do things so efficiently and accurately, we use computer programming to harness that computing power.

Therefore, programming is used for solving complex problems. It makes our task easy, and also saves time and effort.

Programming Process

Programming includes the different phases. It works on the edit-compile-verify approach. The following figure demonstrates the same.

What is programming

Programming Vs. Coding

In the computer science field, there are two buzzwords i.e., coding and programming. On hearing these two words sound similar but both are different words. These two words are used interchangeably.

Contrary, there are some differences between programming and coding as per the software development vocabulary.

What is programming

Programming

It is the process of developing a fully functional, error-free software program. It includes the following:

  • Planning
  • Designing
  • Testing
  • Deploying
  • Maintenance

We can say that programming is not only limited to coding. It also implements algorithms, data structures, and mitigating issues, and much more.

Coding

Coding is an act of interpreting codes from human language to machine-based language. We can also say that it is a subset of programming that gives foundation to programming. In coding, the programmer instructs the computer, what to perform.

The key difference between programming and coding is that programming is the process of developing a program or application that trails certain standards and performs a specified task.

Let's see the key differences between programming and coding.

Basis of Comparison Programming Coding
Definition Developing a fully-functional software is called programming. Converting natural language (required logic) into machine language is called coding.
Skill Required One must friendly with data structure, algorithm, and analytical skills. One must friendly with any programming language such as Java, C, C++, etc.
Task Included It includes analysis and conceptualization, debugging, compiling, testing, memory management, and implementation. Translates logic into machine code.
Tools Required Tools for analysis, code generator, database, data structure, testing frameworks, linkers, compilers, code editors, GUI designers, assemblers, debuggers, performance analysis tools are required in programming. It requires only text-editors such as WordPad or Notepad, IDE such as Eclipse, Bootstrap are required in coding.

Viewpoint An orderly approach and attention to minute details. Trial and error approach with no previous preparations.
Outcome We get a well-designed software, application, or website. We get a fully functional small piece of code.
Expertise While dealing with programming one must have experienced in creating algorithms, modeling problems, processing data. In coding, one must have knowledge of programming language, syntax related to language, keywords, etc.

After comparing coding and programming over a range of factors, we can conclude that coding is the initial step of programming that deals with interpreting the prerequisites and composing an alternate arrangement of codes to change over into a machine-justifiable grammar, while programming manages the following various parts of the executable projects to deliver the appropriate machine level yields according to the given user input.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA