Download Reading and Modifying Code
Transcript
the original code does certain specified things, like return from a call to subroutine foo, or when subroutines foo and bar are called in succession. To properly read aspect-oriented code, you need to be aware of both the original code as well as all the aspects.17 This should not be construed as a general condemnation of these features, as each has advantages for solving certain types of programming problem. The tradeoff, however, is readability. 2.5 Complications Code reading can be complicated because of peculiarities of the the code design and implementation, and also because of what happens when the code executes. Spaghetti A base assumption to make when reading code is that the code has been designed and written in a rational, logical way. Code can be extremely hard to read if this assumption turns out to be false. There are, unfortunately, some special cases where this occurs: Machine-generated code. Some code is automatically generated by tools rather than being written by humans.18 Usually such tools operate from a high-level specification that was written by humans; here, it is preferable to read the specification instead of the generated code. 16