comparison unix-phil.ms @ 10:355ed69a34a8

more about the shell and worse is better (ch03)
author meillo@marmaro.de
date Sat, 20 Feb 2010 12:14:01 +0100
parents 529168f49f29
children b32a43a62cae
comparison
equal deleted inserted replaced
9:529168f49f29 10:355ed69a34a8
30 Today, few software designers are aware of these concepts, 30 Today, few software designers are aware of these concepts,
31 and thus most modern software is limited and does not make use of software leverage. 31 and thus most modern software is limited and does not make use of software leverage.
32 Knowing and following the tenets of the Unix Philosophy makes software more valuable. 32 Knowing and following the tenets of the Unix Philosophy makes software more valuable.
33 .AE 33 .AE
34 34
35 .if t .2C 35 .\".if t .2C
36 36
37 .FS 37 .FS
38 .ps -1 38 .ps -1
39 This paper was prepared for the seminar ``Software Analysis'' at University Ulm. 39 This paper was prepared for the seminar ``Software Analysis'' at University Ulm.
40 Mentor was professor Schweiggert. 2010-02-05 40 Mentor was professor Schweiggert. 2010-02-05
392 But one can also specify a numerical argument to define the number of lines to print. 392 But one can also specify a numerical argument to define the number of lines to print.
393 393
394 .SH 394 .SH
395 A powerful shell 395 A powerful shell
396 .LP 396 .LP
397 The Unix shell provides the possibility to combine small programs into 397 It was already said, that the Unix shell provides the possibility to
398 large ones easily. 398 combine small programs into large ones easily.
399 But the powerful shell is great feature in other ways, too. 399 A powerful shell is a great feature in other ways, too.
400 .PP 400 .PP
401 It encourages rapid prototyping. 401 For instance by including a scripting language.
402 It includes a scripting language with built in control statements. 402 The control statements are build into the shell.
403 The functions, however, are the normal programs, everyone can use on the system. 403 The functions, however, are the normal programs, everyone can use on the system.
404 Thus, the programs are known and learning to program in the shell is easy. 404 Thus, the programs are known, so learning to program in the shell is easy.
405 Using normal programs as functions in the shell programming language 405 Using normal programs as functions in the shell programming language
406 is only possible because they are small, combinable tools in a toolchest style. 406 is only possible because they are small and combinable tools in a toolchest style.
407 .PP 407 .PP
408 The Unix shell encourages to write small scripts out of other programs, 408 The Unix shell encourages to write small scripts out of other programs,
409 because it is so easy to do. 409 because it is so easy to do.
410 This is a great step towards automation. 410 This is a great step towards automation.
411 It is wonderful if the effort to automate a task equals the effort 411 It is wonderful if the effort to automate a task equals the effort
414 .PP 414 .PP
415 Small programs that do one job well, standardized interfaces between them, 415 Small programs that do one job well, standardized interfaces between them,
416 a mechanism to combine parts to larger parts, and an easy way to automate tasks, 416 a mechanism to combine parts to larger parts, and an easy way to automate tasks,
417 this will inevitably produce software leverage. 417 this will inevitably produce software leverage.
418 Getting multiple times the benefit of an investment is a great offer. 418 Getting multiple times the benefit of an investment is a great offer.
419 .PP
420 The shell also encourages rapid prototyping.
421 Many well known programs started as quickly hacked shell scripts,
422 and turned into ``real'' programs, written in C, later.
423 Building a prototype first is a way to avoid the biggest problems
424 in application development.
425 Fred Brooks writes in ``No Silver Bullet'':
426 .[
427 %A Frederick P. Brooks, Jr.
428 %T No Silver Bullet: Essence and Accidents of Software Engineering
429 %B Information Processing 1986, the Proceedings of the IFIP Tenth World Computing Conference
430 %E H.-J. Kugler
431 %D 1986
432 %P 1069\(en1076
433 %I Elsevier Science B.V.
434 %C Amsterdam, The Netherlands
435 .]
436 .QP
437 The hardest single part of building a software system is deciding precisely what to build.
438 No other part of the conceptual work is so difficult as establishing the detailed
439 technical requirements, [...].
440 No other part of the work so cripples the resulting system if done wrong.
441 No other part is more difficult to rectify later.
442 .PP
443 Writing a prototype is a great method to become familiar with the requirements
444 and to actually run into real problems.
445 Today, prototyping is often seen as a first step in building a software.
446 This is, of course, good.
447 However, the Unix Philosophy has an \fIadditional\fP perspective on prototyping:
448 After having built the prototype, one might notice, that the prototype is already
449 \fIgood enough\fP.
450 Hence, no reimplementation, in a more sophisticated programming language, might be of need,
451 for the moment.
452 Maybe later, it might be neccessary to rewrite the software, but not now.
453 .PP
454 By delaying further work, one keeps the flexibility to react easily on
455 changing requirements.
456 Software parts that are not written will not miss the requirements.
457
458 .SH
459 Worse is better
460 .LP
461 The Unix Philosophy aims for the 80% solution;
462 others call it the ``Worse is better'' approach.
463 .PP
464 First, practical experience shows, that it is almost never possible to define the
465 requirements completely and correctly the first time.
466 Hence one should not try to; it will fail anyway.
467 Second, practical experience shows, that requirements change during time.
468 Hence it is best to delay requirement-based design decisions as long as possible.
469 Also, the software should be small and flexible as long as possible
470 to react on changing requirements.
471 Shell scripts, for example, are more easily adjusted as C programs.
472 Third, practical experience shows, that maintenance is hard work.
473 Hence, one should keep the amount of software as small as possible;
474 it should just fulfill the \fIcurrent\fP requirements.
475 Software parts that will be written later, do not need maintenance now.
476 .PP
477 Starting with a prototype in a scripting language has several advantages:
478 .IP \(bu
479 As the initial effort is low, one will likely start right away.
480 .IP \(bu
481 As working parts are available soon, the real requirements can get identified soon.
482 .IP \(bu
483 When a software is usable, it gets used, and thus tested.
484 Hence problems will be found at early stages of the development.
485 .IP \(bu
486 The prototype might be enough for the moment,
487 thus further work on the software can be delayed to a time
488 when one knows better about the requirements and problems,
489 than now.
490 .IP \(bu
491 Implementing now only the parts that are actually needed now,
492 requires fewer maintenance work.
493 .IP \(bu
494 If the global situation changes so that the software is not needed anymore,
495 then less effort was spent into the project, than it would have be
496 when a different approach had been used.
497
498
499
500
501
419 502
420 503
421 504
422 505
423 506