Computer Science
Imperative programming
Imperative programming is a programming paradigm that focuses on describing how a program operates by giving a sequence of commands to execute. It is based on the idea of changing the program state by executing a series of statements that modify variables and data structures. Imperative programming is widely used in software development and is the foundation of many programming languages.
Written by Perlego with AI-assistance
Related key terms
1 of 5
7 Key excerpts on "Imperative programming"
- Mark C. Lewis, Lisa Lacher(Authors)
- 2016(Publication Date)
- Chapman and Hall/CRC(Publisher)
There are four main paradigms of programming. It is possible others could come into existence in the future, but what appears to be happening now is that languages are merging the existing paradigms. Scala is one of the languages that is blurring the lines between paradigms. To help you understand this we will run through the different paradigms. Basics of Computers, Computing, and Programming 11 1.5.1 Imperative programming The original programming paradigm was the imperative paradigm. That is because this is the paradigm of machine language. So all the initial programs written in machine language were imperative. Imperative programming involves giving the computer a set of instructions that it is to perform. Those actions change the state of the machine. This is exactly what you get when you write machine language programs. The two keys to Imperative programming are that the programmer specifically states how to do things and that the values stored by the computer are readily altered during the computation. The converse of Imperative programming would be declarative programming where the programmer states what is to be done, but generally is not specific about how it should be done. The Scala language allows imperative style programming and many of the elements of this book will talk about how to use the Imperative programming style in solving problems. 1.5.2 Functional Programming Functional programming was born out of the mathematical underpinnings of Computer Science. In the functional programming paradigm, the main program is written as a function that receives the program’s input as its arguments and delivers the program’s output as its result. The first functional languages were based very heavily on Alonzo Church’s lambda calculus. In a way this is in contrast to Imperative programming which bares a stronger resemblance to the ideas in the Turing machine.- eBook - PDF
- Kyla McMullen, Elizabeth Matthews, June Jamrich Parsons, , Kyla McMullen, Kyla McMullen, Elizabeth Matthews, June Jamrich Parsons(Authors)
- 2021(Publication Date)
- Cengage Learning EMEA(Publisher)
Disadvantage: Program execution speed is not optimal because declarative programming languages handle program flow in the same way for every program. Disadvantage: Programmers have to think outside of the imperative-paradigm box. Copyright 2022 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it. Module 27 PrograMMing ParadigMs 505 SUMMARY • Programming paradigms provide various approaches to designing, developing, and implementing com- puter programs. • Programming paradigms can be classified as imperative or declarative. Imperative programming para- digms focus on how by specifying the steps required to carry out a task. Declarative programming paradigms focus on what by describing the problem or task. • The procedural paradigm is an imperative approach based on step-by-step algorithms. It is character- ized by the use of variables, selection control structures, repetition control structures, and top-down decomposition. Programs based on the procedural paradigm typically run efficiently, but the approach is not optimal for all types of applications. • The object-oriented paradigm is an imperative approach based on the concept of objects interacting with each other. Programmers define templates called classes, generate objects from these classes, and define methods that perform tasks related to the objects. Features such as inheritance, polymorphism, and encapsulation provide flexibility and reusability, but at a possible cost to execution speed. • Declarative paradigms include logic programming, functional programming, and database query pro- gramming. - eBook - PDF
- Adele Kuzmiakova(Author)
- 2023(Publication Date)
- Arcler Press(Publisher)
Such programs may be an order of magnitude less than typical programs since loops, pointers, indices, and other details are taken out. The fundamental issue with descriptive programming is that computational operations like I/O to a screen or disc do not fit well with the paradigm, necessitating the use of standard programming tools (Aguado and Pine, 2002). There are two non-imperative language formalisms that we will explore programming may be divided into two types of programming: • Functional Programming: Programming that is depending upon the mathematical principles of pure functions, such as log and sin, which do not reconfigure their environments, in contrast to so-called functions in an ordinary language such as C, which may have drawbacks; • Logic Programming: Programs are demonstrated as formulas in mathematical logic, and the “compiler” tries to interpret the logical reasoning of such formulas to resolve issues. Programs written in an abstract, non-imperative language may not aspire to be as effective as hand-coded C programs. However, this is not the case. When a software system should search through enormous volumes of data or resolve issues whose answer may not be explicitly specified, non-imperative languages should be used instead of imperative ones. Pattern matching (genetics, vision), Language processing (style checking, translation), and optimization of the process are all instances of AI (scheduling). It is expected that these languages would become more popular as implementation methods improve and it becomes increasingly hard to construct dependable software systems in traditional programming languages (Jones, 2004). It is strongly suggested that students learn to program in logical and functional programming languages as their 1 st programming languages so that they learn how to work at high degrees of abstraction from the beginning as compared if they had been introduced to programming through C or Pascal. - No longer available |Learn more
- June Jamrich Parsons(Author)
- 2016(Publication Date)
- Cengage Learning EMEA(Publisher)
Copyright 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it. PROGRAMMING 8 0 3 11 THE DECLARATIVE PARADIGM Although procedural and object-oriented programming languages can deal with decisions and textual data, they begin to stumble when applied to problems with complex sequences of interrelated if...then branches. When dealing with problems that involve a spiderweb of logic, programmers can turn to declarative programming languages. This section focuses on the declarative paradigm by offering a little taste of the Prolog language. What is the declarative paradigm? In earlier sections of this unit, you learned that procedural programming focuses on a step-by-step algo-rithm, which instructs the computer how to arrive at a solution. You also learned that the object-oriented approach emphasizes classes and methods that form objects. In contrast, the declarative paradigm describes aspects of a problem that lead to a solution. As in the expression Well, I do declare!” programmers using declarative languages write code that declares, or states, facts pertaining to a program. The declarative paradigm might sound similar to the procedural paradigm, but it is fundamentally different. Whereas the procedural paradigm focuses on an algorithm that describes a solution, the declarative paradigm focuses on describing the problem. The procedural paradigm focuses on how ; the declarative paradigm focuses on what . - No longer available |Learn more
- (Author)
- 2014(Publication Date)
- College Publishing House(Publisher)
A programming language provides a structured mechanism for defining pieces of data, and the operations or transformations that may be carried out automatically on that data. A programmer uses the abstractions present in the language to represent the concepts involved in a computation. These concepts are represented as a collection of the simplest elements available (called primitives). Programming is the process by which programmers combine these primitives to compose new programs, or adapt existing ones to new uses or a changing environment. Programs for a computer might be executed in a batch process without human interaction, or a user might type commands in an interactive session of an interpreter. In this case the commands are simply programs, whose execution is chained together. When a language is used to give commands to a software application (such as a shell) it is called a scripting language. Measuring language usage It is difficult to determine which programming languages are most widely used, and what usage means varies by context. One language may occupy the greater number of programmer hours, a different one have more lines of code, and a third utilize the most CPU time. Some languages are very popular for particular kinds of applications. For example, COBOL is still strong in the corporate data center, often on large mainframes; FORTRAN in engineering applications; C in embedded applications and operating systems; and other languages are regularly used to write many different kinds of applications. - eBook - PDF
Inventing Software
The Rise of Computer-Related Patents
- Kenneth Nichols(Author)
- 1998(Publication Date)
- Praeger(Publisher)
The EGCR lists categories of exceptions to this rule, but the creator of a LISP-based invention might nonetheless prefer to avoid mathematical nota- tion in his or her disclosure. LISP offers an instance of a programming paradigm that is less compatible with the patent paradigm than either the imperative or the ob- ject-oriented paradigm. Declarative Paradigm If Imperative programming is concerned with the development of a se- ries of detailed step-by-step instructions that combine to produce a de- sired outcome, then the antithesis of this approach is perhaps epitomized by the techniques used in the logic programming style. The hallmark of logic programming is that it is one of the purest examples of declarative programming. Rather than being concerned with how a solution will be attained, a logic programmer concentrates on defining precisely the characteristics of the desired solution, leaving it to the computer to discover how this solution will be found. (Budd 1995) Declarative programming, as Budd points out, uses an approach that is radically different from the imperative model. Instead of framing the solu- tion as a task that can be broken down into small steps, the programmer casts the problem in terms of a set of rules to which the solution must conform. In declarative pseudocode, one might enter the following rules: Socrates is a man man is mortal Algorithms, Inventions, and Software 39 and receive the answer "yes" by posing the question is Socrates mortal? This simple example does not convey the full power of the declarative para- digm, though it suggests a common declarative-language application, the expert system, in which a body of knowledge is represented as a set of rules. Declarative programming involves the selection of rules rather than the se- lection of steps; the programmer does not necessarily know how the underly- ing language connects the rules to make correct inferences. - No longer available |Learn more
- (Author)
- 2014(Publication Date)
- Learning Press(Publisher)
A programming language provides a structured mechanism for defining pieces of data, and the operations or transformations that may be carried out automatically on that data. A programmer uses the abstractions present in the language to represent the concepts involved in a computation. These concepts are represented as a collection of the simplest elements available (called primitives). Programming is the process by which pro-grammers combine these primitives to compose new programs, or adapt existing ones to new uses or a changing environment. Programs for a computer might be executed in a batch process without human interaction, or a user might type commands in an interactive session of an interpreter. In this case the commands are simply programs, whose execution is chained together. When a language is used to give commands to a software application (such as a shell) it is called a scripting language. Measuring language usage It is difficult to determine which programming languages are most widely used, and what usage means varies by context. One language may occupy the greater number of pro-grammer hours, a different one have more lines of code, and a third utilize the most CPU time. Some languages are very popular for particular kinds of applications. For example, COBOL is still strong in the corporate data center, often on large mainframes; FORTRAN in engineering applications; C in embedded applications and operating systems; and other languages are regularly used to write many different kinds of applications.
Index pages curate the most relevant extracts from our library of academic textbooks. They’ve been created using an in-house natural language model (NLM), each adding context and meaning to key research topics.






