comparison discussion.roff @ 180:731e747a805b

Applied corrections by Lydi.
author markus schnalke <meillo@marmaro.de>
date Wed, 11 Jul 2012 00:00:34 +0200
parents b59201e345e5
children eb6eeb10afd5
comparison
equal deleted inserted replaced
179:b59201e345e5 180:731e747a805b
3078 .Sw -delete , 3078 .Sw -delete ,
3079 but not with 3079 but not with
3080 .Sw -list . 3080 .Sw -list .
3081 .P 3081 .P
3082 Trying to fix these problems on the surface would not have solved 3082 Trying to fix these problems on the surface would not have solved
3083 them truly, as they originate from a discrepance between the semantic 3083 them truly, as they originate from a discrepance between the
3084 structure of the problem and the structure implemented in the program. 3084 structure of the problem and the structure implemented in the program.
3085 Such structural differences can not be cured on the surface. 3085 Such structural differences can not be cured on the surface.
3086 They need to be solved by adjusting the structure of the implementation 3086 They need to be solved by adjusting the structure of the implementation
3087 to the structure of the problem. 3087 to the structure of the problem.
3088 .P 3088 .P
3100 .Sw -delete 3100 .Sw -delete
3101 introduce modes of operation. 3101 introduce modes of operation.
3102 Historically, 3102 Historically,
3103 .Pn anno 3103 .Pn anno
3104 had only one operation mode: adding header fields. 3104 had only one operation mode: adding header fields.
3105 With the extension, it got two more modes: 3105 With the extension it got two more modes:
3106 .\" XXX got
3106 listing and deleting header fields. 3107 listing and deleting header fields.
3107 The structure of the code changes did not pay respect to this 3108 The structure of the code changes did not pay respect to this
3108 fundamental change to 3109 fundamental change to
3109 .Pn anno 's 3110 .Pn anno 's
3110 behavior. 3111 behavior.
3185 just like the current directory is specified as `\c 3186 just like the current directory is specified as `\c
3186 .Fn . '. 3187 .Fn . '.
3187 .P 3188 .P
3188 To allow MH tools to understand all four notations, 3189 To allow MH tools to understand all four notations,
3189 they need to convert between them. 3190 they need to convert between them.
3191 .\" XXX between?
3190 In nmh, these path name conversion functions were located in the files 3192 In nmh, these path name conversion functions were located in the files
3191 .Fn sbr/path.c 3193 .Fn sbr/path.c
3192 (``return a pathname'') and 3194 (``return a pathname'') and
3193 .Fn sbr/m_maildir.c 3195 .Fn sbr/m_maildir.c
3194 (``get the path for the mail directory''). 3196 (``get the path for the mail directory'').
3285 This is the function of choice for path conversion. 3287 This is the function of choice for path conversion.
3286 Absolute directory paths are the most general representation of a 3288 Absolute directory paths are the most general representation of a
3287 path name. 3289 path name.
3288 The result is a pointer to static memory. 3290 The result is a pointer to static memory.
3289 .P 3291 .P
3292 .\" XXX ueberfluessig?
3290 The new functions have names that indicate their use. 3293 The new functions have names that indicate their use.
3291 Two of the functions convert relative to absolute path names of the 3294 Two of the functions convert relative to absolute path names of the
3292 same type. 3295 same type.
3293 The third function converts any path name type to the most general one, 3296 The third function converts any path name type to the most general one,
3294 the absolute directory path. 3297 the absolute directory path.
3325 .Fn config/config.c , 3328 .Fn config/config.c ,
3326 for whatever reasons. 3329 for whatever reasons.
3327 .P 3330 .P
3328 .Fn sbr/path.c 3331 .Fn sbr/path.c
3329 now contains all path handling code. 3332 now contains all path handling code.
3333 .\" XXX naechste zeile weg?
3330 Only 173 lines of code were needed to replace the previous 252 lines. 3334 Only 173 lines of code were needed to replace the previous 252 lines.
3331 The readability of the code is highly improved. 3335 The readability of the code is highly improved.
3332 Additionally, each of the six exported and one static functions 3336 Additionally, each of the six exported and one static functions
3333 is introduced by an explaining comment. 3337 is introduced by an explaining comment.
3334 3338
3410 does not behave as expected. 3414 does not behave as expected.
3411 But all programs should behave as expected. 3415 But all programs should behave as expected.
3412 Clear and simple concepts are a precondition for this. 3416 Clear and simple concepts are a precondition for this.
3413 Hence, the real solution is having all MH tools read the profile. 3417 Hence, the real solution is having all MH tools read the profile.
3414 .P 3418 .P
3415 Yet, the problem has a further aspect. 3419 The problem has a further aspect.
3416 It mainly originates in 3420 It mainly originates in
3417 .Pn mhmail . 3421 .Pn mhmail .
3418 .Pn mhmail 3422 .Pn mhmail
3419 was intended to be a replacement for 3423 was intended to be a replacement for
3420 .Pn mailx 3424 .Pn mailx
3462 Instead it should have been treated accordingly to its foreign style. 3466 Instead it should have been treated accordingly to its foreign style.
3463 The solution is not to prevent the tools reading the profile but 3467 The solution is not to prevent the tools reading the profile but
3464 to instruct them reading a different profile. 3468 to instruct them reading a different profile.
3465 .Pn mhmail 3469 .Pn mhmail
3466 could have set up a well-defined profile and caused all MH tools 3470 could have set up a well-defined profile and caused all MH tools
3467 in the session use it by exporting an environment variable. 3471 in the session to use it by exporting an environment variable.
3468 With this approach, no special cases would have been introduced, 3472 With this approach, no special cases would have been introduced,
3469 no surprises would have been caused. 3473 no surprises would have been caused.
3470 By writing a clean-profile-wrapper, the concept could have been 3474 By writing a clean-profile-wrapper, the concept could have been
3471 generalized orthogonally to the whole MH tool chest. 3475 generalized orthogonally to the whole MH tool chest.
3472 Then Rose's motivation behind the decision that 3476 Then Rose's motivation behind the decision that
3546 MH is one decade older than the POSIX and ANSI C standards. 3550 MH is one decade older than the POSIX and ANSI C standards.
3547 Hence, MH included own implementations of functions 3551 Hence, MH included own implementations of functions
3548 that are standardized and thus widely available today, 3552 that are standardized and thus widely available today,
3549 but were not back then. 3553 but were not back then.
3550 Today, twenty years after the POSIX and ANSI C were published, 3554 Today, twenty years after the POSIX and ANSI C were published,
3551 developers can expect system to comply with these standards. 3555 developers can expect systems to comply with these standards.
3552 In consequence, MH-specific replacements for standard functions 3556 In consequence, MH-specific replacements for standard functions
3553 can and should be dropped. 3557 can and should be dropped.
3554 Kernighan and Pike advise: ``Use standard libraries.'' 3558 Kernighan and Pike advise: ``Use standard libraries.''
3555 .[ [ 3559 .[ [
3556 kernighan pike practice of programming 3560 kernighan pike practice of programming
3559 but it had not adjusted to the changes in this field. 3563 but it had not adjusted to the changes in this field.
3560 The 3564 The
3561 .Fu snprintf() 3565 .Fu snprintf()
3562 function, for instance, was standardized with C99 and is available 3566 function, for instance, was standardized with C99 and is available
3563 almost everywhere because of its high usefulness. 3567 almost everywhere because of its high usefulness.
3564 In project's own implementation of 3568 The project's own implementation of
3565 .Fu snprintf() 3569 .Fu snprintf()
3566 was dropped in March 2012 in favor for using the one of the 3570 was dropped in March 2012 in favor for using the one of the
3567 standard library. 3571 standard library.
3568 .Ci 0052f1024deb0a0a2fc2e5bacf93d45a5a9c9b32 3572 .Ci 0052f1024deb0a0a2fc2e5bacf93d45a5a9c9b32
3569 Such decisions limit the portability of mmh 3573 Such decisions limit the portability of mmh
3570 if systems do not support these standardized and widespread functions. 3574 if systems do not support these standardized and widespread functions.
3571 This compromise is made because mmh focuses on the future. 3575 This compromise is made because mmh focuses on the future.
3572 .P 3576 .P
3573 I am not yet thirty years old and my C and Unix experience comprises 3577 .\" XXX kuerzen und mit dem naechsten Absatz vereinen
3578 I am still in my twenties and my C and Unix experience comprises
3574 only half a dozen years. 3579 only half a dozen years.
3575 Hence, I need to learn about the history in retrospective. 3580 Hence, I need to learn about the history in retrospective.
3576 I have not used those ancient constructs myself. 3581 I have not used those ancient constructs myself.
3577 I have not suffered from their incompatibilities. 3582 I have not suffered from their incompatibilities.
3578 I have not longed for standardization. 3583 I have not longed for standardization.
3579 All my programming experience is from a time when ANSI C and POSIX 3584 All my programming experience is from a time when ANSI C and POSIX
3580 were well established already. 3585 were well established already.
3581 I have only read a lot of books about the (good) old times. 3586 I have only read a lot of books about the (good) old times.
3582 This puts me in a difficult positions when working with old code. 3587 This puts me in a difficult position when working with old code.
3583 I need to freshly acquire knowledge about old code constructs and ancient 3588 I need to freshly acquire knowledge about old code constructs and ancient
3584 programming styles, whereas older programmers know these things by 3589 programming styles, whereas older programmers know these things by
3585 heart from their own experience. 3590 heart from their own experience.
3586 .P 3591 .P
3587 Being aware of the situation, I rather let people with more historic 3592 Being aware of the situation, I rather let people with more historic
3627 put a load on mmh. 3632 put a load on mmh.
3628 .Ci b067ff5c465a5d243ce5a19e562085a9a1a97215 3633 .Ci b067ff5c465a5d243ce5a19e562085a9a1a97215
3629 .P 3634 .P
3630 The 3635 The
3631 .Fu copy() 3636 .Fu copy()
3632 function copies the string in argument one to the location in two. 3637 function copies the string in parameter one to the location in
3638 parameter two.
3633 In contrast to 3639 In contrast to
3634 .Fu strcpy() , 3640 .Fu strcpy() ,
3635 it returns a pointer to the terminating null-byte in the destination area. 3641 it returns a pointer to the terminating null-byte in the destination area.
3636 The code was adjusted to replace 3642 The code was adjusted to replace
3637 .Fu copy() 3643 .Fu copy()
3732 configuration file. 3738 configuration file.
3733 Why else should the mail storage and the configuration files be intermixed? 3739 Why else should the mail storage and the configuration files be intermixed?
3734 They are different kinds of data: 3740 They are different kinds of data:
3735 The data to be operated on and the configuration to change how 3741 The data to be operated on and the configuration to change how
3736 tools operate. 3742 tools operate.
3743 .\" XXX bad ... inapropriate?
3737 Splitting the configuration between the profile and the MH directory 3744 Splitting the configuration between the profile and the MH directory
3738 is bad. 3745 is bad.
3739 Merging the mail storage and the configuration in one directory is bad 3746 Merging the mail storage and the configuration in one directory is bad
3740 as well. 3747 as well.
3741 As the mail storage and the configuration were not separated sensibly 3748 As the mail storage and the configuration were not separated sensibly
3811 .H2 "Modularization 3818 .H2 "Modularization
3812 .P 3819 .P
3813 The source code of the mmh tools is located in the 3820 The source code of the mmh tools is located in the
3814 .Fn uip 3821 .Fn uip
3815 (``user interface programs'') directory. 3822 (``user interface programs'') directory.
3816 Each tools has a source file with the name of the command. 3823 Each tool has a source file with the name of the command.
3817 For example, 3824 For example,
3818 .Pn rmm 3825 .Pn rmm
3819 is built from 3826 is built from
3820 .Fn uip/rmm.c . 3827 .Fn uip/rmm.c .
3821 Some source files are used for multiple programs. 3828 Some source files are used for multiple programs.
3833 This is a ratio of 1.3 source files per program. 3840 This is a ratio of 1.3 source files per program.
3834 18 programs depend on multiple source files; 3841 18 programs depend on multiple source files;
3835 21 programs depend on one source file only. 3842 21 programs depend on one source file only.
3836 (These numbers and the ones in the following text ignore the MH library 3843 (These numbers and the ones in the following text ignore the MH library
3837 as well as shell scripts and multiple names for the same program.) 3844 as well as shell scripts and multiple names for the same program.)
3845 .\" XXX graph
3838 .P 3846 .P
3839 Splitting the source code of a large program into multiple files can 3847 Splitting the source code of a large program into multiple files can
3840 increase the readability of its source code. 3848 increase the readability of its source code.
3841 Most of the mmh tools, however, are simple and straight-forward programs. 3849 .\" XXX however?
3850 Most of the mmh tools are simple and straight-forward programs.
3842 With the exception of the MIME handling tools, 3851 With the exception of the MIME handling tools,
3843 .Pn pick 3852 .Pn pick
3844 is the largest tool. 3853 is the largest tool.
3845 It contains 1\|037 lines of source code (measured with 3854 It contains 1\|037 lines of source code, excluding the MH library.
3846 .Pn sloccount ), excluding the MH library.
3847 Only the MIME handling tools (\c 3855 Only the MIME handling tools (\c
3848 .Pn mhbuild , 3856 .Pn mhbuild ,
3849 .Pn mhstore , 3857 .Pn mhstore ,
3850 .Pn show , 3858 .Pn show ,
3851 etc.) 3859 etc.)
3986 .Pn refile . 3994 .Pn refile .
3987 Still, it is a good example for a simple tool with clear sources. 3995 Still, it is a good example for a simple tool with clear sources.
3988 .P 3996 .P
3989 Understanding 3997 Understanding
3990 .Pn comp 3998 .Pn comp
3991 requires to read 210 lines of code in mmh, but ten times as much in nmh. 3999 .\" XXX kate fragen: more vs. as much
4000 requires to read 210 lines of code in mmh, but ten times more in nmh.
3992 Due to the aforementioned hack in 4001 Due to the aforementioned hack in
3993 .Pn anno 4002 .Pn anno
3994 to save the additional parameter, information passed through the program's 4003 to save the additional parameter, information passed through the program's
3995 source base in obscure ways. 4004 source base in obscure ways.
3996 Thus, understanding 4005 Thus, understanding