Skip to main content

1996 | Buch

C A Software Engineering Approach

verfasst von: Peter A. Darnell, Philip E. Margolis

Verlag: Springer New York

insite
SUCHEN

Über dieses Buch

to Software Engineering For 'tis the sport to have the engineer Hoist with his own petar. Shakespeare, Hamlet In the previous chapter, we introduced same basic information about pro­ gramming and programming languages, particularly C. If this were a book about building bridges, this first chapter might have been an introduction to the tools you would neeci-hammer, saw, drill, etc. Obviously there is a lot more to building a good bridge than simply knowing how to use the tools. Similarly, creating software products requires considerably more skill than simply wielding the programming tools. There is an entire discipline called software engineering that deals with designing, creating, testing, and maintaining large software products. In this chapter we introduce some key software engineering themes, many of which we will revisit through­ out the course of the book. 10 2: Introduction to Software Engineering 2.1 Introduction Though the cost of computer hardware-the silicon chips containing the millions of transistors that form the instruction set and memories-has shown a consistent trend downward over the years, the cost of software has not followed suit. The high cost of software is due largely (and para­ doxically) to the ease and flexibility with which it can be shaped.

Inhaltsverzeichnis

Frontmatter
1. Introduction to Programming
Abstract
Although computers are capable of performing complex and difficult operations, they are inherently simple-minded and docile machines. They must be told exactly what to do, and they must be instructed in a precise and limited language that they can comprehend. These instructions are known as software. The machinery that actually executes the instructions is known as hardware.
Peter A. Darnell, Philip E. Margolis
2. Introduction to Software Engineering
Abstract
In the previous chapter, we introduced same basic information about programming and programming languages, particularly C. If this were a book about building bridges, this first chapter might have been an introduction to the tools you would need—hammer, saw, drill, etc. Obviously there is a lot more to building a good bridge than simply knowing how to use the tools.
Peter A. Darnell, Philip E. Margolis
3. C Essentials
Abstract
One of the most difficult parts about learning a programming language is that everything is interrelated. It often seems impossible to understand anything before you know everything. In this chapter, we describe the C essentials—what you need to know to write your first programs. To avoid getting bogged down in details, we gloss over some of the intricacies of the C language in this chapter. In later chapters, we provide a more thorough discussion of the topics introduced in this chapter.
Peter A. Darnell, Philip E. Margolis
4. Scalar Data Types
Abstract
The ability to divide data into different types is one of the most important features of modern programming languages. It enables you to work with relatively complex objects instead of the more mundane objects that the computer manipulates at its lowest level. You can deal with integers, characters, and floating-point numbers, all of which are familiar entities. At the bit and byte level, the computer may not understand these concepts. It is up to the compiler, therefore, to make sure that the computer handles bits and bytes in a way consistent with their data type. A data type is really just an interpretation applied to a string of bits.
Peter A. Darnell, Philip E. Margolis
5. Control Flow
Abstract
The programs listed in the previous chapter were architecturally simple because they were straight line programs. That is, statements were executed in the order in which they appeared without any branching or repetition. Most programming problems are not so simple. In fact, the great power of programming languages stems from their ability to instruct the computer to perform the same task repeatedly, or to perform a different task if parameters change. In high-level programming languages, this is accomplished with control flow statements that allow you to alter the sequential flow. Control flow statements fall into two general categories: conditional branching and looping. Conditional branching is the ability to decide whether or not to execute code based on the value of an expression. Looping, also called iteration, is the ability to perform the same set of operations repeatedly until a special condition is met.
Peter A. Darnell, Philip E. Margolis
6. Operators and Expressions
Abstract
Operators are the verbs of the C language that let you calculate values. C’s rich set of operators is one of its distinguishing characteristics. In the preceding chapters, you have already seen a number of C operators, such as + (addition), /(division), < (less than), and = (assignment). The operator symbols are composed of one or more special characters. If an operator consists of more than one character, you must enter the characters without any intervening spaces:
$$x \Leftarrow y\;/ * \,legal\,expression\,*/$$
$$x \Leftarrow y\;/ * \,illegal\,expression\,*/$$
Peter A. Darnell, Philip E. Margolis
7. Arrays and Pointers
Abstract
We have already introduced pointers as one of the scalar data types. In this chapter, we examine pointers more closely and introduce an aggregate type called an array. Arrays and pointers are closely related in C. Together, they represent some of the most powerful features of the C language and probably account, as much as anything, for C’s popularity.
Peter A. Darnell, Philip E. Margolis
8. Storage Classes
Abstract
Most large programs are written by teams of programmers. After they design the general outline of the program together, each programmer goes off and writes an isolated piece of the program. When everyone is finished, all the pieces are linked together to form the complete program. For this process to work, there must be a mechanism to ensure that variables declared by one programmer don’t conflict with unrelated variables of the same name declared by another programmer. On the other hand, there is usually some data that needs to be shared between different source files, so there must also be a mechanism that ensures that some variables declared in different files do refer to the same memory locations and that the computer interprets those locations in a consistent fashion. In C, you define whether a variable is to be shared, and which portions of code can share it, by designating its scope.
Peter A. Darnell, Philip E. Margolis
9. Structures and Unions
Abstract
Arrays are good for dealing with groups of identically typed variables, but they are unsatisfactory for managing groups of differently typed data. To service groups of mixed data, you need to use an aggregate type called a structure. (Other languages, such as Pascal, call this data type a record.) Another aggregate type, called a union (similar to a variant record in Pascal), enables you to interpret the same memory locations in different ways.
Peter A. Darnell, Philip E. Margolis
10. Functions
Abstract
We have been using functions throughout the previous chapters and have discussed in passing some of their essential features. In this chapter, we take a more rigorous look at functions and introduce some new topics, including pointers to functions and recursion.
Peter A. Darnell, Philip E. Margolis
11. The C Preprocessor
Abstract
You can think of the C preprocessor as a separate program that runs before the compiler, with its own simple, line-oriented grammar and syntax. In previous chapters, we introduced two preprocessor directives—the #define command for naming a constant and the #include command for including additional source files. This chapter discusses both of these directives in greater detail and also describes other preprocessor directives that have not been mentioned yet. Briefly, the preprocessor gives you the following capabilities:
  • Macro processing.
  • Inclusion of additional C source files.
  • “Conditional compilation,” which enables you to conditionally compile sections of C source contingent on the value of an arithmetic expression.
Peter A. Darnell, Philip E. Margolis
12. Input and Output
Abstract
File input and output (I/O) is one of the trickiest aspects of any programming language because it is integrated so closely with the operating system. Operating systems vary greatly in the way they allow access to data in files and devices. This variation makes it extremely difficult to design I/O capabilities that are portable from one implementation of a programming language to another.
Peter A. Darnell, Philip E. Margolis
13. Software Engineering—A Case Study
Abstract
If you have come this far in the book, you have been introduced to most of the mechanics of the C language, and you have probably mastered a few. In addition, you have, we hope, learned to think about engineering your programs, as opposed to merely writing them.
Peter A. Darnell, Philip E. Margolis
Backmatter
Metadaten
Titel
C A Software Engineering Approach
verfasst von
Peter A. Darnell
Philip E. Margolis
Copyright-Jahr
1996
Verlag
Springer New York
Electronic ISBN
978-1-4612-4020-4
Print ISBN
978-0-387-94675-7
DOI
https://doi.org/10.1007/978-1-4612-4020-4