tailieunhanh - Software Engineering For Students: A Programming Approach Part 22

Software Engineering For Students: A Programming Approach Part 22. This fully revised version of Doug Bell's Software Engineering: A Programming Approach continues to use the successful formula of the previous editions. The author's approach is to present the main principles, techniques and tools used in software engineering, one by one, chapter by chapter. This book is a unique introduction to software engineering for all students of computer science and its related disciplines. It is also ideal for practitioners wishing to remain current with new developments in the area | 188 Chapter 14 The basics Unfortunately most programming languages do not enforce even these simple logical rules. Thus it is largely the responsibility of the programmer to ensure that procedures and functions do not have side effects. A side effect is any change to information outside a method caused by a call - other than the parameters to a procedure. Most programming languages do not prevent programmers from directly accessing and modifying data objects global data defined outside of the local environment of the method. Along with pointers and the goto statement global data has come to be regarded as a major source of programming problems. We shall see in Chapter 15 on object-oriented features of programming languages how in classes access to global data is controlled. Many abstractions particularly those which manipulate recursive data structures such as lists graphs and trees are more concisely described recursively. Some languages for example Cobol and Fortran do not support recursion. Parameter-passing mechanisms We have seen that ideally parameters are passed to a procedure so that the procedure will accomplish some task. There is no need for information to be passed back to the caller. So there is no need for parameter values to change. functions communicate a value back to the caller as the return value. So again there is no need for parameter values to be changed. Two major schemes for parameters have emerged call by value termed value parameters - this means that a copy of the information is passed as the parameter. Therefore the method can use the information but cannot change it. call by reference termed reference parameters - this means that a pointer to the information is passed as the parameter. Therefore the method can both access and change the information. These pointers are not a problem because the pointers are not themselves accessible to the programmer. The programmer cannot access or change the pointer merely the information pointed

TỪ KHÓA LIÊN QUAN