Page 166 -
P. 166

brittle code













                                                     Hang on a second...haven’t you been
                                                     here before? You’ve already written
                                                     code to read in lines from a data file and
                                                     put ‘em into lists...do you like going around
                                                     in circles?!?










                                                     That’s a good point.
                                                     This problem is not unlike the problem from the
                                                     beginning of the chapter, in that you’ve got lines of
                                                     text in a disk file that you need to process, only now
                                                     you have two files instead of one.
                                                     You know how to write the code to process your
                                                     new files, but writing custom code like this is
                                                     specific to the format that you’ve created for this
                                                     problem. This is brittle: if the data format changes,
                                                     your custom code will have to change, too.

                                                     Ask yourself: is it worth it?























           130    Chapter 4
   161   162   163   164   165   166   167   168   169   170   171