Software consists of computer programs which are sequences of instructions for the computer

Now that we have talked about some of the many things computers are used for, the question that naturally arises is “How are computers able to accomplish all of these different tasks?”  The first thing to understand is that computer systems are composed of two major components: hardware and software.  Hardware consists of the actual electronic components that make up a computer.  

Unlike hardware, computer software is completely abstract.  It has no physical existence.  You cannot see, hear, touch, smell, or taste software.  Although it has no physical existence, software is real – as real as the color red, or the number five, or the concept of beauty.  One way to think of software is as “codified thought.”  

More formally, software consists of computer programs and the data on which they act.  Computer programs are algorithms expressed in a form that is executable by computers.  As mentioned earlier, an algorithm is a detailed sequence of steps that specifies how to solve a problem or accomplish some task.  So, computer programs are just sequences of instructions that a computer can follow to solve a problem or accomplish a task.  

It is important to note that the terms “program” and “algorithm” are not synonymous.  A description of how to sort a list of numbers is an algorithm.  For example, here is the selection sort algorithm:

  • Step 1: Remove the smallest item from the input list.
  • Step 2: Append this smallest item to the end of an output list.
    • (This output list will be empty when you first begin.)
  • Step 3: Repeat the above two steps until the input list is empty.

This sorting procedure is not a computer program, since it is written in English, rather than being expressed in a form that can be recognized by a computer.  

Algorithms, including procedures for searching and sorting, are discussed in Chapter .  Chapter continues our exploration of algorithms by introducing a language for drawing simple graphical images.  A Watson lab is included so that you can write programs in this language in order to create drawings and animation sequences.

Computer programs must be written in programming languages, such as Java, C++, JavaScript, or Visual BASIC.  Programming languages are formal systems for precisely specifying algorithms and their associated data structures in a form that can be recognized by a computer.  By “formal” we mean these languages are based on sets of rules that dictate how instructions must be formed and interpreted.  Programming languages are designed in such a way as to eliminate the ambiguity for which natural languages, such as English, are notorious.

Computer programs operate on data.  Data are the symbols, usually characters, or groups of characters, used to represent information that has meaning to people.  The words and pictures making up this book are data.  The meaning they convey to you as you read them is information.  One of the fascinating aspects of computers is that they have the ability to manipulate symbols without needing to understand the meaning of those symbols.  My word processing program allows me to edit this text, even though it cannot read English and has no notion of the meaning of these words.  

Computer programs read input data, manipulate that data in some way, and produce output.  A program of any complexity will need ways of organizing, or structuring, that data.  Hence, an understanding of data structures is critical to understanding computer software.  A data structure is a collection of data together with a group of operations that manipulate that data in certain predefined ways.  For example, the queue is a standard data structure that models a waiting line.  It supports two basic operations enqueue and dequeue.  “Enqueue” adds an item to the end of the waiting line.  “Dequeue” removes an item from the front of the waiting line.  Chapter examines a variety of data structures, including stacks, queues, lists, and trees.  The Watson lab associated with that chapter will allow you to directly experiment with the behavior of a number of these data structures.

Chapters and continue the study of software by examining the major types, or paradigms, of programming languages.  A paradigm is a way of thinking about a problem or modeling a problem solution.  There are at least three identifiable programming paradigms: the imperative paradigm, the functional paradigm, and the logical paradigm.  Some computer scientists view object-oriented programming as a fourth paradigm.  Others prefer to view objects as an extension to the imperative, functional, and logical paradigms.  Regardless, all four of these approaches are covered in the text – the imperative approach in Chapter , the functional, logical, and object-oriented approaches in Chapter .  A Watson lab has been constructed for the imperative paradigm.  This lab will help you gain additional insight into writing computer programs.

The vast majority of programs are written in imperative languages.  C++, Java, JavaScript, Perl, BASIC, Fortran, C, Pascal, Ada, Modula-2, and COBOL are all imperative languages.  The imperative paradigm derives its name from the fact that statements in imperative languages take the form of commands.  In English, imperative sentences, such as “eat your vegetables” or “take out the trash” are commands where the subject is understood to be “you” – “You take out the trash.”  Imperative programming languages are similar in that each statement is a command instructing the computer to perform some action.  An example of a statement written in the Watson Imperative Language is:

write( “What’s up Doc?”);

which instructs the computer to write the phrase “What’s up Doc?” on the display screen.

The functional paradigm is patterned after the mathematical concept of a function.  A function defines a mapping from inputs (i.e., the domain) to outputs (i.e., the range) in which a particular input sequence always maps to the same output.  Addition is an example of a function.  Simple addition takes a sequence of two numbers as input and produces a single number as output (e.g., 5 + 4 equals 9).  Notice that since addition is a function, the same input sequence always produces the same output.  This means, for example, that 5 + 4 must always equal 9 and never anything else.  While a particular input sequence must always generate the same output, it is often true that a function will map many different input sequences to the same output.  So, while 5 + 4 must always equal 9, so can 6 + 3 and 7 + 2 and 993 + -984.  Another key characteristic of functions is that they always return one, and only one, result.

In the functional paradigm, statements are functions to be evaluated.  This is different from the imperative paradigm in which statements are commands to be executed.  As a result, functional programs tend to take on the form of nested expressions, rather than sequences of commands.  Another difference between imperative and functional programs is that imperative languages generally store the results of computations in declared variables.  Functional languages avoid the use of declared variables.  Instead, values are computed as needed.  An example will help to illuminate these differences.

  • read (tempc);
  • tempf = (1.8 * tempc) + 32;
  • write(tempf);

(a) A code fragment written in the imperative style 

  • (write(add (multiply 1.8 (read)) 32))

(b) A code fragment written in the functional style

Examples of the functional and imperative paradigms

illustrates two implementations of an algorithm for converting temperature readings from Celsius to Fahrenheit.  Part (a) contains an imperative version of the algorithm while part (b) contains a functional version of the same algorithm.  Both code fragments do the same thing: read a temperature; multiply that temperature by 1.8; add 32 to the result; and then display the final answer.  

Don’t worry if some of the details of this example elude you.  Chapters and discuss imperative and functional programming much more thoroughly.  At this point all you need to recognize is that the various paradigms can produce quite different programs, even if those programs are based on the same underlying algorithm.

Lisp is an example of a programming language that belongs to the functional paradigm.  Surprisingly, even though Lisp is functional, its major use is not to perform mathematical computations.  Instead, Lisp is mainly used for what is called symbolic processing.  That is to say, Lisp is good for manipulating symbols, such as words, that represent concepts and ideas.  For this reason, Lisp is often used in the study of artificial intelligence, which attempts to build computer programs capable of displaying “human-like” intelligence.  

The logical paradigm, exemplified by the language Prolog, is another alternative to the standard imperative paradigm.  The logical paradigm is a style of programming based on predicate logic.  Programs written in this paradigm strive not to be simple encodings of algorithms, but instead to be precise statements of the problem to be solved.  Predicate logic is a formal system for deriving logically valid conclusions from a consistent set of facts and rules.  Since the system is formal, the process of reasoning can be automated using techniques such as resolution theorem proving.  Like Lisp, Prolog is often used in the study of artificial intelligence.

In essence, the programmer’s task in logic programming is to provide the computer with the pertinent facts and rules that describe the important aspects of a problem.  It is then the responsibility of an automated system, called the program interpreter or inference engine, to determine how the problem is to be solved.  This focus on describing what the problem is, is in sharp contrast to the imperative approach in which the program directly encodes how the problem is to be solved.  Because statements in logic-based languages represent declarations that are assumed to be true, rather than commands to be performed, this approach is sometimes referred to as the declarative paradigm.  Logic programming is further explored in Chapter .  

The object-oriented approach adds the concepts of objects and messages to the above paradigms.  Essentially, programs and the data on which they act are viewed as objects.  In order to perform a task an object must receive a message indicating that work needs to be done.  The object-oriented approach is well suited for implementing modern “point and click” program interfaces.  These interfaces consist of a number of graphical symbols, called icons, that are displayed on the screen.  Whenever a user clicks the mouse pointer on one of these icons, such as a button or scrollbar, a message is sent to the corresponding program object, causing it to execute.  Other distinguishing characteristics of object-oriented programs, including inheritance, polymorphism, and data encapsulation; are discussed in Chapter .

So far in this discussion of software, we have talked about algorithms, data structures, and programming paradigms.  Chapter focuses on a topic critical to the development of large computer programs – the topic of software engineering.  Software engineering is the study of the design, construction, and maintenance of large software systems.  

As the hardware capabilities of computers have increased, so have the expectations for the performance of software.  We expect programs to be friendly, easy to use, reliable, well documented, and attractive. Meeting these expectations often increases the size and complexity of a program.  Thus, over time, the average size of programs has tended to increase.

Many software systems represent a significant number of person-years of effort and are written by large teams of programmers.  These systems are so vast that they are beyond the comprehension of any single individual.  As computer systems become more and more intertwined into the fabric of modern life, the need for reliable software steadily increases.  As an example take the long distance telephone network.  This system consists of millions of lines of code written by thousands of people over decades – yet, it is expected to perform with complete reliability 24 hours a day, 7 days a week.  

Unfortunately, whereas the scaling up of hardware has been a straightforward engineering exercise, software production cannot be so easily increased to meet escalating demand.  This is because software consists of algorithms that are essentially written by hand, one line at a time.  As the demands of increasing reliability and usability have led to software systems that can not be understood by a single person, questions concerning the organization of teams of programmers have become critical.

These managerial issues are complicated by the unique nature of software production.  Programming is a challenging task in its own right, but its complexity is increased many fold by the need to divide a problem among a large group of workers.  How are such projects planned and completion dates specified?  How can large projects be organized so that individual software designers and programmers can come and go without endangering the stability of the project?  These are just some of the questions addressed by software engineering.

One of the cornerstones of software engineering is the software lifecycle: a model of how software is developed, used, maintained over time, and eventually discarded.  This model is helpful in predicting costs and allocating programming resources, but it suffers from inflexibility.  This inflexibility has led to the adoption of alternative software development models in recent years, such as rapid prototyping.  Newer models tend to focus on improving user satisfaction with the software (e.g., making programs more usable and user-friendly).

In addition to managing the development of individual software projects, software engineers also design tools for automating portions of the software development process.  For example, tools to assist with the creation of program documentation and testing are now common.  Such tools are often referred to as CASE tools, where CASE stands for Computer Aided Software Engineering.  

Is the sequences of instructions for the computer which comprise software?

A program is a sequence of instructions stored in main memory. When a program is run, the CPU fetches the instructions and executes or follows the instructions.

What is instruction program and software?

Instruction are simply order given to computer processor. It instruct computer to carry out function such as calculation, formatting, etc. It instruct computer to perform discreet action such as move, load decimal, etc. Programs are collection of software applications especially designed to execute specific task.

What is software of the computer?

Software is a set of instructions, data or programs used to operate computers and execute specific tasks. It is the opposite of hardware, which describes the physical aspects of a computer. Software is a generic term used to refer to applications, scripts and programs that run on a device.

How are the software program instructions in a computer system executed?

How Does a Program Run? The CPU runs instructions using a "fetch-execute" cycle: the CPU gets the first instruction in the sequence, executes it (adding two numbers or whatever), then fetches the next instruction and executes it, and so on.