
COMPUTING PRACTICES Software Cultures and Evolution Working effectively with a legacy software program requires software engineers to view it in the context in which its developers created it. Václav o work effectively with legacy code, soft- programmers who created legacy software used the Rajlich ware engineers need to understand a legacy knowledge and customs appropriate for the time and Wayne State computer program’s culture—the combina- circumstances in which they were working. Just as an University tion of the programmer’s background, the anthropologist needs background information to cor- hardware environment, and the program- rectly interpret human cultures, having information Tming techniques that guided its creation. about the environment in which developers produced Norman Software systems typically pass through a series of a given piece of legacy software helps software engi- Wilde stages.1 During the initial development stage, software neers understand it. Michelle developers create a first functioning version of the Imagine a software engineer attempting to reengi- Buckellew code. An evolution stage follows, during which devel- neer the statements in the example in Figure 1, drawn University of opmental efforts focus on extending system capabili- from Convert, a Fortran program from the 1970s. A West Florida ties to meet user needs. During the servicing stage, only recent computer science graduate raised on Unix or minor repairs and simple functional changes are pos- Windows would recognize that the program reads in Henry Page sible. In the phase out stage, the system is essentially some parameters and then prints them out. But the Micro frozen, but it still produces value. Finally, during the first write statement using the 9000 FORMAT is Systems close down stage, the developers withdraw the system meaningless. Why does a line containing just the digit and possibly replace it. “1” precede the output? However, a programmer from Most of the tasks in the evolution and servicing the 1970s is likely to recognize this as output for a line phases require program comprehension—under- printer. Such printers typically used the first column standing how and why a software program functions of output as a carriage control character, interpreted in order to work with it effectively. Effective compre- by special hardware and used with perforated paper hension requires viewing a legacy program not simply tape to control printing. A “1” typically forced a skip as a product of inefficiency or stupidity, but instead as to the top of a new page, a “0” forced a double space, an artifact of the circumstances in which it was devel- and so on. This convention was reasonable given exist- oped. This information can be an important factor in ing hardware because it reduced the number of lines determining appropriate strategies for the software transmitted from computer to printer. program’s transition from the evolution stage to the This is a typical example of the conventions that servicing or phase out stage. impact comprehension of legacy programs. Although programmers in modern computer installations rarely DEFINING SOFTWARE CULTURE encounter line printers, successful reengineering of Edward B. Tylor2 defined human culture as “...that such code requires knowledge of the line printer con- complex whole which includes knowledge, belief, art, vention. Reengineering this program could require dis- morals, law, custom, and any other capabilities and carding the first character of every record. habits acquired by man as a member of society.” The Changes in programmer background, hardware 24 Computer 0018-9162/01/$10.00 © 2001 IEEE Figure 1. Short quiz WRITE (IOUT,9000) for recent computer READ (45,9010,IOSTAT=IOS) IV,IDONT,ISORT,IASCI,KPRNT,IBIN,FACT, science graduates: * PTSS,PSTT What does the first WRITE (IOUT,9020) IV,IDONT,ISORT,IASCI,KPRNT,IBIN,FACT,PTSS,PSTT line of this code do? 9000 FORMAT ('1') 9020 FORMAT (' IV = ',I5,' IDONT = ',I5,’ ISORT = ',I5, * ' IASCI = ',I5,' KPRNT = ',I5/,' IBIN = ',I5,' FACT = ', * F5.1,' PTSS = ',F5.1,' PSTT = ',F5.1) properties, problem-solving techniques, software four years of work and several released versions, processes, and programming practices have resulted NCSA suspended work on this application in 1997. in several major shifts during the history of mainstream However, source code is still publicly available software engineering. The concept of what comprises (http://www.ncsa.uiuc.edu), and programmers still use a “good” program has changed radically over time. it for case studies of program comprehension tech- niques. Mosaic, which is fairly representative of the CULTURE CONTRASTS mid-1990s C culture, is a single program consisting Our case studies demonstrate that the software cul- of approximately 100,000 lines of well-structured, ture strongly affects both the comprehension and evo- fairly well-commented C code in approximately 180 lution of software for large systems.3 In these studies, C source files. we used a legacy Fortran system from the 1970s and Table 1 summarizes the main differences between a more modern C application from the early 1990s. Fastgen and Mosaic. The Fastgen geometric modeling system is a suite of Fortran 77 programs that developers can use to System partitioning construct models of solid objects such as vehicles and Fastgen programs share files of intermediate results. aircraft from primitives such as triangles, spheres, Convert typically preprocesses a geometric model and cylinders, donuts, boxes, wedges, and rods. The US then feeds the output into other programs for simu- Air Force uses Fastgen to model the interactions lation, analysis, or display. Early software often used between weapons and targets by tracing rays repre- this kind of partitioning, obviously motivated by the senting explosions or projectiles.4 Convert, a Fastgen limited memory available in most computers. This preprocessor that consists of a single Fortran 77 places a greater burden on the user, who must execute source file of 2,335 lines (raw line count), is repre- each program individually and run them in the cor- sentative of the 1970s Fortran software culture. rect order with the correct parameters. One benefit is Originally developed in 1978 for a mainframe envi- that the developers wrote very accurate user docu- ronment, Convert expands simplified geometric model mentation for the individual Fastgen programs. input and transforms models into the formats other In comparison, 1990s developers implemented tools require. Software developers have updated and Mosaic as a monolithic program in which users either maintained Convert many times to keep pace with the select options from a menu or the software executes introduction of different hardware platforms. them in response to the input data. NCSA Mosaic,5 one of the first widely distributed and used Web browsers, was developed in the Modularity National Center for Supercomputing Applications at In keeping with modern practices, Mosaic’s devel- the University of Illinois during the mid-1990s. After opers implemented a large number of C functions, Table 1. Summary of Fastgen and Mosaic cultural differences. System Partitioning Modularity Control flow Obsolete program plans Fastgen System of programs Large noncohesive Unstructured, tangled, Input/output in batches 1970s Fortran that share files subroutines many GO TOs Scratch files Global data in large Data packed into integers common blocks Binary files Mosaic Single monolithic Small cohesive functions Structured 1990s C program Little use of global data September 2001 25 VIFOR BROWSER – 1 convert3.f convert3.f DATA UU Obsolete program plans Obsolete program plans solve hardware and oper- comb GLOBALS ating system problems that no longer exist. The line dntwrk repms printer carriage control character is one example, but donut jcsave Convert provides others. convert iwhx Input/output batching. Convert reads and processes ctobin files geometric models in batches of 200 records. Batching made execution in old mainframe operating systems boxy mode more efficient because the system swapped a job that concyl neww was doing I/O out of memory. A simple read-process- influe factor read-process cycle was very inefficient because it sphere specs caused multiple swaps. However, I/O batching pro- work cyl vides little benefit on more modern PC systems. The soot comp batch cycle complicates the code because processing breaks at the arbitrary 200th record, not at any logi- thread blk cal point such as at the end of a model component. Consider how this might affect an attempt to reengi- neer Convert. The software engineer who does not understand the plan’s purpose might continue using Figure 2. Common the 200-record cycle, just in case it conceals some subroutine use in typically with high cohesion. Relatively short descrip- important functionality of the program. Scratch files. Convert. In this dis- tions summarize each function’s purpose. In contrast, Convert opens at least seven scratch play from the Vifor Fastgen’s developers implemented it before program- files for intermediate results as soon as it starts pro- Fortran analyzer pro- mers accepted the importance of cohesion. Subrou- cessing. Because old computers had limited local mem- gram, subroutines tines are large, and they mix many unrelated issues, ory, Convert stores all data of large or unknown size— appear in the left col- which makes comprehension difficult because the sub- such as parts of a geometric model—on a scratch tape, umn and the pro- routines no longer serve as logical chunks of program and continually rewinds and rewrites these tapes. This gram’s common code. Convert holds most of the data in large global greatly complicates the understanding of Convert’s blocks appear in the common blocks that many subroutines share, as “mirroring” feature. Mirroring simplifies input of a 6 right column. A line Figure 2 shows. In comparison, Mosaic uses few geometric model by allowing the user to input just one indicates that the global variables that are well coupled with the rele- half of a symmetric component, while the system gen- subroutine references vant processing.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages5 Page
-
File Size-