Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Software Engineering For Students: A Programming Approach Part 23. 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 | 198 Chapter 14 The basics Answers to self-test questions 14.1 When some input from the user s keyboard is required. It must be checked and if necessary new input solicited until the input is correct. 14.2 int table boolean search int wanted boolean found false int i 0 endSearch while i table.length if table i wanted found true break endSearch i return found Without using break int table boolean search int wanted boolean found false int i 0 while i table.length and found false if table i wanted found true else i return found 14.3 Yes and no. Clearly these operations are not something that should be allowed with integers and reals. But in Java the bit structure of these data types is precisely defined. Also the effects of these operations are precisely defined. So these particular data types have an extended set of valid operations. Further reading 199 14.4 The benefits are program clarity better modeling of the problem compiletime checking and run-time checking. 14.5 This is a case of expressive power and convenience versus fast performance. 14.6 Arrays and records allow the programmer to create and use data structures that match the problem to be solved in a convenient and natural fashion. This fosters fast development reliability and maintainability. Further reading See the references at the end of Chapter 16. CHAPTER 15 Object-oriented programming This chapter explains how encapsulation inheritance and polymorphism are provided in a programming language explains the role of libraries in object-oriented programming explains the idea of generics or templates explains provision for dynamic data structures and garbage collection. 15.1 Introduction Most current mainstream languages embody OOP. The three pillars of OOP are encapsulation inheritance and polymorphism. This chapter explains how the programming language can support these concepts. The language used for illustration is Java and the case study is the cyberspace invaders game Appendix A . We go on to explain