TAILIEUCHUNG - Software Engineering For Students: A Programming Approach Part 25
Software Engineering For Students: A Programming Approach Part 25. 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 | 218 Chapter 15 Object-oriented programming Suppose that you were asked to design a new programming language for software engineering select and justify a mechanism for encapsulation select and justify a mechanism for modularity. Explain what the term modularity means. Assess how well the following features of programming languages contribute to modularity methods classes. Assess the generics feature. Argue for and against pointers in a programming language. Argue for and against automatic garbage collection. Answers to self-test questions public void moveDown int amount y y amount public int yCoord get return y Methods creditAccount debitAccount calculatelnterest Properties currentBalance name class Stack private Arraylist s new Arraylist public void push String item 0 item public String pop String item String 0 0 return item Answers to self-test questions 219 class Bomb extends Sprite private Imageicon bombimage public Bomb int newX int newY int newSize x newX y newY size newSize bombimage new imageicon c public void display Jpanel panel Graphics paper panel paper x y public void move y y - 20 public int sum ArrayList String list int total 0 for int i 0 i i total total i return total Generics complicate the language. There are many possible answers. Here are just two 1. a file sort program because you never know how long the file will be 2. A web browser program because you do not know in advance how big a web page will be. In an array all items after the insertion point have to be moved down the array a time-consuming process. In a dynamic structure only the pointer in the immediately preceding item needs to be updated - a very fast operation. Factor reliability development effort performance C poor greater faster Java good smaller unpredictable 220 Chapter 15 Object-oriented .
đang nạp các trang xem trước