0% found this document useful (0 votes)
28 views

CSC 403

Uploaded by

tempire.hky971
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

CSC 403

Uploaded by

tempire.hky971
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 25

CSC 403

MODULE 1

REASONS FOR STUDYING CONCEPTS OF PROGRAMMING


LANGUAGES

1. Increased ability to express ideas/algorithms In Natural language, the


depth at which people think is influenced by the expressive power of the
language they use. In programming language, the complexity of the
algorithms that people Implement is influenced by the set of constructs
available in the programming language
2. Improved background for choosing appropriate Languages Many
programmers use the language with which they are most familiar, even
though poorly suited for their new project. It is ideal to use the most
appropriate language.
3. Increased ability to learn new languages for instance, knowing the concept
s of object-oriented programming OOP makes learning Java significantly
easier and also, knowing the grammar of one’s native language makes it
easier to learn another language.
4. Better Understanding of Significance of implementation
5. Better use of languages that are already known
6. The overall advancement of computing

APPLICATION DOMAINS
1. Scientific Applications
2. Data processing Applications
3. Text processing Applications
4. Artificial intelligence Applications
5. Systems Programming Applications
6. Web software

CRITERIA FOR LANGUAGE EVALUATION AND COMPARISION


1. Expressivity
2. Well – Definedness
3. Data types and structures
4. Modularity
5. Input-Output facilities
6. Portability
7. Efficiency
8. Pedagogy
9. Generality
Expressivity means the ability of a language to clearly reflect the meaning
intended by the algorithm designer (the programmer). Thus an “expressive”
language permits an utterance to be compactly stated, and encourages the
use of statement forms associated with structured programming (usually
“while “loops and “if – then – else” statements).
By “well-definiteness”, we mean that the language’s syntax and semantics
are free of
ambiguity, are internally consistent and complete. Thus the implementer of a
well-defined language should have, within its definition a complete
specification of all the language’s expressive forms and their meanings. The
programmer, by the same virtue should be able to predict exactly the
behavior of each expression before it is actually executed.

By “Data types and Structures”, we mean the ability of a language to


support a variety of data values (integers, real, strings, pointers etc.) and
non elementary collect ions of these. Modularity has two aspects: the
language’s support for sub-programming and the language’s extensibility in
the sense of allowing programmer – defined operators and data types. By
sub programming, we mean the ability to define independent procedures
and functions (subprograms), and communicate via parameters or global
variables with the invoking program.

In evaluating a language’s “Input-Output facilities” we are looking at its


support for sequential, indexed, and random-access files, as well as its
support for database and information retrieval functions.

A language which has “portability” is one which is implemented on a variety


of computers. That is, its design is relatively” machine – independent”.
Languages which are well- defined tend to be more portable than others.

An “efficient” language is one which permits fast compilation and execution


on the machines where it is implemented. Traditionally, FORTRAN and
COBOL have been relatively efficient languages in their respective
application areas.

Some languages have better “pedagogy” than others. That is, they are
intrinsically easier to teach and to learn, they have better textbooks; they
are implemented in a better program development environment, they are
widely known and used by the best programmers in an application area.

Generality: Means that a language is useful in a wide range of programming


applications. For instance, APL has been used in mathematical applications
involving matrix algebra and in business applications as well.

Programming Languages

A Programming language is the language through which user can


communicate with the computer by writing program instructions. Every
computer programming language contains a set of predefined words and a
set of rules (syntax) that are used to create instructions of a program.

The evolution of programming languages reflects the changing needs,


priorities, and technological advancements in computing. From the early
mechanical and machine code languages to the modern, high-level
languages of today, each generation of languages has aimed to make
programming more powerful, expressive, and accessible.

Programming has come a long way since its inception in the 19th century,
with new technologies and innovations driving its evolution.

Programming is important because it enables us to create software,


websites, mobile apps, games, and many other digital products that we use
in our daily lives. It allows us to automate tasks, solve complex problems,
and create innovative solutions that improve our lives and businesses. In
today's digital age, programming skills are in high demand and are essential
for success in many industries, from tech to finance to healthcare. By
learning to code, we can open up a world of opportunities and take
advantage of the many benefits that technology has to offer.

Initially, programming was done using punch cards and it was a tedious and
time-consuming task. But with the invention of computers, programming
became more accessible and efficient. In this blog, we will take a closer look
at the evolution of programming languages, the history of programming,
types of programming languages, the future of programming, the role of AI
in programming, and the role of IDEs popular for programming.

Different types of Programming Languages


Programming language is divided into 3 categories based on the speed,
ease of use, memory and level of abstraction.
Machine language provides no abstraction, assembly language provides less
abstraction, and high-level language gives a higher amount of
abstraction(hiding internal details).

Low-Level Programming Languages


Low-level programming languages again consists of machine-level languages
and assembly-level languages.

o Machine Language - Machine language comes under the category of


low-level programming language that is built up of 0's and 1's. Some
high-level languages are compiled into machine-level languages, so
the computer understands the code.

o Assembly Language - Assembly language also comes under the


category of low-level programming language that is compiled by an
assembler. Translation of human-written code is converted into
machine code by these assemblers only.

Middle-Level Programming Languages


Middle-level programming languages are the programming languages that
have characteristics of both low-level and high-level languages.

C Language - The c programming language acts as a mediator between


hardware and programming layer. C is easy to understand and flexible. It is a
compiled language and does not use objects and classes. Compilers and
editors use C to design their applications.

High-Level Programming Languages

o Procedural Languages - Procedural languages are also programming


languages in which the written code will pass through many
procedures, and the computer executes the program. The language
helps to track errors easily and allows code reusability. It evolved from
structured programming languages, and the programs are broken up
into functions or routines here.
Examples of procedural languages are FORTRAN, COBOL,
SQL, and GO.

o Object-Oriented languages - The object-oriented programming


languages which use objects and classes to write code. The usage of
objects and classes makes it to solve real-world problems. The main
advantage of object-oriented languages is they are simple to use and
faster in execution. They follow a bottom-up approach and hence
callow to change the code easily. The most well-known object-oriented
programming languages are Java, R, Ruby, Python, C#,
JavaScript and Perl.

Others are

Declarative Languages

A declarative language is a programming language where the programmers


concentrate on the goal or result of the program. They need to pay attention
to achieve a goal. These languages check the relationship among the
statements and use deduction, induction, and abduction to give the output.
An example for a declarative language is "PROLOG," which is similar to
SQL(Structured Query Language) and works by evaluating logical
statements.

Scripting Languages

Scripting languages are the programming languages in which the code is


interpreted (program executes without converting into machine language )
without compilation. Interpretation means the very line of code is read and
executed. Still, in complied languages, the code is first translated into a low-
level code called machine code, then executed to give the program's output.
Scripting languages are used for smaller tasks like file manipulation and
designing operating system utilities. Examples of Scripting languages are
Pearl, PHP, and JavaScript.

Display Languages

Display languages are the languages that are used for displaying content on
web pages. The mostly used display languages are HTML, XML, and PHP.

o HTML is a Hypertext Markup Language used for designing websites


and web pages. Tim Berners-Lee developed it. It consists of anchor
tags to place URLs of other sites so that we can redirect to other
pages.

o XML - It is Extensible Markup Language used for transporting data


between different web pages. In XML, there are no predefined tags,
and users can define their tags and every tag opened should be closed.

o PHP - Hypertext Preprocessor is a server-side scripting language for


designing dynamic web pages. PHP is open-source which can be used
by anyone by simply installing the console to write programs. We can
combine the code written in HTML, CSS, and JavaScript by using PHP.

Document Formatting Languages

Document Formatting Languages are the programming languages that help


manage the printed text and graphics of a particular page in a document.
The language may come under various groups like text formatting, page
description language, or markup language.

Examples of Document Formatting Languages are TeX, PostScript, and


SGML.

Functional Languages
Functional languages are programming languages in which the bigger
functions are divided into smaller functions to solve complex problems.
Examples of functional languages are Java and Haskell.

o Should know about working with databases by using SQL and other
query languages.
What is the difference between Computer Science and Computer
Programming?
Computer programming includes creating and developing code to build new
things to eliminate problems and bring solutions by creating applications.
The job roles under the computer programming categories are software
developer, web developer, mobile application developer, and quality
assurance (QA) analyst.

Coming to computer science is a field with no application development but


involves solving problems by applying abstract algorithms. Computer
scientists develop ideas, and then computer programmers implement those
ideas by coding. The job roles which come under the computer science field
are software engineer, hardware engineer, system analyst, and software
architect. Hence without one field, the other cannot sustain.

History and Evolution of Programming

The history of programming dates back to the early 19th century when
mathematician Ada Lovelace created an algorithm for Charles Babbage's
Analytical Engine, which is considered the first computer. However, the first
actual programming language was developed in the 1950s, called FORTRAN
(Formula Translation). This language was used for scientific and engineering
calculations.

In the 1960s, programming languages such as COBOL (Common Business-


Oriented Language), BASIC (Beginners All-Purpose Symbolic Instruction
Code), and ALGOL (Algorithmic Language) were developed. These languages
were used to write applications for business and research.

The 1970s saw the development of languages such as C and Pascal, which
were used to write operating systems and applications. In the 1980s, the first
object-oriented language, Smalltalk, was created. This language allowed
developers to create reusable code and was used for graphical user
interfaces.

The 1990s saw the development of scripting languages such as Perl and
Python, which were used for web development. In the early 2000s,
languages such as Ruby and PHP became popular for web development.
Today, programming languages such as Java, C++, Python, and JavaScript
are widely used for various applications.

Logic plays a fundamental role in programming. Programming is essentially


the process of writing instructions for a computer to follow, and these
instructions must be logical and well-organized for the computer to execute
them correctly.

Programming requires logical thinking and the ability to break down complex
problems into smaller, more manageable parts. Programmers use logic to
develop algorithms, which are step-by-step procedures for solving problems.
These algorithms must be logical and accurate, with each step leading
logically to the next.

In programming, logical operators and conditional statements are used to


control the flow of a program. Logical operators such as AND, OR, and NOT
are used to evaluate logical expressions and make decisions based on the
results. Conditional statements such as IF, ELSE, and SWITCH are used to
execute different parts of a program based on specific conditions.

Thus, logic is a critical component of programming. Without it, programs


would not work correctly or produce the desired results. By developing
strong logical thinking skills, programmers can write efficient and effective
code that solves complex problems and meets the needs of users.

Types of Programming Languages

Programming languages can be broadly classified into three categories:

1. Low-Level Languages: These languages are closer to the machine


language and are used to write operating systems, device drivers, and
firmware. Examples include Assembly Language, C, and C++.
2. High-Level Languages: These languages are easier to learn and use
than low-level languages. They are used to write applications, games,
and websites. Examples include Java, Python, and Ruby.
3. Scripting Languages: These languages are used to automate repetitive
tasks, such as web development and system administration. Examples
include Perl, Python, and Ruby.

Early Foundations (1940s–1950s): Machine and Assembly Languages

 Machine Language: The earliest form of programming was in


machine language, consisting of binary code that directly controlled a
computer's hardware. Machine language was difficult to write and
understand due to its binary format, making it error-prone and highly
specialized for specific hardware.
 Assembly Language: To simplify coding, assembly language was
developed. Assembly language used mnemonic codes (like ADD, SUB)
instead of binary, making it easier to understand and write. However,
assembly languages were still specific to the architecture of a
particular machine, so programs written in assembly for one computer
could not be run on another without modification.

2. First Generation of High-Level Languages (1950s–1960s):


FORTRAN, COBOL, LISP

High-level languages introduced abstractions that allowed programmers to


focus on the logic of their code rather than hardware details.

 FORTRAN (1957): Short for FORmula TRANslation, FORTRAN was


designed by IBM for scientific and engineering applications. It
introduced structured syntax and control structures, enabling more
complex computations and reducing errors in complex calculations.
FORTRAN's focus on numerical computation made it popular in
academia and research.
 COBOL (1959): Created for business and data processing, COmmon
Business-Oriented Language (COBOL) was designed with a syntax
close to English, making it more readable. COBOL became widely used
in business and finance sectors for record-keeping and transaction
processing and is still in use in some legacy systems.
 LISP (1958): Developed by John McCarthy, LISt Processing (LISP)
introduced concepts like recursion, symbolic computation, and
dynamic memory allocation. LISP became the foundational language
for artificial intelligence research due to its flexible data structures and
support for manipulating symbolic expressions.

3. The 1960s–1970s: Structured Programming and Abstraction

The 1960s and 1970s saw a movement toward structured programming,


which emphasized clear, modular, and maintainable code.

 ALGOL (1960): ALGOrithmic Language (ALGOL) introduced structured


programming concepts and block structures, laying the groundwork for
many modern languages. ALGOL’s formalized syntax (Backus-Naur
Form) influenced language design, and its block structure allowed for
better organization and readability of code.
 Simula (1967): Developed by Norwegian researchers, Simula was the
first language to support object-oriented programming (OOP), a
concept that organizes code into "objects" representing real-world
entities. Simula’s concepts of classes and objects became core to OOP
languages that followed, especially in modeling simulations.
 Pascal (1970): Designed as a teaching tool, Pascal emphasized
structured programming and data structures, making it popular in
academia. Pascal introduced well-defined types and clean, readable
syntax, reinforcing good programming practices.

4. The 1980s: Rise of Object-Oriented Programming (OOP)

The 1980s marked a shift towards object-oriented programming, which


improved software organization, modularity, and reusability.

 C (1972): Although not an OOP language, C gained popularity in the


1980s for its efficiency and portability, especially with the rise of UNIX.
C’s control over hardware and memory made it ideal for system
programming and embedded systems, establishing it as one of the
most influential languages.
 Smalltalk (1980): Smalltalk, developed at Xerox PARC, is considered
the first fully object-oriented language. It introduced features like
message passing and dynamic typing. Smalltalk influenced later OOP
languages with its highly interactive programming environment.
 C++ (1985): Developed by Bjarne Stroustrup, C++ extended C with
object-oriented features. C++ gained popularity in software
development because it allowed both low-level system programming
and high-level application development. Its mix of procedural and
object-oriented features made it widely adopted for performance-
intensive applications like games and operating systems.

5. The 1990s: Scripting Languages and the Internet Boom

The 1990s saw the rapid expansion of the internet, which spurred the need
for languages that could handle dynamic content and web applications.

 Java (1995): Created by Sun Microsystems, Java was designed as a


platform-independent, secure language with a focus on portability.
Java introduced the write-once, run-anywhere (WORA) principle and
became widely used for web applets, enterprise applications, and later
Android development.
 Python (1991): Known for its readability and simplicity, Python was
developed to emphasize code readability and productivity. Its versatile
libraries and community support have made it one of the most popular
languages for a wide range of applications, from data science to web
development.
 JavaScript (1995): JavaScript was created to add interactivity to web
pages, and its adoption exploded with the growth of the internet. It
became the standard language for front-end development and evolved
with frameworks and libraries like React and Node.js to support both
client- and server-side development.

6. The 2000s–Present: Modern Languages and New Paradigms

Modern languages reflect the ongoing demands for scalability, performance,


and ease of use in an increasingly interconnected world.

 Ruby (1995) and PHP (1994): Ruby, with its Rails framework, and
PHP became popular for web development due to their ease of use and
rapid development cycles. Ruby on Rails pioneered the MVC (Model-
View-Controller) framework model for web applications, while PHP
became dominant in server-side scripting.
 C# (2000): Developed by Microsoft, C# was intended for the .NET
framework and influenced by Java and C++. It brought modern
language features into the Microsoft ecosystem and is widely used for
Windows applications, web services, and enterprise software.
 Swift (2014): Swift was developed by Apple as a modern language for
iOS and macOS development. It focuses on safety, performance, and
expressiveness, aiming to replace Objective-C for Apple development.
 Kotlin (2011): Kotlin was developed as an alternative to Java,
particularly for Android development. It features modern syntax, null
safety, and interoperability with Java, making it popular in the Android
ecosystem.
 Modern Trends:
o Functional programming has gained renewed interest with
languages like Haskell, Scala, and F#. Functional programming
encourages immutability and avoids side effects, making it
suitable for concurrent and parallel processing.
o Domain-Specific Languages (DSLs) are tailored for specific
application areas, such as SQL for database queries and R for
statistical analysis.
o Concurrent and Reactive Programming: Languages like Go and
Rust are designed with concurrency in mind, addressing the
need for efficient parallel execution in multi-core systems.
o Data Science and AI: Languages like Python and R dominate data
science, while specialized languages like Julia offer optimized
performance for scientific computing.

Differences between Machine-Level language and Assembly


language
The following are the differences between machine-level language and
assembly language:

Machine-level language Assembly language

The machine-level language comes The assembly language comes


at the lowest level in the hierarchy, above the machine language
so it has zero abstraction level from means that it has less abstraction
the hardware. level from the hardware.

It cannot be easily understood by It is easy to read, write, and


humans. maintain.

The machine-level language is The assembly language is written in


written in binary digits, i.e., 0 and simple English language, so it is
1. easily understandable by the users.

It does not require any translator as In assembly language, the


the machine code is directly assembler is used to convert the
executed by the computer. assembly code into machine code.

It is a first-generation programming It is a second-generation


language. programming language.

Differences between Low-Level language and High-Level language


The following are the differences between low-level language and high-level
language:

Low-level language High-level language


It is a machine-friendly language, It is a user-friendly language as this
i.e., the computer understands the language is written in simple English
machine language, which is words, which can be easily
represented in 0 or 1. understood by humans.

The low-level language takes more


It executes at a faster pace.
time to execute.

It requires the assembler to convert It requires the compiler to convert


the assembly code into machine the high-level language instructions
code. into machine code.

The machine code cannot run on all The high-level code can run all the
machines, so it is not a portable platforms, so it is a portable
language. language.

It is memory efficient. It is less memory efficient.

Debugging and maintenance are not Debugging and maintenance are


easier in a low-level language. easier in a high-level language.

Here is a list of programming languages and a brief explanation of each:

1. Java: Java is a high-level, object-oriented programming language


developed by Sun Microsystems (now owned by Oracle Corporation).
Java is designed to be platform-independent, meaning that Java code
can run on any computer with a Java Virtual Machine (JVM) installed.
Java is widely used for developing web applications, mobile apps, and
enterprise software.
2. Python: Python is a high-level, interpreted programming language that
emphasizes code readability and simplicity. Python is widely used for
scientific computing, data analysis, web development, and artificial
intelligence.
3. C: C is a low-level, compiled programming language that is widely used
for systems programming and embedded systems development. C is
known for its efficiency and control over hardware, making it an ideal
choice for developing operating systems, device drivers, and firmware.
4. C++: C++ is an extension of the C programming language that adds
support for object-oriented programming. C++ is widely used for
developing high-performance software, including operating systems,
games, and scientific simulations.
5. JavaScript: JavaScript is a high-level, interpreted programming
language that is widely used for developing web applications.
JavaScript runs in web browsers and provides interactivity and dynamic
behavior to web pages.
6. Ruby: Ruby is a high-level, interpreted programming language that
emphasizes simplicity and productivity. Ruby is widely used for web
development, automation, and scripting.
7. Swift: Swift is a high-level, compiled programming language developed
by Apple Inc. Swift is designed for developing applications for iOS,
macOS, and watchOS. Swift is known for its safety, speed, and
expressiveness.
8. PHP: PHP is a server-side, interpreted programming language that is
widely used for developing web applications. PHP is known for its
simplicity and ease of use, making it a popular choice for web
developers.
9. SQL: SQL (Structured Query Language) is a domain-specific language
used for managing relational databases. SQL is used to create, modify,
and query databases, and is widely used in business and data analysis.
10. Assembly language: Assembly language is a low-level
programming language that is used to write instructions for a
computer's CPU. Assembly language is difficult to read and write, but
provides direct access to hardware and can be used to write highly
optimized code.

There are many other programming languages in use today, each with its
strengths and weaknesses. Choosing the right programming language for a
particular task depends on a variety of factors, including the requirements of
the project, the developer's experience and expertise, and the availability of
tools and libraries.

To become a good programmer, there are several key skills that you should
develop:

1. Logical thinking: Programming requires logical thinking, the ability to


break down complex problems into smaller, manageable parts, and to
develop algorithms to solve them.
2. Attention to detail: Good programmers pay attention to detail, writing
clean, efficient, and error-free code.
3. Persistence: Programming can be challenging, and it often requires
persistence and patience to debug and solve problems.
4. Adaptability: Programming languages and technologies are constantly
evolving, so good programmers must be adaptable and willing to learn
new skills and techniques.
5. Collaboration: Programming often involves working in teams, so good
programmers must be able to collaborate effectively with others, share
their ideas, and give and receive constructive feedback.
6. Creativity: Programming can also be a creative process, requiring
programmers to come up with innovative solutions to problems and to
think outside the box.

By developing these skills and continuously learning and improving your


programming abilities, you can become a successful and highly skilled
programmer.

Future of Programming

The future of programming is bright, with new technologies such as artificial


intelligence, machine learning, and the Internet of Things (IoT) driving
innovation. With the increasing demand for intelligent applications and
systems, programming languages such as Python and R, which are used for
machine learning, are gaining popularity.

With the rise of low-code and no-code platforms, programming is becoming


more accessible to non-programmers, enabling them to build simple
applications without needing to write code. As technology advances,
programming will likely become more intuitive and user-friendly, enabling
anyone to create complex applications with ease.

Role of AI in Programming

Artificial intelligence is playing an increasingly important role in


programming. AI is being used to automate various aspects of programming,
such as code generation, testing, and debugging. With the help of machine
learning algorithms, AI can learn from past code to predict and suggest
solutions to programming problems.

AI is also being used to improve software development workflows, making it


easier for developers to collaborate and manage code. For example, GitHub,
a popular platform for hosting and sharing code, uses AI to provide code
suggestions and automate workflows.

Role of IDEs popular for Programming

Integrated Development Environments (IDEs) are software applications that


provide developers with tools for writing, testing, and debugging code. IDEs
are designed to streamline the development process, making it easier for
developers to write code and manage their projects. Some of the most
popular IDEs for programming include:

1. Visual Studio Code: This IDE is a lightweight and powerful tool that
supports many programming languages, including JavaScript, Python,
and C++. It has built-in debugging, Git integration, and extensions that
can enhance its functionality.
2. IntelliJ IDEA: This IDE is designed for Java developers and provides
advanced features such as code refactoring, code analysis, and
debugging. It also supports other programming languages such as
Python, Kotlin, and Scala.
3. Eclipse: This IDE is an open-source platform that supports many
programming languages, including Java, C++, and Python. It has a
modular architecture, making it easy to customize and extend its
functionality.
4. Xcode: This IDE is designed for macOS and iOS development and
supports languages such as Swift and Objective-C. It has a graphical
user interface that allows developers to create interfaces and design
layouts.

IDEs have become an essential tool for modern programming, allowing


developers to write and manage code more efficiently. With the rise of AI and
machine learning, IDEs are likely to become even more intelligent, providing
developers with better code suggestions and automated workflows.

Here are some popular Integrated Development Environments (IDEs) and a


brief explanation of each:

1. Eclipse: Eclipse is a popular open-source IDE for Java development, but it


also supports many other programming languages, such as C++, Python,
and PHP. Eclipse offers a wide range of plugins and extensions, making it
highly customizable and extensible.

2. Visual Studio: Visual Studio is a popular IDE for Windows development,


offering support for multiple programming languages, including C#, Visual
Basic, and Python. Visual Studio offers many features, such as code editing,
debugging, and profiling tools.

3. IntelliJ IDEA: IntelliJ IDEA is an IDE designed for Java development,


offering features such as intelligent code completion, refactoring tools, and
debugging capabilities. IntelliJ IDEA is known for its speed and productivity.

4. Xcode: Xcode is an IDE for macOS and iOS development, offering


features such as a visual editor, debugging tools, and testing frameworks.
Xcode also includes a wide range of templates and tools for developing Apple
applications.
5. PyCharm: PyCharm is an IDE for Python development, offering features
such as code completion, debugging, and testing tools. PyCharm also
includes support for scientific computing and data analysis libraries.

Using an IDE effectively involves using its features and tools to streamline
the development process and improve productivity. Here are some tips for
using an IDE effectively:

1. Customize your environment: Take advantage of the customization


options available in your IDE, such as keyboard shortcuts, color schemes,
and code templates. This can help you work more efficiently and reduce
distractions.

2. Use code completion: Most IDEs offer code completion features, which
can save you time and reduce errors by suggesting code as you type.

3. Debug effectively: Use the debugging tools in your IDE to identify and fix
errors in your code. Learn how to set breakpoints, step through code, and
inspect variables to find the root cause of problems.

4. Use version control: IDEs often offer integration with version control
systems such as Git. Learning how to use version control effectively can help
you collaborate with other developers, manage changes to your codebase,
and roll back changes if necessary.

5. Learn keyboard shortcuts: Learning keyboard shortcuts for common


tasks can save you time and improve your productivity. Take the time to
learn the most important shortcuts for your IDE and incorporate them into
your workflow.

In conclusion, programming has evolved significantly over the years, from


punch cards to modern programming languages and IDEs. As technology
continues to advance, the future of programming looks bright, with AI and
machine learning driving innovation and making programming more
accessible and intuitive. The role of IDEs will also continue to grow, providing
developers with better tools and workflows to create amazing applications
and systems.

Programming Paradigm

Managing complexity is a programmer’s main concern. So how do


programmers deal with complexity? There are many general approaches that
reduce complexity in a program or make it more manageable. One of the
main approaches is a programming paradigm.
The term programming paradigm refers to different ways or styles in
which a given program or programming language can be organized. It does
not refer to a specific language, but rather it refers to the way you program.
There are lots of programming languages that are well-known but all of them
need to follow some strategy when they are implemented. And that strategy
is a paradigm.

Each paradigm consists of certain structures, features, and opinions about


how common programming problems should be tackled. The question of why
are there many different programming paradigms is similar to why are there
many programming languages. Certain paradigms are better suited for
certain types of problems, so it makes sense to use different paradigms for
different kinds of projects.

Programming paradigms are not languages or tools. You can't "build"


anything with a paradigm. They're more like a set of ideals and guidelines
that many people have agreed on, followed, and expanded upon.

Programming languages aren't always tied to a specific paradigm. There are


languages that have been built with a certain paradigm in mind and have
features that facilitate that kind of programming more than others
(Haskel and functional programming is a good example).
But there are also "multi-paradigm" languages, meaning you can adapt your
code to fit a certain paradigm or another (JavaScript and Python are good
examples).

At the same time, programming paradigms aren't mutually exclusive, in the


sense that you could use practices from different paradigms at the same
time with no problem at all.

The types of programming paradigms


There is the following two programming paradigm:

o Imperative Programming Paradigm

o Declarative Programming Paradigm


Imperative (Focus on How): is the oldest and most basic programming
approach. Within the imperative paradigm, code describes a step-by-step
process for a program’s execution. Developers are more concerned with how
to get an answer step by step.
It is one of the oldest programming paradigm. It is based on Von Neumann
architecture. It works by changing the program state through assignment
statements. It performs step by step task by changing state. The main
focus is on how to achieve the goal. The paradigm consists of several
statements and after execution of all the result is stored. Its types
include- procedural and object-oriented programming. Ex- Java, C,
Python, Ruby etc.
#include <iostream>

int main() {
// Array to store marks
int marks[5] = { 12, 32, 45, 13, 19 };

// Variable to store the sum of marks


int sum = 0;

// Variable to store the average


float average = 0.0;

// Calculate the sum of marks


for (int i = 0; i < 5; i++) {
sum = sum + marks[i];
}

// Calculate the average


average = sum / 5.0;

// Output the average


std::cout << "Average of five numbers: " << average << std::endl;

return 0;
}

Output
Average of five numbers: 24.2

Advantages

o Easy to implement.

o It contains loops, variables, etc.

o It is efficient.

Disadvantages

o We cannot choose it for solving complex problems.

o It is less efficient and less productive.

o It is not suitable for parallel programming.

o Order is crucial.
Examples of Imperative programming paradigm:
C : developed by Dennis Ritchie and Ken Thompson
Fortran : developed by John Backus for IBM
Basic : developed by John G Kemeny and Thomas E Kurtz

Types of Imperative Programming Paradigm

There are the following types of imperative programming paradigms:

o Object-oriented Programming

o Procedural Programming

o Parallel Processing Approach

Object oriented programming


The program is written as a collection of classes and object which are
meant for communication. The smallest and basic entity is object and all
kind of computation is performed on the objects only. More emphasis is on
data rather procedure. It can handle almost all kind of real-life problems
which are today in scenario.
Advantages:
 Data security
 Inheritance
 Code reusability
 Flexible and abstraction is also present
Examples of Object-Oriented programming paradigm:
Simula: first OOP language
Java: developed by James Gosling at Sun Microsystems
C++: developed by Bjarne Stroustrup
Objective-C: designed by Brad Cox
Visual Basic .NET: developed by Microsoft
Python: developed by Guido van Rossum
Ruby: developed by Yukihiro Matsumoto
Smalltalk: developed by Alan Kay, Dan Ingalls, Adele Goldberg

// C++ program for the above approach


#include <bits/stdc++.h>
using namespace std;

// Class Signup
class Signup {
int userid;
string name;
string emailid;
char sex;
long mob;

public:
// Function to create and object using
// the parameters
void create(int userid, string name, string emailid,
char sex, long mob)
{
cout << "Welcome to GeeksforGeeks\nLets create "
"your account\n";
this->userid = 132;
this->name = "Radha";
this->emailid = "[email protected]";
this->sex = 'F';
this->mob = 900558981;
cout << "your account has been created" << endl;
}
};

// Driver Cpde
int main()
{
cout << "GfG!" << endl;

// Creating Objects
Signup s1;
s1.create(22, "riya", "[email protected]", 'F', 89002);

return 0;
}

Output
GfG!
Welcome to GeeksforGeeks
Lets create your account

your account has been created

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.

#include <iostream>
using namespace std;
int main()
{
int i, fact = 1, num;
cout << "Enter any Number: ";
cin >> number;
for (i = 1; i <= num; i++) {
fact = fact * i;
}
cout << "Factorial of " << num << " is: " << fact << endl;
return 0;
}

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, C/C++
also supports because of some library function.

Declarative (Focus on What): writing declarative code forces you to ask first

what you want out of your program.


It is divided as Logic, Functional, Database. In computer science
the declarative programming is a style of building programs that expresses
logic of computation without talking about its control flow. It often considers
programs as theories of some logic. It may simplify writing parallel
programs. The focus is on what needs to be done rather how it should be
done basically emphasize on what code is actually doing. It just declares
the result we want rather how it has been produced. This is the only
difference between imperative (how to do) and declarative (what to do)
programming paradigms. Getting into deeper we would see logic, functional
and database.

Logic programming paradigms

It can be termed as abstract model of computation. It would solve logical


problems like puzzles, series etc. In logic programming we have a
knowledge base which we know before and along with the question and
knowledge base which is given to machine, it produces result. In normal
programming languages, such concept of knowledge base is not available
but while using the concept of artificial intelligence, machine learning we
have some models like Perception model which is using the same
mechanism.
In logical programming the main emphasize is on knowledge base and the
problem. The execution of the program is very much like proof of
mathematical statement, e.g., Prolog
predicates
sumoftwonumber(integer, integer).
clauses
sumoftwonumber(0, 0).
sumoftwonumber(N, R) :-
N > 0,
N1 is N - 1,
sumoftwonumber(N1, R1),
R is R1 + N.

Functional programming paradigms

The functional programming paradigms has its roots in mathematics and it


is language independent. The key principle of this paradigms is the
execution of series of mathematical functions. The central model for the
abstraction is the function which are meant for some specific computation
and not the data structure. Data are loosely coupled to functions. The
function hide their implementation. Function can be replaced with their
values without changing the meaning of the program. Some of the
languages like perl, javascript mostly uses this paradigm.

Examples of Functional programming paradigm:


JavaScript : developed by Brendan Eich
Haskell : developed by Lennart Augustsson, Dave Barton
Scala : developed by Martin Odersky
Erlang : developed by Joe Armstrong, Robert Virding
Lisp : developed by John Mccarthy
ML : developed by Robin Milner
Clojure : developed by Rich Hickey

The next kind of approach is of Database.

Database/Data driven programming approach –

This programming methodology is based on data and its movement.


Program statements are defined by data rather than hard-coding a series of
steps. A database program is the heart of a business information system
and provides file creation, data entry, update, query and reporting
functions. There are several programming languages that are developed
mostly for database application. For example, SQL. It is applied to streams
of structured data, for filtering, transforming, aggregating (such as
computing statistics), or calling other programs. So it has its own wide
application.
CREATE DATABASE databaseAddress;
CREATE TABLE Addr (
PersonID int,
LastName varchar(200),
FirstName varchar(200),
Address varchar(200),
City varchar(200),
State varchar(200)
);

You might also like