tailieunhanh - Programming - Software Engineering The Practice of Programming phần 4
và có phương pháp thử nghiệm đảm bảo rằng phần mềm hoạt động một cách chính xác và đáng tin cậyLập trình viên cũng phải đánh giá cân bằng, chọn trong số các lựa chọn thay thế thiết kế, gỡ lỗi và thử nghiệm, cải thiện hiệu suất, và duy trì phần mềm được viết bởi chính mình và những người khác. | SECTION JAVA 75 and equal s does an elementwise comparison of the words in two prefixes Prefix equals compare two prefixes for equal words i c boolean equal J Prefix p Prefix o for int i 0 i Ĩ if pref. el ementAt i .equal s p. pref. el ementAt i return false return true The Java program is significantly smaller than the C program and takes care of more details Vectors and the Hashtabl e are the obvious examples. In general storage management is easy since vectors grow as needed and garbage collection takes care of reclaiming memory that is no longer referenced. But to use the Hashtable class we still need to write functions and equals so Java isn t taking care of all the details. Comparing the way the C and Java programs represent and operate on the same basic data structure we see that the Java version has better separation of functionality. For example to switch from Vectors to arrays would be easy. In the C version. everything knows what everything else is doing the hash table operates on arrays that are maintained in various places lookup knows the layout of the State and Suffix structures and everyone knows the size of the prefix array. java Markov txt I fmt Wash the blackboard. Watch it dry. The water goes into the air. When water goes into the air it evaporates. Tie a damp cloth to one end of a solid or liquid. Look around. What are the solid things changes take place when burns. If the burning material has liquids they are stable and the sponge rise. It looked like dough but it is burning. Break up the lump of sugar into small pieces and put them together again i n the bottom of a liquid. Exercise 3-4. Revise the Java version of markov to use an array instead of a Vector for the prefix in the State class. 76 DESIGN AND IMPLEMENTATION CHAPTER3 C Our third implementation is in C . Since C is almost a superset of C it can be used as if it were C with a few notational conveniences and our original C version of markov is also a legal C .
đang nạp các trang xem trước