Hardware and Software Concepts:Software Overview

Software Overview

In this section we review basic concepts of computer programming and software. Programmers write instructions in various programming languages; some are directly understandable by computers, while others require translation. Programming languages can be classified generally as either machine, assembly or high-level languages.

Machine Language and Assembly Language

A computer can understand only its own machine language. As the “natural language” of a particular computer, machine language is defined by the computer’s hardware design. Machine languages generally consist of streams of numbers (ultimately reduced to 1s and 0s) that instruct computers how to perform their most elementary operations. Machine languages are machine dependent—a particular machine language can be used on only one type of computer. The following section of an early machine-language program, which adds overtime pay to base pay and stores the result in gross pay, demonstrates the incomprehensibility of machine language to humans:

1300042774

1400593419

1200274027

As the popularity of computers increased, machine-language programming proved to be slow and error prone. Instead of using the strings of numbers that computers could directly understand, programmers began using English-like abbreviations to represent the computer’s basic operations. These abbreviations formed the basis of assembly languages. Translator programs called assemblers convert assembly- language programs to machine-language. The following section of a simplified assembly-language program also adds overtime pay to base pay and stores the result in gross pay, but it presents the steps somewhat more clearly to human readers:

LOAD BASEPAY

ADD OVERPAY STORE GROSSPAY

This assembly-language code is clearer to humans, but computers cannot under- stand it until it is translated into machine language by an assembler program.

Self Review

1. (T/F) Computers typically execute assembly code directly.

2. Is software written in machine language portable?

Ans: 1) False. Assemblers translate assembly code into machine-language code before the code can execute. 2) No; machine languages are machine dependent, so software written in machine language executes only on machines of the same type.

Interpreters and Compilers

Although programming is faster in assembly languages than in machine language, assembly languages still require many instructions to accomplish even the simplest tasks. To increase programmer efficiency, high-level languages were developed. High-level languages accomplish more substantial tasks with fewer statements, but require translator programs called compilers to convert high-level language pro- grams into machine language. High-level languages enable programmers to write instructions that look similar to everyday English and that contain common mathematical notations. For example, a payroll application written in a high-level language might contain a statement such as

grossPay = basePay + overTimePay

This statement produces the same result as the machine-language and assembly- language instructions in the prior sections.

Whereas compilers convert high-level language programs to machine lan- guage programs, interpreters are programs which directly execute source code or code has been reduced to a low-level language that is not machine code. Programming languages such as Java compile to a format called bytecode (although Java also can be compiled to machine language), which acts as machine code for a so-called virtual machine. Thus, bytecode is not dependent on the physical machine on which it executes, which promotes application portability.A Java interpreter analyzes each statement and executes the bytecode on the physical machine. Due to the execution- time overhead incurred by translation, programs executed via interpreters tend to execute slower than those that have been compiled to machine code.38, 39

Self Review

1. Discuss the benefits of high-level languages over assembly languages.

2. Why are programs compiled to bytecode more portable than those compiled to machine code?

Ans: 1) High-level language programs require many fewer instructions than assembly-lan- guage programs; also, programming in high-level languages is easier than in assembly language because high-level languages more closely mirror everyday English and common mathematical notations. 2) Bytecode is compiled to execute on a virtual machine that can be installed on many different platforms. By contrast, programs compiled to machine language can execute only on the type of machine for which the program was compiled.

High-Level Languages

Although hundreds of high-level languages have been developed, relatively few have achieved broad acceptance. Today, programming languages tend to be either structured or object oriented. In this section we enumerate some of the more popu- lar languages, then discuss how they relate to each programming model.

IBM developed Fortran in the mid-1950s to create scientific and engineering applications that require complex mathematical computations. Fortran is still widely used, mainly in high-performance environments such as mainframes and supercomputers.

COmmon Business Oriented Language (COBOL) was developed in the late 1950s by a group of computer manufacturers, government agencies and industrial computer users. COBOL is designed for business applications that manipulate large volumes of data. A considerable portion of today’s business software is still programmed in COBOL.

The C language, which Dennis Ritchie developed at Bell Laboratories in the early 1970s, gained widespread recognition as the development language of the UNIX operating system. In the early 1980s at Bell Laboratories, Bjarne Stroustrup developed C++, an extension of C. C++ provides capabilities for object-oriented programming (OOP). Objects are reusable software components that model items in the real world. Object-oriented programs are often easier to understand, debug and modify than programs developed with previous techniques. Many of today’s popular operating systems are written in C or C++.

When the World Wide Web exploded in popularity in 1993, Sun Microsystems saw immediate potential for using its new object-oriented Java programming language to create applications that could be downloaded over the Web and executed in Web browsers. Sun announced Java to the public in 1995, gaining the attention of the business community because of the widespread interest in the Web. Java has become a widely used software development language; it is used to generate Web pages dynamically, build large-scale enterprise applications, enhance the functionality of Web servers, provide applications for consumer devices (for example, cell phones, pagers and PDAs) and for many other purposes.

In 2000, Microsoft announced C# (pronounced “C-Sharp”) and its .NET strategy. The C# programming language was designed specifically to be the key development language for the .NET platform; it has roots in C, C++ and Java. C# is object- oriented and has access to .NET’s powerful library of prebuilt components, enabling programmers to develop applications quickly.

Self Review

1. Classify each of the following programming languages as structured or object oriented:

a) C#; b) C; c) Java; d) C++.

2. What are some benefits of OOP?

Ans: 1) a) object oriented; b) structured; c) object oriented; d) object-oriented. 2) Object-oriented programs are often easier to understand, debug and modify than programs developed with previous techniques. Also OOP focuses on creating reusable software components.

Structured Programming

During the 1960s, software development efforts often ran behind schedule, costs greatly exceeded budgets and finished products were unreliable. People began to realize that software development was a far more complex activity than they had imagined. Research activity addressing these issues resulted in the evolution of structured programminga disciplined approach to creating programs that are clear, correct and easy to modify.

This research led to the development of the Pascal programming language by Professor Nicklaus Wirth in 1971. Pascal was named after the 17th-century mathematician and philosopher Blaise Pascal. Designed for teaching structured programming, it rapidly became the preferred introductory programming language at most colleges. The language lacked many features needed to make it useful in commercial, industrial and government applications.

The Ada programming language was developed under the sponsorship of the U.S. Department of Defense (DoD) during the 1970s and early 1980s. It was named after Lady Ada Lovelace, daughter of the poet Lord Byron. Lady Lovelace is gen- erally credited as being the world’s first computer programmer, having written an application in the middle 1800s for the Analytical Engine mechanical computing device designed by Charles Babbage. Ada was one of the first languages designed to facilitate concurrent programming, which is discussed with examples in pseudocode and Java in Chapter 5, Asynchronous Concurrent Execution, and Chapter 6, Con- current Programming.

Self Review

1. What problems in early software development did structured programming languages address?

2. How did the Ada programming language differ from other structured programming languages such as Pascal and C?

Ans: 1) In the early days of programming, developers did not have a systematic approach to constructing complex programs, resulting in unnecessarily high costs, missed deadlines and unreliable products. Structured programming filled the need for a disciplined approach to software development. 2) Ada was designed to facilitate concurrent programming.

Object-Oriented Programming

As the benefits of structured programming were realized in the 1970s, improved software technology began to appear. However, not until object-oriented programming became widely established in the 1980s and 1990s did software developers

finally feel they had the necessary tools to improve the software development process dramatically.

Object technology is a packaging scheme for creating meaningful software units. Almost any noun can be represented as a software object. Objects have properties (also called attributes), such as color, size and weight; and they perform actions (also called behaviors or methods), such as moving, sleeping or drawing. Classes are types of related objects. For example, all cars belong to the “car” class, even though individual cars vary in make, model, color and options packages. A class specifies the general format of its objects, and the properties and actions avail- able to an object depend on its class. An object is related to its class in much the same way as a building is related to its blueprint.

Before object-oriented languages appeared, procedural programming languages (such as Fortran, Pascal, BASIC and C) focused on actions (verbs) rather than objects (nouns). This made programming a bit awkward. However, using today’s pop- ular object-oriented languages, such as C++, Java and C#, programmers can program in an object-oriented manner that more naturally reflects the way in which people perceive the world, resulting in significant gains in programmer productivity.

Object technology permits properly designed classes to be reused in multiple projects. Using libraries of classes can greatly reduce the effort required to implement new systems. However, some organizations report that the key benefit from object-oriented programming is not software reusability, but rather the production of software that is more understandable because it is better organized and easier to maintain.

Object-oriented programming allows programmers to focus on the “big picture.” Instead of worrying about the minute details of how reusable objects are implemented, they can focus on the behaviors and interactions of objects. Programmers can also focus on modifying one object without worrying about the effect on another object. A road map that shows every tree, house and driveway would be difficult, if not impossible, to read. When such details are removed and only the essential information (roads) remains, the map becomes easier to understand. In the same way, an application that is divided into objects is easier to understand, modify and update because it hides much of the detail.

Self Review

1. How is the central focus of object-oriented programming different from that of structured programming?

2. How do objects facilitate modifications to existing software?

Ans: 1) Object-oriented programming focuses on manipulating objects (nouns), whereas procedural programming focuses on actions (verbs). 2) Objects hide much of the detail of an overall application, allowing programmers to focus on the big picture. Programmers can focusing on modifying one object without worrying about the effect on another object.

Comments

Popular posts from this blog

Input Output (IO) Management:HW/SW Interface and Management of Buffers.

Introduction to Operating Systems:Early History: The 1940s and 1950s

Input Output (IO) Management:IO Organization.