comparison unix-phil.ms @ 54:0a435d76b868

applied corrections by Dieter@be; and did spell checking
author meillo@marmaro.de
date Thu, 15 Apr 2010 13:53:12 +0200
parents 14f5ff66ad8a
children acd63ecc3606
comparison
equal deleted inserted replaced
53:14f5ff66ad8a 54:0a435d76b868
95 Its point of view matches to the one of this paper. 95 Its point of view matches to the one of this paper.
96 96
97 .H 1 "Importance of software design in general 97 .H 1 "Importance of software design in general
98 .LP 98 .LP
99 Software design is the planning of how the internal structure 99 Software design is the planning of how the internal structure
100 and external interfaces of a software should look like. 100 and external interfaces of software should look like.
101 It has nothing to do with visual appearance. 101 It has nothing to do with visual appearance.
102 If we take a program as a car, then its color is of no matter. 102 If we take a program as a car, then its color is of no matter.
103 Its design would be the car's size, its shape, the locations of doors, 103 Its design would be the car's size, its shape, the locations of doors,
104 the passenger/space ratio, the available controls and instruments, 104 the passenger/space ratio, the available controls and instruments,
105 and so forth. 105 and so forth.
111 Software that is horrible to use and horrible to maintain. 111 Software that is horrible to use and horrible to maintain.
112 These two aspects are the visible ones. 112 These two aspects are the visible ones.
113 Often invisible though, are the wasted possible gains. 113 Often invisible though, are the wasted possible gains.
114 Good software design can make these gains available. 114 Good software design can make these gains available.
115 .PP 115 .PP
116 A software's design deals with quality properties. 116 Software design deals with quality properties.
117 Good design leads to good quality, and quality is important. 117 Good design leads to good quality, and quality is important.
118 Any car may be able to drive from A to B, 118 Any car may be able to drive from A to B,
119 but it depends on the car's properties whether it is a good choice 119 but it depends on the car's properties whether it is a good choice
120 for passenger transport or not. 120 for passenger transport or not.
121 It depends on its properties if it is a good choice 121 It depends on its properties if it is a good choice
122 for a rough mountain area. 122 for a rough mountain area.
123 And it depends on its properties if the ride will be fun. 123 And it depends on its properties if the ride will be fun.
124 124
125 .PP 125 .PP
126 Requirements for a software are twofold: 126 Requirements for software are twofold:
127 functional and non-functional. 127 functional and non-functional.
128 .IP \(bu 128 .IP \(bu
129 Functional requirements define directly the software's functions. 129 Functional requirements define directly the software's functions.
130 They are the reason why software gets written. 130 They are the reason why software gets written.
131 Someone has a problem and needs a tool to solve it. 131 Someone has a problem and needs a tool to solve it.
132 Being able to solve the problem is the main functional goal. 132 Being able to solve the problem is the main functional goal.
133 It is the driving force behind all programming effort. 133 It is the driving force behind all programming effort.
134 Functional requirements are easier to define and to verify. 134 Functional requirements are easier to define and to verify.
135 .IP \(bu 135 .IP \(bu
136 Non-functional requirements are called \fIquality\fP requirements, too. 136 Non-functional requirements are called \fIquality\fP requirements, too.
137 The quality of a software are the properties that are not directly related to 137 The quality of software are the properties that are not directly related to
138 the software's basic functions. 138 the software's basic functions.
139 Tools of bad quality often do solve the problems they were written for, 139 Tools of bad quality often do solve the problems they were written for,
140 but introduce problems and difficulties for usage and development, later on. 140 but introduce problems and difficulties for usage and development, later on.
141 Quality aspects are often overlooked at first sight, 141 Quality aspects are often overlooked at first sight,
142 and are often difficult to define clearly and to verify. 142 and are often difficult to define clearly and to verify.
143 .PP 143 .PP
144 Quality is hardly interesting when the software gets built initially, 144 Quality is hardly interesting when software gets built initially,
145 but it has a high impact on usability and maintenance of the software, later. 145 but it has a high impact on usability and maintenance, later.
146 A short-sighted might see in developing a software, mainly building something up. 146 A short-sighted might see in developing software, mainly building something up.
147 But experience shows, that building the software the first time is 147 But experience shows, that building software the first time is
148 only a small amount of the overall work. 148 only a small amount of the overall work.
149 Bug fixing, extending, rebuilding of parts \(en maintenance work \(en 149 Bug fixing, extending, rebuilding of parts \(en maintenance work \(en
150 does soon take over the major part of the time spent on a software. 150 does soon take over the major part of the time spent on a software project.
151 And of course, the time spent actually using the software. 151 And of course, the time spent actually using the software.
152 These processes are highly influenced by the software's quality. 152 These processes are highly influenced by the software's quality.
153 Thus, quality must not be neglected. 153 Thus, quality must not be neglected.
154 However, the problem with quality is that you hardly ``stumble over'' 154 However, the problem with quality is that you hardly ``stumble over''
155 bad quality during the first build, 155 bad quality during the first build,
156 although this is the time when you should care about good quality most. 156 although this is the time when you should care about good quality most.
157 .PP 157 .PP
158 Software design has little to do with the basic function of a software \(en 158 Software design has little to do with the basic function of software \(en
159 this requirement will get satisfied anyway. 159 this requirement will get satisfied anyway.
160 Software design is more about quality aspects of the software. 160 Software design is more about quality aspects of software.
161 Good design leads to good quality, bad design to bad quality. 161 Good design leads to good quality, bad design to bad quality.
162 The primary functions of the software will be affected modestly by bad quality, 162 The primary functions of software will be affected modestly by bad quality,
163 but good quality can provide a lot of additional gain, 163 but good quality can provide a lot of additional gain,
164 even at places where one never expected it. 164 even at places where one never expected it.
165 .PP 165 .PP
166 The ISO/IEC\|9126-1 standard, part\|1, 166 The ISO/IEC\|9126-1 standard, part\|1,
167 .[ 167 .[
185 (analyzability, changeability, stability, testability) 185 (analyzability, changeability, stability, testability)
186 .IP \(bu 186 .IP \(bu
187 .I Portability 187 .I Portability
188 (adaptability, installability, co-existence, replaceability) 188 (adaptability, installability, co-existence, replaceability)
189 .LP 189 .LP
190 Good design can improve these properties of a software, 190 Good design can improve these properties of software,
191 bad designed software likely suffers in these points. 191 bad designed software likely suffers in these points.
192 .PP 192 .PP
193 One further goal of software design is consistency. 193 One further goal of software design is consistency.
194 Consistency eases understanding, working on, and using things. 194 Consistency eases understanding, working on, and using things.
195 Consistent internal structure and consistent interfaces to the outside 195 Consistent internal structure and consistent interfaces to the outside
196 can be provided by good design. 196 can be provided by good design.
197 .PP 197 .PP
198 Software should be well designed because good design avoids many 198 Software should be well designed because good design avoids many
199 problems during a software's lifetime. 199 problems during a software project's lifetime.
200 And software should be well designed because good design can offer 200 And software should be well designed because good design can offer
201 much additional gain. 201 much additional gain.
202 Indeed, much effort should be spent into good design to make software more valuable. 202 Indeed, much effort should be spent into good design to make software more valuable.
203 The Unix Philosophy shows a way of how to design software well. 203 The Unix Philosophy shows a way of how to design software well.
204 It offers guidelines to achieve good quality and high gain for the effort spent. 204 It offers guidelines to achieve good quality and high gain for the effort spent.
331 each for one task. 331 each for one task.
332 Difficult tasks are solved by combining several of the small, simple tools. 332 Difficult tasks are solved by combining several of the small, simple tools.
333 .PP 333 .PP
334 The Unix toolchest \fIis\fP a set of small, (mostly) non-interactive programs 334 The Unix toolchest \fIis\fP a set of small, (mostly) non-interactive programs
335 that are filters on byte streams. 335 that are filters on byte streams.
336 They are, to a large extend, unrelated in their function. 336 They are, to a large extent, unrelated in their function.
337 Hence, the Unix toolchest provides a large set of functions 337 Hence, the Unix toolchest provides a large set of functions
338 that can be accessed by combining the programs in the desired way. 338 that can be accessed by combining the programs in the desired way.
339 .PP 339 .PP
340 There are also advantages for developing small toolchest programs. 340 There are also advantages for developing small toolchest programs.
341 It is easier and less error-prone to write small programs. 341 It is easier and less error-prone to write small programs.
359 .PP 359 .PP
360 The second drawback of a toolchest affects the users. 360 The second drawback of a toolchest affects the users.
361 A toolchest is often more difficult to use. 361 A toolchest is often more difficult to use.
362 It is necessary to become familiar with each of the tools, 362 It is necessary to become familiar with each of the tools,
363 to be able to use the right one in a given situation. 363 to be able to use the right one in a given situation.
364 Additionally, one needs to combine the tools in a senseful way himself. 364 Additionally, one needs to combine the tools in a sensible way himself.
365 This is like a sharp knife \(en it is a powerful tool in the hand of a 365 This is like a sharp knife \(en it is a powerful tool in the hand of a
366 master, but of no good value in the hand of an unskilled. 366 master, but of no good value in the hand of an unskilled.
367 However, learning single, small tools of a toolchest is easier than 367 However, learning single, small tools of a toolchest is easier than
368 learning a complex tool. 368 learning a complex tool.
369 And the user will already have a basic understanding of a yet unknown tool, 369 And the user will already have a basic understanding of a yet unknown tool,
370 if the tools of a toolchest have a common, consistent style. 370 if the tools of a toolchest have a common, consistent style.
371 He will be able to transfer knowledge over from one tool to another. 371 He will be able to transfer knowledge over from one tool to another.
372 .PP 372 .PP
373 Moreover, the second drawback can be removed to a large extend 373 Moreover, the second drawback can be removed to a large extent
374 by adding wrappers around the basic tools. 374 by adding wrappers around the basic tools.
375 Novice users do not need to learn several tools, if a professional wraps 375 Novice users do not need to learn several tools, if a professional wraps
376 complete command lines into a higher-level script. 376 complete command lines into a higher-level script.
377 Note that the wrapper script still calls the small tools; 377 Note that the wrapper script still calls the small tools;
378 it is just like a skin around them. 378 it is just like a skin around them.
404 .H 2 "A powerful shell 404 .H 2 "A powerful shell
405 .LP 405 .LP
406 The Unix shell provides the possibility to combine small programs into large ones. 406 The Unix shell provides the possibility to combine small programs into large ones.
407 But a powerful shell is a great feature in other ways, too. 407 But a powerful shell is a great feature in other ways, too.
408 For instance by being scriptable. 408 For instance by being scriptable.
409 Control statements are build into the shell. 409 Control statements are built into the shell.
410 The functions, however, are the normal programs of the system. 410 The functions, however, are the normal programs of the system.
411 Thus, as the programs are already known, 411 Thus, as the programs are already known,
412 learning to program in the shell becomes easy. 412 learning to program in the shell becomes easy.
413 Using normal programs as functions in the shell programming language 413 Using normal programs as functions in the shell programming language
414 is only possible because they are small and combinable tools in a toolchest style. 414 is only possible because they are small and combinable tools in a toolchest style.
448 .[ [ 448 .[ [
449 gancarz 449 gancarz
450 unix philosophy 450 unix philosophy
451 .], page 28 f.] 451 .], page 28 f.]
452 .PP 452 .PP
453 Prototyping is often seen as a first step in building a software. 453 Prototyping is often seen as a first step in building software.
454 This is, of course, good. 454 This is, of course, good.
455 However, the Unix Philosophy has an \fIadditional\fP perspective on prototyping: 455 However, the Unix Philosophy has an \fIadditional\fP perspective on prototyping:
456 After having built the prototype, one might notice, that the prototype is already 456 After having built the prototype, one might notice, that the prototype is already
457 \fIgood enough\fP. 457 \fIgood enough\fP.
458 Hence, no reimplementation, in a more sophisticated programming language, 458 Hence, no reimplementation, in a more sophisticated programming language,
472 requirements completely and correctly the first time. 472 requirements completely and correctly the first time.
473 Hence one should not try to; one will fail anyway. 473 Hence one should not try to; one will fail anyway.
474 .PP 474 .PP
475 (2) Requirements change during time. 475 (2) Requirements change during time.
476 Hence it is best to delay requirement-based design decisions as long as possible. 476 Hence it is best to delay requirement-based design decisions as long as possible.
477 The software should be small and flexible as long as possible 477 Software should be small and flexible as long as possible
478 to react on changing requirements. 478 to react on changing requirements.
479 Shell scripts, for example, are more easily adjusted as C programs. 479 Shell scripts, for example, are more easily adjusted as C programs.
480 .PP 480 .PP
481 (3) Maintenance work is hard work. 481 (3) Maintenance work is hard work.
482 Hence, one should keep the amount of code as small as possible; 482 Hence, one should keep the amount of code as small as possible;
494 .IP \(bu 494 .IP \(bu
495 As the initial effort is low, one will likely start right away. 495 As the initial effort is low, one will likely start right away.
496 .IP \(bu 496 .IP \(bu
497 As working parts are available soon, the real requirements can get identified soon. 497 As working parts are available soon, the real requirements can get identified soon.
498 .IP \(bu 498 .IP \(bu
499 When a software is usable and valuable, it gets used, and thus tested. 499 When software is usable and valuable, it gets used, and thus tested.
500 Hence problems will be found at early stages of the development. 500 Hence problems will be found at early stages of the development.
501 .IP \(bu 501 .IP \(bu
502 The prototype might be enough for the moment, 502 The prototype might be enough for the moment,
503 thus further work can get delayed to a time 503 thus further work can get delayed to a time
504 when one knows better about the requirements and problems, 504 when one knows better about the requirements and problems,
552 practice of programming 552 practice of programming
553 .], chapter\|8] 553 .], chapter\|8]
554 and avoiding optimizations that introduce dependencies on specific hardware. 554 and avoiding optimizations that introduce dependencies on specific hardware.
555 Hardware has a much lower lifetime than software. 555 Hardware has a much lower lifetime than software.
556 By chaining software to a specific hardware, 556 By chaining software to a specific hardware,
557 the software's lifetime gets shortened to that of this hardware. 557 its lifetime gets shortened to that of this hardware.
558 In contrast, software should be easy to port \(en 558 In contrast, software should be easy to port \(en
559 adaptation is the key to success. 559 adaptation is the key to success.
560 .PP 560 .PP
561 (2) 561 (2)
562 .I "Portability of data 562 .I "Portability of data
577 .PP 577 .PP
578 (3) 578 (3)
579 A large 579 A large
580 .I "range of usability 580 .I "range of usability
581 ensures good adaptation, and thus good survival. 581 ensures good adaptation, and thus good survival.
582 It is a special distinction if a software becomes used in fields of action, 582 It is a special distinction if software becomes used in fields of action,
583 the original authors did never imagine. 583 the original authors did never imagine.
584 Software that solves problems in a general way will likely be used 584 Software that solves problems in a general way will likely be used
585 for many kinds of similar problems. 585 for many kinds of similar problems.
586 Being too specific limits the range of usability. 586 Being too specific limits the range of usability.
587 Requirements change through time, thus use cases change or even vanish. 587 Requirements change through time, thus use cases change or even vanish.
601 Successful software adapts itself to the changing world. 601 Successful software adapts itself to the changing world.
602 .PP 602 .PP
603 (4) 603 (4)
604 .I "Reuse of parts 604 .I "Reuse of parts
605 is even one step further. 605 is even one step further.
606 A software may completely lose its field of action, 606 Software may completely lose its field of action,
607 but parts of which the software is build may be general and independent enough 607 but parts of which the software is built may be general and independent enough
608 to survive this death. 608 to survive this death.
609 If software is build by combining small independent programs, 609 If software is built by combining small independent programs,
610 then these parts are readily available for reuse. 610 then these parts are readily available for reuse.
611 Who cares if the large program is a failure, 611 Who cares if the large program is a failure,
612 but parts of it become successful instead? 612 but parts of it become successful instead?
613 613
614 .H 2 "Summary 614 .H 2 "Summary
637 existing software were given only sparsely. 637 existing software were given only sparsely.
638 In this and the next chapter, concrete software will be 638 In this and the next chapter, concrete software will be
639 the driving force in the discussion. 639 the driving force in the discussion.
640 .PP 640 .PP
641 This first case study is about the mail user agents (\s-1MUA\s0) 641 This first case study is about the mail user agents (\s-1MUA\s0)
642 \s-1MH\s0 (``mail handler'') and its descendent \fInmh\fP 642 \s-1MH\s0 (``mail handler'') and its descendant \fInmh\fP
643 (``new mail handler''). 643 (``new mail handler'').
644 .[ 644 .[
645 nmh website 645 nmh website
646 .] 646 .]
647 \s-1MUA\s0s provide functions to read, compose, and organize mail, 647 \s-1MUA\s0s provide functions to read, compose, and organize mail,
659 .[ [ 659 .[ [
660 salus 660 salus
661 quarter century of unix 661 quarter century of unix
662 .], page 41 f.] 662 .], page 41 f.]
663 It was a small program that either printed the user's mailbox file 663 It was a small program that either printed the user's mailbox file
664 or appended text to someone elses mailbox file, 664 or appended text to someone else's mailbox file,
665 depending on the command line arguments. 665 depending on the command line arguments.
666 .[ 666 .[
667 manual mail(1) 667 manual mail(1)
668 .] 668 .]
669 It was a program that did one job well. 669 It was a program that did one job well.
1024 \s-1MIME\s0 support and support for different character encodings 1024 \s-1MIME\s0 support and support for different character encodings
1025 is available, but only on a moderate level. 1025 is available, but only on a moderate level.
1026 This comes from limited development resources. 1026 This comes from limited development resources.
1027 More active developers could quickly change this. 1027 More active developers could quickly change this.
1028 But \s-1MH\s0 is also limited by design, which is the larger problem. 1028 But \s-1MH\s0 is also limited by design, which is the larger problem.
1029 \s-1IMAP\s0, for example, conflicts with \s-1MH\s0's design to a large extend. 1029 \s-1IMAP\s0, for example, conflicts with \s-1MH\s0's design to a large extent.
1030 These design conflicts are not easily solvable. 1030 These design conflicts are not easily solvable.
1031 Possibly, they require a redesign. 1031 Possibly, they require a redesign.
1032 \s-1IMAP\s0 may be too different to the classic mail model, 1032 \s-1IMAP\s0 may be too different to the classic mail model,
1033 which \s-1MH\s0 covers, so that \s-1MH\s0 may never support it well. 1033 which \s-1MH\s0 covers, so that \s-1MH\s0 may never support it well.
1034 .PP 1034 .PP
1190 .PP 1190 .PP
1191 A web browser's job is to let the user browse the web. 1191 A web browser's job is to let the user browse the web.
1192 This means, navigating through websites by following links. 1192 This means, navigating through websites by following links.
1193 Rendering the \s-1HTML\s0 sources is a different job, too. 1193 Rendering the \s-1HTML\s0 sources is a different job, too.
1194 It is covered by the webkit render engine, in uzbl's case. 1194 It is covered by the webkit render engine, in uzbl's case.
1195 Audio and video content and files like PostScript, \s-1PDF\s0, and the like, 1195 Audio and video content and files like PostScript, \s-1PDF\s0,
1196 are also not the job of a web browser. 1196 and the like, are also not the job of a web browser.
1197 They should be handled by external applications \(en 1197 Such content should be handled by external programs \(en
1198 ones which's job is to handle such data. 1198 programs that were written to handle such data.
1199 Uzbl strives to do it this way. 1199 Uzbl strives to do it this way.
1200 .PP 1200 .PP
1201 Remember Doug McIlroy: 1201 Remember Doug McIlroy:
1202 .I 1202 .I
1203 ``Write programs that do one thing and do it well. 1203 ``Write programs that do one thing and do it well.
1221 With uzbl, one can use any download manager the user wants. 1221 With uzbl, one can use any download manager the user wants.
1222 To switch to a different one, only one line in a small handler script 1222 To switch to a different one, only one line in a small handler script
1223 needs to be changed. 1223 needs to be changed.
1224 Alternatively it would be possible to query the program to use by 1224 Alternatively it would be possible to query the program to use by
1225 reading a global file or an environment variable, in the handler script. 1225 reading a global file or an environment variable, in the handler script.
1226 Of course, one can tell uzbl to use a different handler script, too.
1227 This requires a one line change in uzbl's config file.
1226 .PP 1228 .PP
1227 Uzbl does neither have its own download manager nor depends on a 1229 Uzbl does neither have its own download manager nor depends on a
1228 specific one, hence uzbl's browsing abilities will not be lowered by having 1230 specific one, hence uzbl's browsing abilities will not be lowered by having
1229 a bad download manager. 1231 a bad download manager.
1230 Uzbl's download capabilities will be just as good as the ones of the best 1232 Uzbl's download capabilities will be just as good as the ones of the best
1264 \f(CW$4\fP expands to the path of the command input pipe of the current 1266 \f(CW$4\fP expands to the path of the command input pipe of the current
1265 uzbl instance. 1267 uzbl instance.
1266 1268
1267 .PP 1269 .PP
1268 .B "Avoid captive user interfaces" . 1270 .B "Avoid captive user interfaces" .
1269 One could say, that uzbl, to a large extend, actually \fIis\fP 1271 One could say, that uzbl, to a large extent, actually \fIis\fP
1270 a captive user interface. 1272 a captive user interface.
1271 But the difference to most other web browsers is, that uzbl is only 1273 But the difference to most other web browsers is, that uzbl is only
1272 the captive user interface frontend (and the core of the backend). 1274 the captive user interface frontend (and the core of the backend).
1273 Many parts of the backend are independent of uzbl. 1275 Many parts of the backend are independent of uzbl.
1274 Some are distributed with uzbl, for some external programs, 1276 Some are distributed with uzbl, for some external programs,
1303 .PP 1305 .PP
1304 As of March 2010, uzbl-core consists of about 3\,500 lines of C code. 1306 As of March 2010, uzbl-core consists of about 3\,500 lines of C code.
1305 The distribution includes another 3\,500 lines of Shell and Python code, 1307 The distribution includes another 3\,500 lines of Shell and Python code,
1306 which are the handler scripts and plugins like a modal interface. 1308 which are the handler scripts and plugins like a modal interface.
1307 Further more, uzbl uses functionality of external tools like 1309 Further more, uzbl uses functionality of external tools like
1308 \fIwget\fP and \fInetcat\fP. 1310 \fIwget\fP and \fIsocat\fP.
1309 Up to this point, uzbl looks pretty neat and small. 1311 Up to this point, uzbl looks pretty neat and small.
1310 The ugly part of uzbl is the web content renderer, webkit. 1312 The ugly part of uzbl is the web content render engine, webkit.
1311 Webkit consists of roughly 400\,000 (!) lines of code. 1313 Webkit consists of roughly 400\,000 (!) lines of code.
1312 Unfortunately, small web render engines are not possible anymore 1314 Unfortunately, small web render engines are not possible anymore
1313 because of the modern web. 1315 because of the modern web.
1314 1316
1315 .PP 1317 .PP
1395 in mind, was discussed. 1397 in mind, was discussed.
1396 .PP 1398 .PP
1397 Throughout the paper, the aim was do explain \fIwhy\fP something 1399 Throughout the paper, the aim was do explain \fIwhy\fP something
1398 should be done the Unix way. 1400 should be done the Unix way.
1399 It was tried to give reasons that expose that the Unix Philosophy 1401 It was tried to give reasons that expose that the Unix Philosophy
1400 is a preferrable way for designing software. 1402 is a preferable way for designing software.
1401 .PP 1403 .PP
1402 The Unix Philosophy is close to the software developer's point of view. 1404 The Unix Philosophy is close to the software developer's point of view.
1403 Its main goal is taming the beast ``software complexity''. 1405 Its main goal is taming the beast ``software complexity''.
1404 Hence it strives first and foremost for simplicity, of software. 1406 Hence it strives first and foremost for simplicity, of software.
1405 It might appear, that usability for people is a minor goal. 1407 It might appear, that usability for people is a minor goal.