Chapter 9: Brittle Bones

 < Day Day Up > 



 Download CD Content

Description

Just as a strong foundation is required to erect a solid building, so is a strong foundation necessary for creating quality software. Without such a foundation, a building might collapse at any point, and the same is true of software development. A single error in the initial code can cause a cascading effect as more and more code is added on top of it.

Unfortunately, many factors conspire to cause a programmer to continue ahead on top of a weak foundation. Poor functionality or a total lack of certain functionality is unwisely seen as a problem that can be remedied later. As the program grows in a more organic fashion, control is lost and becomes difficult to recover.

Take, for instance, one project that was displaying a map of tiles from an isometric viewpoint. While building the initial foundation for the application, a decision was made to represent the tiles using a diagonal layout in memory thought to be similar to the layout of the display. This small decision would lead to the loss of countless hours of development time.

The first signs of trouble appeared when it became necessary to measure the distances of paths traced through connected tiles. Because tiles that were adjacent in the display were not necessarily adjacent in memory, the indices could not be used in a straightforward manner to determine the distance between tiles. This was further complicated by the difficulty in even following a straight-line path through the data in memory. This led to a different programmer implementing different methods for handling this bizarre scheme. The ensuing plethora of approaches was hard to maintain and errors fixed in one were not fixed in another.

One such approach was particularly problematic because it duplicated the data in a separate memory structure with a more straightforward layout. While this simplified algorithms used on this separate data set, it was difficult to keep the two sets of data properly synchronized. It also represented an unnecessary waste of resources without any of the gains that could justify having two sets of data. This one single decision was responsible for hours of lost time and consequently lost profit.



 < Day Day Up > 



Preventative Programming Techniques. Avoid and Correct Common Mistakes
Preventative Programming Techniques: Avoid and Correct Common Mistakes (Charles River Media Programming)
ISBN: 1584502576
EAN: 2147483647
Year: 2002
Pages: 121
Authors: Brian Hawkins

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net