Mercurial > docs > master
comparison discussion.roff @ 133:02660c14f6a8
Further re-ordering of the sections.
author | markus schnalke <meillo@marmaro.de> |
---|---|
date | Tue, 03 Jul 2012 16:50:41 +0200 |
parents | 7c741bc8f719 |
children | edf46861132b |
comparison
equal
deleted
inserted
replaced
132:8c56dac46efe | 133:02660c14f6a8 |
---|---|
9 Current changes of nmh will be mentioned only as side notes. | 9 Current changes of nmh will be mentioned only as side notes. |
10 .\" XXX where do I discuss the parallel development of nmh? | 10 .\" XXX where do I discuss the parallel development of nmh? |
11 | 11 |
12 | 12 |
13 | 13 |
14 .\" -------------------------------------------------------------- | |
14 .H1 "Streamlining | 15 .H1 "Streamlining |
15 | 16 |
16 .P | 17 .P |
17 MH had been considered an all-in-one system for mail handling. | 18 MH had been considered an all-in-one system for mail handling. |
18 The community around nmh has a similar understanding. | 19 The community around nmh has a similar understanding. |
422 That does not hurt because | 423 That does not hurt because |
423 .Pn slocal | 424 .Pn slocal |
424 is unrelated to the rest of the project. | 425 is unrelated to the rest of the project. |
425 | 426 |
426 | 427 |
427 .H3 "Profile Reading | 428 |
428 .P | 429 .H2 "\fLshow\fP and \fPmhshow\fP |
429 FIXME XXX | 430 .P |
430 | 431 Since the very beginning, already in the first concept paper, |
431 commit 3e017a7abbdf69bf0dff7a4073275961eda1ded8 | |
432 Author: markus schnalke <meillo@marmaro.de> | |
433 Date: Wed Jun 27 14:23:35 2012 +0200 | |
434 | |
435 spost: Read profile and context now. Removed -library switch. | |
436 spost is a full part of the mmh toolchest, hence, it shall read the | |
437 profile/context. This will remove the need to pass profile information | |
438 from send to spost via command line switches. | |
439 In January 2012, there had been a discussion on the nmh-workers ML | |
440 whether post should read the profile/context. There wasn't a clear | |
441 answer. It behavior was mainly motivated by the historic situation, | |
442 it seems. My opinion on the topic goes into the direction that every | |
443 tool that is part of the mmh toolchest should read the profile. That | |
444 is a clear and simple concept. Using MH tools without wanting to | |
445 interact with MH (like mhmail had been) is no more a practical problem. | |
446 | |
447 commit 32d4f9daaa70519be3072479232ff7be0500d009 | |
448 Author: markus schnalke <meillo@marmaro.de> | |
449 Date: Wed Jun 27 13:15:47 2012 +0200 | |
450 | |
451 mhmail: Read the context! | |
452 mhmail will change from a mailx-replacment to an alternative to | |
453 `comp -ed prompter', thus being a send front-end. Hence, mhmail | |
454 should not stay outside the profile/context respecting mmh toolchest. | |
455 | |
456 | |
457 slocal | |
458 | |
459 | |
460 | |
461 | |
462 .H2 "Displaying Messages | |
463 .P | |
464 FIXME XXX | |
465 | |
466 .U3 "\fLshow\fP and \fPmhshow\fP | |
467 .P | |
468 Since the very beginning \(en already in the first concept paper \(en | |
469 .Pn show | 432 .Pn show |
470 had been MH's message display program. | 433 had been MH's message display program. |
471 .Pn show | 434 .Pn show |
472 mapped message numbers and sequences to files and invoked | 435 mapped message numbers and sequences to files and invoked |
473 .Pn mhl | 436 .Pn mhl |
600 .Pn show . | 563 .Pn show . |
601 But there is no chance; | 564 But there is no chance; |
602 supporting MIME demands for higher essential complexity. | 565 supporting MIME demands for higher essential complexity. |
603 | 566 |
604 | 567 |
605 .U3 "Scan Listings | 568 .H2 "Scan Listings |
606 .P | 569 .P |
607 FIXME XXX | 570 FIXME XXX |
608 | 571 |
609 .P | 572 .P |
610 | |
611 commit c20e315f9fb9f0f0955749726dbf4fd897cd9f48 | 573 commit c20e315f9fb9f0f0955749726dbf4fd897cd9f48 |
612 Author: markus schnalke <meillo@marmaro.de> | 574 Author: markus schnalke <meillo@marmaro.de> |
613 Date: Fri Dec 9 21:56:44 2011 +0100 | 575 Date: Fri Dec 9 21:56:44 2011 +0100 |
614 | 576 |
615 Adjusted the default scan listing: remove the body preview | 577 Adjusted the default scan listing: remove the body preview |
623 Scan listings shall operator on message headers and non-message information | 585 Scan listings shall operator on message headers and non-message information |
624 only. Displaying the beginning of the body complicates everything too much. | 586 only. Displaying the beginning of the body complicates everything too much. |
625 That's no surprise, because it's something completely different. If you | 587 That's no surprise, because it's something completely different. If you |
626 want to examine the body, then use show(1)/mhshow(1). | 588 want to examine the body, then use show(1)/mhshow(1). |
627 Changed the default scan formats accordingly. | 589 Changed the default scan formats accordingly. |
590 | |
628 | 591 |
629 | 592 |
630 | 593 |
631 .H2 "Configure Options | 594 .H2 "Configure Options |
632 .P | 595 .P |
735 .P | 698 .P |
736 Eventually, however, the new trash folder concept | 699 Eventually, however, the new trash folder concept |
737 .Cf "Sec. XXX | 700 .Cf "Sec. XXX |
738 obsoleted the concept of the backup prefix completely. | 701 obsoleted the concept of the backup prefix completely. |
739 .Ci 8edc5aaf86f9f77124664f6801bc6c6cdf258173 | 702 .Ci 8edc5aaf86f9f77124664f6801bc6c6cdf258173 |
740 .\" (Well, there still are corner-cases to remove until the backup | 703 .Ci ca0b3e830b86700d9e5e31b1784de2bdcaf58fc5 |
741 .\" prefix can be laid to rest, eventually.) | 704 |
742 .\" FIXME: Do this work in the code! | |
743 | 705 |
744 .U3 "Editor and Pager | 706 .U3 "Editor and Pager |
745 .P | 707 .P |
746 The two configure options | 708 The two configure options |
747 .CW --with-editor=EDITOR | 709 .CW --with-editor=EDITOR |
1699 .\" XXX: whatnow prompt commands | 1661 .\" XXX: whatnow prompt commands |
1700 | 1662 |
1701 | 1663 |
1702 | 1664 |
1703 | 1665 |
1666 .\" -------------------------------------------------------------- | |
1704 .H1 "Modernizing | 1667 .H1 "Modernizing |
1705 .P | 1668 .P |
1706 In the over thirty years of MH's existence, its code base was | 1669 In the over thirty years of MH's existence, its code base was |
1707 extended more and more. | 1670 extended more and more. |
1708 New features entered the project and became alternatives to the | 1671 New features entered the project and became alternatives to the |
2445 .P | 2408 .P |
2446 FIXME | 2409 FIXME |
2447 | 2410 |
2448 | 2411 |
2449 | 2412 |
2450 .H2 "Modern Defaults | 2413 .H2 "Draft and Trash Folder |
2451 .P | |
2452 Nmh has a bunch of convenience-improving features inactive by default, | |
2453 although one can expect every new user wanting to have them active. | |
2454 The reason they are inactive by default is the wish to stay compatible | |
2455 with old versions. | |
2456 But what is the definition for old versions. | |
2457 Still, the highly useful draft folder facility is not active by default | |
2458 although it had been introduced over twenty-five years ago | |
2459 .[ | |
2460 rose romine real work | |
2461 .] | |
2462 \(en the community seems not to care. | |
2463 This is one of several examples that require new users to build up | |
2464 their profile before they can access the modern features of nmh. | |
2465 Without an extensively built-up profile, the setup is hardly usable | |
2466 for modern emailing. | |
2467 The point is not the customization of the setup, | |
2468 but the activating of generally useful facilities. | |
2469 .P | |
2470 Yet, the real problem lies less in enabling the features, as this is | |
2471 straight forward as soon as one knows what he wants. | |
2472 The real problem is that new users need deep insights into the project | |
2473 before they find out what they are missing and that nmh actually | |
2474 provides it already, it just was not activated. | |
2475 To give an example, I needed one year of using nmh | |
2476 before I became aware of the existence of the attachment system. | |
2477 One could argue that this fact disqualifies my reading of the | |
2478 documentation. | |
2479 If I would have installed nmh from source back then, I could agree. | |
2480 Yet, I had used a prepackaged version and had expected that it would | |
2481 just work. | |
2482 Nevertheless, I had been convinced by the concepts of MH already | |
2483 and I am a software developer, | |
2484 still I required a lot of time to discover the cool features. | |
2485 How can we expect users to be even more advanced than me, | |
2486 just to allow them use MH in a convenient and modern way? | |
2487 Unless they are strongly convinced of the concepts, they will fail. | |
2488 I have seen friends of me giving up disappointed | |
2489 before they truly used the system, | |
2490 although they had been motivated in the beginning. | |
2491 They suffer hard enough to get used to the toolchest approach, | |
2492 we should spare them further inconveniences. | |
2493 .P | |
2494 Maintaining compatibility for its own sake is for no good. | |
2495 If any MH implementation would be the back-end of widespread | |
2496 email clients with large user bases, compatibility would be more | |
2497 important. | |
2498 Yet, it appears as if this is not the case. | |
2499 Hence, compatibility is hardly important for technical reasons. | |
2500 Its importance originates rather from personal reasons. | |
2501 Nmh's user base is small and old. | |
2502 Changing the interfaces would cause inconvenience to long-term users of MH. | |
2503 It would force them to change their many years old MH configurations. | |
2504 I do understand this aspect, but it keeps new users from using MH. | |
2505 By sticking to the old users, new users are kept away. | |
2506 Yet, the future lies in new users. | |
2507 Hence, mmh invites new users by providing a convenient and modern setup, | |
2508 readily usable out-of-the-box. | |
2509 .P | |
2510 In mmh, all modern features are active by default. | |
2511 In consequence, a setup with a profile that defines only the path to the | |
2512 mail storage, is already convenient to use. | |
2513 Again, Paul Vixie's ``edginess'' appeal supports the direction I took: | |
2514 ``the `main branch' should just be modern''. | |
2515 .[ | |
2516 paul vixie edginess nmh-workers | |
2517 .] | |
2518 .P | |
2519 Modern features that are active in mmh by default include: | |
2520 .BU | |
2521 The attachment system (\c | |
2522 .Hd Attach ). | |
2523 .Ci 8ff284ff9167eff8f5349481529332d59ed913b1 | |
2524 .BU | |
2525 The draft folder facility (\c | |
2526 .Fn +drafts ). | |
2527 .Ci 337338b404931f06f0db2119c9e145e8ca5a9860 | |
2528 .BU | |
2529 The unseen sequence (`u') | |
2530 .Ci c2360569e1d8d3678e294eb7c1354cb8bf7501c1 | |
2531 and the sequence negation prefix (`!'). | |
2532 .Ci db74c2bd004b2dc9bf8086a6d8bf773ac051f3cc | |
2533 .BU | |
2534 Quoting the original message in the reply. | |
2535 .Ci 67411b1f95d6ec987b4c732459e1ba8a8ac192c6 | |
2536 .BU | |
2537 Forwarding messages using MIME. | |
2538 .Ci 6e271608b7b9c23771523f88d23a4d3593010cf1 | |
2539 | |
2540 | |
2541 | |
2542 .H2 "Drafts and Trash Folder | |
2543 .P | 2414 .P |
2544 | 2415 |
2545 .U3 "Draft Folder | 2416 .U3 "Draft Folder |
2546 .P | 2417 .P |
2547 In the beginning, MH had the concept of a draft message. | 2418 In the beginning, MH had the concept of a draft message. |
2642 Dropping the draft message concept in favor for the draft folder concept, | 2513 Dropping the draft message concept in favor for the draft folder concept, |
2643 removed special cases with regular cases. | 2514 removed special cases with regular cases. |
2644 This simplified the source code of the tools, as well as the concepts. | 2515 This simplified the source code of the tools, as well as the concepts. |
2645 In mmh, draft management does not break with the MH concepts | 2516 In mmh, draft management does not break with the MH concepts |
2646 but applies them. | 2517 but applies them. |
2518 .Cl "scan +drafts" , | |
2519 for instance, is a truly natural request. | |
2647 Most of the work was already done by Rose in the eighties. | 2520 Most of the work was already done by Rose in the eighties. |
2648 The original improvement in mmh is dropping the draft message approach | 2521 The original improvement of mmh is dropping the old draft message approach |
2649 completely and thus simplifying the tools, the documentation and the | 2522 and thus simplifying the tools, the documentation and the system as a whole. |
2650 system as a whole. | |
2651 Although my part in the draft handling improvement was small, | 2523 Although my part in the draft handling improvement was small, |
2652 it was important. | 2524 it was an important one. |
2653 | 2525 |
2654 | 2526 |
2655 .U3 "Trash Folder | 2527 .U3 "Trash Folder |
2656 .P | 2528 .P |
2657 Similar to the situation for drafts is the situation for removed messages. | 2529 Similar to the situation for drafts is the situation for removed messages. |
2805 by the MH concepts makes the whole system more powerful. | 2677 by the MH concepts makes the whole system more powerful. |
2806 | 2678 |
2807 | 2679 |
2808 | 2680 |
2809 | 2681 |
2810 | 2682 .H2 "Modern Defaults |
2683 .P | |
2684 Nmh has a bunch of convenience-improving features inactive by default, | |
2685 although one can expect every new user wanting to have them active. | |
2686 The reason they are inactive by default is the wish to stay compatible | |
2687 with old versions. | |
2688 But what is the definition for old versions. | |
2689 Still, the highly useful draft folder facility is not active by default | |
2690 although it had been introduced over twenty-five years ago | |
2691 .[ | |
2692 rose romine real work | |
2693 .] | |
2694 \(en the community seems not to care. | |
2695 This is one of several examples that require new users to build up | |
2696 their profile before they can access the modern features of nmh. | |
2697 Without an extensively built-up profile, the setup is hardly usable | |
2698 for modern emailing. | |
2699 The point is not the customization of the setup, | |
2700 but the activating of generally useful facilities. | |
2701 .P | |
2702 Yet, the real problem lies less in enabling the features, as this is | |
2703 straight forward as soon as one knows what he wants. | |
2704 The real problem is that new users need deep insights into the project | |
2705 before they find out what they are missing and that nmh actually | |
2706 provides it already, it just was not activated. | |
2707 To give an example, I needed one year of using nmh | |
2708 before I became aware of the existence of the attachment system. | |
2709 One could argue that this fact disqualifies my reading of the | |
2710 documentation. | |
2711 If I would have installed nmh from source back then, I could agree. | |
2712 Yet, I had used a prepackaged version and had expected that it would | |
2713 just work. | |
2714 Nevertheless, I had been convinced by the concepts of MH already | |
2715 and I am a software developer, | |
2716 still I required a lot of time to discover the cool features. | |
2717 How can we expect users to be even more advanced than me, | |
2718 just to allow them use MH in a convenient and modern way? | |
2719 Unless they are strongly convinced of the concepts, they will fail. | |
2720 I have seen friends of me giving up disappointed | |
2721 before they truly used the system, | |
2722 although they had been motivated in the beginning. | |
2723 They suffer hard enough to get used to the toolchest approach, | |
2724 we should spare them further inconveniences. | |
2725 .P | |
2726 Maintaining compatibility for its own sake is for no good. | |
2727 If any MH implementation would be the back-end of widespread | |
2728 email clients with large user bases, compatibility would be more | |
2729 important. | |
2730 Yet, it appears as if this is not the case. | |
2731 Hence, compatibility is hardly important for technical reasons. | |
2732 Its importance originates rather from personal reasons. | |
2733 Nmh's user base is small and old. | |
2734 Changing the interfaces would cause inconvenience to long-term users of MH. | |
2735 It would force them to change their many years old MH configurations. | |
2736 I do understand this aspect, but it keeps new users from using MH. | |
2737 By sticking to the old users, new users are kept away. | |
2738 Yet, the future lies in new users. | |
2739 Hence, mmh invites new users by providing a convenient and modern setup, | |
2740 readily usable out-of-the-box. | |
2741 .P | |
2742 In mmh, all modern features are active by default. | |
2743 In consequence, a setup with a profile that defines only the path to the | |
2744 mail storage, is already convenient to use. | |
2745 Again, Paul Vixie's ``edginess'' appeal supports the direction I took: | |
2746 ``the `main branch' should just be modern''. | |
2747 .[ | |
2748 paul vixie edginess nmh-workers | |
2749 .] | |
2750 .P | |
2751 Modern features that are active in mmh by default include: | |
2752 .BU | |
2753 The attachment system (\c | |
2754 .Hd Attach ). | |
2755 .Ci 8ff284ff9167eff8f5349481529332d59ed913b1 | |
2756 .BU | |
2757 The draft folder facility (\c | |
2758 .Fn +drafts ). | |
2759 .Ci 337338b404931f06f0db2119c9e145e8ca5a9860 | |
2760 .BU | |
2761 The unseen sequence (`u') | |
2762 .Ci c2360569e1d8d3678e294eb7c1354cb8bf7501c1 | |
2763 and the sequence negation prefix (`!'). | |
2764 .Ci db74c2bd004b2dc9bf8086a6d8bf773ac051f3cc | |
2765 .BU | |
2766 Quoting the original message in the reply. | |
2767 .Ci 67411b1f95d6ec987b4c732459e1ba8a8ac192c6 | |
2768 .BU | |
2769 Forwarding messages using MIME. | |
2770 .Ci 6e271608b7b9c23771523f88d23a4d3593010cf1 | |
2771 | |
2772 | |
2773 | |
2774 | |
2775 | |
2776 .\" -------------------------------------------------------------- | |
2811 .H1 "Styling | 2777 .H1 "Styling |
2812 .P | 2778 .P |
2813 Kernighan and Pike have emphasized the importance of style in the | 2779 Kernighan and Pike have emphasized the importance of style in the |
2814 preface of their book: | 2780 preface of their book: |
2815 .[ [ | 2781 .[ [ |
2957 Having the new variables with descriptive names, a more | 2923 Having the new variables with descriptive names, a more |
2958 straight forward implementation became apparent. | 2924 straight forward implementation became apparent. |
2959 Before the clarification was done, | 2925 Before the clarification was done, |
2960 the possibility to improve had not be seen. | 2926 the possibility to improve had not be seen. |
2961 .Ci aa60b0ab5e804f8befa890c0a6df0e3143ce0723 | 2927 .Ci aa60b0ab5e804f8befa890c0a6df0e3143ce0723 |
2928 | |
2929 | |
2930 | |
2931 .H2 "Structural Rework | |
2932 .P | |
2962 | 2933 |
2963 .U3 "Rework of \f(CWanno\fP | 2934 .U3 "Rework of \f(CWanno\fP |
2964 .P | 2935 .P |
2965 At the end of their chapter on style, | 2936 At the end of their chapter on style, |
2966 Kernighan and Pike ask: ``But why worry about style?'' | 2937 Kernighan and Pike ask: ``But why worry about style?'' |
3133 VE | 3104 VE |
3134 .\" XXX think about explaining the -preserve rework? | 3105 .\" XXX think about explaining the -preserve rework? |
3135 | 3106 |
3136 | 3107 |
3137 | 3108 |
3109 .U3 "Path Conversion | |
3110 .P | |
3111 FIXME! XXX | |
3112 | |
3113 | |
3114 commit d39e2c447b0d163a5a63f480b23d06edb7a73aa0 | |
3115 Author: markus schnalke <meillo@marmaro.de> | |
3116 Date: Fri Dec 9 16:34:57 2011 +0100 | |
3117 | |
3118 Completely reworked the path convertion functions | |
3119 Moved everything (from sbr/getfolder.c and sbr/m_maildir.c) into | |
3120 sbr/path.c, but actually replaced the code almost completely. | |
3121 See h/prototypes.h for the function changes. | |
3122 sbr/path.c provides explaining comments on the functions. | |
3123 None of them allocates memory automatically. | |
3124 | |
3125 Additionally: | |
3126 - Like for other ``files'', `inc -audit file' places file relative | |
3127 to the cwd, not relative to the mh-dir. This is for consistency. | |
3128 - Replaced add(foo, NULL) with getcpy(foo), which ist clearer. | |
3129 | |
3130 | |
3131 | |
3132 | |
3133 | |
3134 .H2 "Profile Reading | |
3135 .P | |
3136 FIXME XXX | |
3137 | |
3138 commit 3e017a7abbdf69bf0dff7a4073275961eda1ded8 | |
3139 Author: markus schnalke <meillo@marmaro.de> | |
3140 Date: Wed Jun 27 14:23:35 2012 +0200 | |
3141 | |
3142 spost: Read profile and context now. Removed -library switch. | |
3143 spost is a full part of the mmh toolchest, hence, it shall read the | |
3144 profile/context. This will remove the need to pass profile information | |
3145 from send to spost via command line switches. | |
3146 In January 2012, there had been a discussion on the nmh-workers ML | |
3147 whether post should read the profile/context. There wasn't a clear | |
3148 answer. It behavior was mainly motivated by the historic situation, | |
3149 it seems. My opinion on the topic goes into the direction that every | |
3150 tool that is part of the mmh toolchest should read the profile. That | |
3151 is a clear and simple concept. Using MH tools without wanting to | |
3152 interact with MH (like mhmail had been) is no more a practical problem. | |
3153 | |
3154 commit 32d4f9daaa70519be3072479232ff7be0500d009 | |
3155 Author: markus schnalke <meillo@marmaro.de> | |
3156 Date: Wed Jun 27 13:15:47 2012 +0200 | |
3157 | |
3158 mhmail: Read the context! | |
3159 mhmail will change from a mailx-replacment to an alternative to | |
3160 `comp -ed prompter', thus being a send front-end. Hence, mhmail | |
3161 should not stay outside the profile/context respecting mmh toolchest. | |
3162 | |
3163 | |
3164 slocal | |
3165 | |
3166 | |
3167 | |
3138 | 3168 |
3139 .H2 "Standard Libraries | 3169 .H2 "Standard Libraries |
3140 .P | 3170 .P |
3141 MH is one decade older than the POSIX and ANSI C standards. | 3171 MH is one decade older than the POSIX and ANSI C standards. |
3142 Hence, MH included own implementations of functions | 3172 Hence, MH included own implementations of functions |
3302 .Ci b0b1dd37ff515578cf7cba51625189eb34a196cb | 3332 .Ci b0b1dd37ff515578cf7cba51625189eb34a196cb |
3303 | 3333 |
3304 | 3334 |
3305 | 3335 |
3306 | 3336 |
3307 .H2 "Modularization | |
3308 .P | |
3309 The source code of the mmh tools is located in the | |
3310 .Fn uip | |
3311 (``user interface programs'') directory. | |
3312 Each tools has a source file with the same name. | |
3313 For example, | |
3314 .Pn rmm | |
3315 is built from | |
3316 .Fn uip/rmm.c . | |
3317 Some source files are used for multiple programs. | |
3318 For example | |
3319 .Fn uip/scansbr.c | |
3320 is used for both, | |
3321 .Pn scan | |
3322 and | |
3323 .Pn inc . | |
3324 In nmh, 49 tools were built from 76 source files. | |
3325 This is a ratio of 1.6 source files per program. | |
3326 32 programs depended on multiple source files; | |
3327 17 programs depended on one source file only. | |
3328 In mmh, 39 tools are built from 51 source files. | |
3329 This is a ratio of 1.3 source files per program. | |
3330 18 programs depend on multiple source files; | |
3331 21 programs depend on one source file only. | |
3332 (These numbers and the ones in the following text ignore the MH library | |
3333 as well as shell scripts and multiple names for the same program.) | |
3334 .P | |
3335 Splitting the source code of a large program into multiple files can | |
3336 increase the readability of its source code. | |
3337 Most of the mmh tools, however, are simple and straight-forward programs. | |
3338 With the exception of the MIME handling tools, | |
3339 .Pn pick | |
3340 is the largest tools. | |
3341 It contains 1\|037 lines of source code (measured with | |
3342 .Pn sloccount ), excluding the MH library. | |
3343 Only the MIME handling tools (\c | |
3344 .Pn mhbuild , | |
3345 .Pn mhstore , | |
3346 .Pn show , | |
3347 etc.) | |
3348 are larger. | |
3349 Splitting programs with less than 1\|000 lines of code into multiple | |
3350 source files seldom leads to better readability. | |
3351 For such tools, splitting makes sense | |
3352 when parts of the code are reused in other programs, | |
3353 and the reused code fragment is not general enough | |
3354 for including it in the MH library, | |
3355 or, if the code has dependencies on a library that only few programs need. | |
3356 .Fn uip/packsbr.c , | |
3357 for instance, provides the core program logic for the | |
3358 .Pn packf | |
3359 and | |
3360 .Pn rcvpack | |
3361 programs. | |
3362 .Fn uip/packf.c | |
3363 and | |
3364 .Fn uip/rcvpack.c | |
3365 mainly wrap the core function appropriately. | |
3366 No other tools use the folder packing functions. | |
3367 As another example, | |
3368 .Fn uip/termsbr.c | |
3369 provides termcap support, which requires linking with a termcap or | |
3370 curses library. | |
3371 Including | |
3372 .Fn uip/termsbr.c | |
3373 into the MH library would require every program to be linked with | |
3374 termcap or curses, although only few of the programs require it. | |
3375 .P | |
3376 The task of MIME handling is complex enough that splitting its code | |
3377 into multiple source files improves the readability. | |
3378 The program | |
3379 .Pn mhstore , | |
3380 for instance, is compiled out of seven source files with 2\|500 | |
3381 lines of code in summary. | |
3382 The main code file | |
3383 .Fn uip/mhstore.c | |
3384 consists of 800 lines; the other 1\|700 lines of code are reused in | |
3385 other MIME handling tools. | |
3386 It seems to be worthwhile to bundle the generic MIME handling code into | |
3387 a MH-MIME library, as a companion to the MH standard library. | |
3388 This is left open for the future. | |
3389 .P | |
3390 The work already done, focussed on the non-MIME tools. | |
3391 The amount of code compiled into each program was reduced. | |
3392 This eases the understanding of the code base. | |
3393 In nmh, | |
3394 .Pn comp | |
3395 was built from six source files: | |
3396 .Fn comp.c , | |
3397 .Fn whatnowproc.c , | |
3398 .Fn whatnowsbr.c , | |
3399 .Fn sendsbr.c , | |
3400 .Fn annosbr.c , | |
3401 and | |
3402 .Fn distsbr.c . | |
3403 In mmh, it builds from only two: | |
3404 .Fn comp.c | |
3405 and | |
3406 .Fn whatnowproc.c . | |
3407 In nmh's | |
3408 .Pn comp , | |
3409 the core function of | |
3410 .Pn whatnow , | |
3411 .Pn send , | |
3412 and | |
3413 .Pn anno | |
3414 were compiled into | |
3415 .Pn comp . | |
3416 This saved the need to execute these programs with | |
3417 .Fu fork() | |
3418 and | |
3419 .Fu exec() , | |
3420 two expensive system calls. | |
3421 Whereis this approach improved the time performance, | |
3422 it interweaved the source code. | |
3423 Core functionalities were not encapsulated into programs but into | |
3424 function, which were then wrapped by programs. | |
3425 For example, | |
3426 .Fn uip/annosbr.c | |
3427 included the function | |
3428 .Fu annotate() . | |
3429 Each program that wanted to annotate messages, included the source file | |
3430 .Fn uip/annosbr.c | |
3431 and called | |
3432 .Fu annotate() . | |
3433 Because the function | |
3434 .Fu annotate() | |
3435 was used like the tool | |
3436 .Pn anno , | |
3437 it had seven parameters, reflecting the command line switches of the tool. | |
3438 When another pair of command line switches was added to | |
3439 .Pn anno , | |
3440 a rather ugly hack was implemented to avoid adding another parameter | |
3441 to the function. | |
3442 .Ci d9b1d57351d104d7ec1a5621f090657dcce8cb7f | |
3443 .P | |
3444 Separation simplifies the understanding of program code | |
3445 because the area influenced by any particular statement is smaller. | |
3446 The separating on the program-level is more strict than the separation | |
3447 on the function level. | |
3448 In mmh, the relevant code of | |
3449 .Pn comp | |
3450 comprises the two files | |
3451 .Fn uip/comp.c | |
3452 and | |
3453 .Fn uip/whatnowproc.c , | |
3454 together 210 lines of code. | |
3455 In nmh, | |
3456 .Pn comp | |
3457 comprises six files with 2\|450 lines. | |
3458 Not all of the code in these six files was actually used by | |
3459 .Pn comp , | |
3460 but the code reader needed to read all of the code first to know which | |
3461 parts were used. | |
3462 .P | |
3463 As I have read a lot in the code base during the last two years, | |
3464 I learned about the easy and the difficult parts. | |
3465 Code is easy to understand if: | |
3466 .BU | |
3467 The influenced code area is small | |
3468 .BU | |
3469 The boundaries are strictly defined | |
3470 .BU | |
3471 The code is written straight-forward | |
3472 .P | |
3473 .\" XXX move this paragraph somewhere else? | |
3474 Reading | |
3475 .Pn rmm 's | |
3476 source code in | |
3477 .Fn uip/rmm.c | |
3478 is my recommendation for a beginner's entry point into the code base of nmh. | |
3479 The reasons are that the task of | |
3480 .Pn rmm | |
3481 is straight forward and it consists of one small source code file only, | |
3482 yet its source includes code constructs typical for MH tools. | |
3483 With the introduction of the trash folder in mmh, | |
3484 .Pn rmm | |
3485 became a bit more complex, because it invokes | |
3486 .Pn refile . | |
3487 Still, it is a good example for a simple tool with clear sources. | |
3488 .P | |
3489 Understanding | |
3490 .Pn comp | |
3491 requires to read 210 lines of code in mmh, but ten times as much in nmh. | |
3492 Due to the aforementioned hack in | |
3493 .Pn anno | |
3494 to save the additional parameter, information passed through the program's | |
3495 source base in obscure ways. | |
3496 Thus, understanding | |
3497 .Pn comp , | |
3498 required understanding the inner workings of | |
3499 .Fn uip/annosbr.c | |
3500 first. | |
3501 To be sure to fully understand a program, its whole source code needs | |
3502 to be examined. | |
3503 Not doing so is a leap of faith, assuming that the developers | |
3504 have avoided obscure programming techniques. | |
3505 By separating the tools on the program-level, the boundaries are | |
3506 clearly visible and technically enforced. | |
3507 The interfaces are calls to | |
3508 .Fu exec() | |
3509 rather than arbitrary function calls. | |
3510 .P | |
3511 But the real problem is another: | |
3512 Nmh violates the golden ``one tool, one job'' rule of the Unix philosophy. | |
3513 Understanding | |
3514 .Pn comp | |
3515 requires understanding | |
3516 .Fn uip/annosbr.c | |
3517 and | |
3518 .Fn uip/sendsbr.c | |
3519 because | |
3520 .Pn comp | |
3521 does annotate and send messages. | |
3522 In nmh, there surely exists the tool | |
3523 .Pn send , | |
3524 which does (almost) only send messages. | |
3525 But | |
3526 .Pn comp | |
3527 and | |
3528 .Pn repl | |
3529 and | |
3530 .Pn forw | |
3531 and | |
3532 .Pn dist | |
3533 and | |
3534 .Pn whatnow | |
3535 and | |
3536 .Pn viamail , | |
3537 they all (!) have the same message sending function included, too. | |
3538 In result, | |
3539 .Pn comp | |
3540 sends messages without using | |
3541 .Pn send . | |
3542 The situation is the same as if | |
3543 .Pn grep | |
3544 would page without | |
3545 .Pn more | |
3546 just because both programs are part of the same code base. | |
3547 .P | |
3548 The clear separation on the surface \(en the toolchest approach \(en | |
3549 is violated on the level below. | |
3550 This violation is for the sake of time performance. | |
3551 On systems where | |
3552 .Fu fork() | |
3553 and | |
3554 .Fu exec() | |
3555 are expensive, the quicker response might be noticable. | |
3556 In the old times, sacrificing readability and conceptional beauty for | |
3557 speed might even have been a must to prevent MH from being unusably slow. | |
3558 Whatever the reasons had been, today they are gone. | |
3559 No longer should we sacrifice readability or conceptional beauty. | |
3560 No longer should we violate the Unix philosophy's ``one tool, one job'' | |
3561 guideline. | |
3562 No longer should we keep speed improvements that became unnecessary. | |
3563 .P | |
3564 Therefore, mmh's | |
3565 .Pn comp | |
3566 does no longer send messages. | |
3567 In mmh, different jobs are divided among separate programs that | |
3568 invoke each other as needed. | |
3569 In consequence, | |
3570 .Pn comp | |
3571 invokes | |
3572 .Pn whatnow | |
3573 which thereafter invokes | |
3574 .Pn send . | |
3575 The clear separation on the surface is maintained on the level below. | |
3576 Human users and the tools use the same interface \(en | |
3577 annotations, for example, are made by invoking | |
3578 .Pn anno , | |
3579 no matter if requested by programs or by human beings. | |
3580 The decrease of tools built from multiple source files and thus | |
3581 the decrease of | |
3582 .Fn uip/*sbr.c | |
3583 files confirm the improvement. | |
3584 .P | |
3585 One disadvantage needs to be taken with this change: | |
3586 The compiler can no longer check the integrity of the interfaces. | |
3587 By changing the command line interfaces of tools, it is | |
3588 the developer's job to adjust the invocations of these tools as well. | |
3589 As this is a manual task and regression tests, which could detect such | |
3590 problems, are not available yet, it is prone to errors. | |
3591 These errors will not be detected at compile time but at run time. | |
3592 Installing regression tests is a task left to do. | |
3593 In the best case, a uniform way of invoking tools from other tools | |
3594 can be developed to allow automated testing at compile time. | |
3595 | |
3596 | |
3597 | |
3598 | 3337 |
3599 .H2 "User Data Locations | 3338 .H2 "User Data Locations |
3600 .P | 3339 .P |
3601 In nmh, a personal setup consists of the MH profile and the MH directory. | 3340 In nmh, a personal setup consists of the MH profile and the MH directory. |
3602 The profile is a file named | 3341 The profile is a file named |
3688 The main achievement of the change is the clear and sensible split | 3427 The main achievement of the change is the clear and sensible split |
3689 between mail storage and configuration. | 3428 between mail storage and configuration. |
3690 | 3429 |
3691 | 3430 |
3692 | 3431 |
3693 .H2 "Path Conversion | 3432 |
3694 .P | 3433 |
3695 FIXME! XXX | 3434 .H2 "Modularization |
3696 | 3435 .P |
3697 | 3436 The source code of the mmh tools is located in the |
3698 commit d39e2c447b0d163a5a63f480b23d06edb7a73aa0 | 3437 .Fn uip |
3699 Author: markus schnalke <meillo@marmaro.de> | 3438 (``user interface programs'') directory. |
3700 Date: Fri Dec 9 16:34:57 2011 +0100 | 3439 Each tools has a source file with the same name. |
3701 | 3440 For example, |
3702 Completely reworked the path convertion functions | 3441 .Pn rmm |
3703 Moved everything (from sbr/getfolder.c and sbr/m_maildir.c) into | 3442 is built from |
3704 sbr/path.c, but actually replaced the code almost completely. | 3443 .Fn uip/rmm.c . |
3705 See h/prototypes.h for the function changes. | 3444 Some source files are used for multiple programs. |
3706 sbr/path.c provides explaining comments on the functions. | 3445 For example |
3707 None of them allocates memory automatically. | 3446 .Fn uip/scansbr.c |
3708 | 3447 is used for both, |
3709 Additionally: | 3448 .Pn scan |
3710 - Like for other ``files'', `inc -audit file' places file relative | 3449 and |
3711 to the cwd, not relative to the mh-dir. This is for consistency. | 3450 .Pn inc . |
3712 - Replaced add(foo, NULL) with getcpy(foo), which ist clearer. | 3451 In nmh, 49 tools were built from 76 source files. |
3452 This is a ratio of 1.6 source files per program. | |
3453 32 programs depended on multiple source files; | |
3454 17 programs depended on one source file only. | |
3455 In mmh, 39 tools are built from 51 source files. | |
3456 This is a ratio of 1.3 source files per program. | |
3457 18 programs depend on multiple source files; | |
3458 21 programs depend on one source file only. | |
3459 (These numbers and the ones in the following text ignore the MH library | |
3460 as well as shell scripts and multiple names for the same program.) | |
3461 .P | |
3462 Splitting the source code of a large program into multiple files can | |
3463 increase the readability of its source code. | |
3464 Most of the mmh tools, however, are simple and straight-forward programs. | |
3465 With the exception of the MIME handling tools, | |
3466 .Pn pick | |
3467 is the largest tools. | |
3468 It contains 1\|037 lines of source code (measured with | |
3469 .Pn sloccount ), excluding the MH library. | |
3470 Only the MIME handling tools (\c | |
3471 .Pn mhbuild , | |
3472 .Pn mhstore , | |
3473 .Pn show , | |
3474 etc.) | |
3475 are larger. | |
3476 Splitting programs with less than 1\|000 lines of code into multiple | |
3477 source files seldom leads to better readability. | |
3478 For such tools, splitting makes sense | |
3479 when parts of the code are reused in other programs, | |
3480 and the reused code fragment is not general enough | |
3481 for including it in the MH library, | |
3482 or, if the code has dependencies on a library that only few programs need. | |
3483 .Fn uip/packsbr.c , | |
3484 for instance, provides the core program logic for the | |
3485 .Pn packf | |
3486 and | |
3487 .Pn rcvpack | |
3488 programs. | |
3489 .Fn uip/packf.c | |
3490 and | |
3491 .Fn uip/rcvpack.c | |
3492 mainly wrap the core function appropriately. | |
3493 No other tools use the folder packing functions. | |
3494 As another example, | |
3495 .Fn uip/termsbr.c | |
3496 provides termcap support, which requires linking with a termcap or | |
3497 curses library. | |
3498 Including | |
3499 .Fn uip/termsbr.c | |
3500 into the MH library would require every program to be linked with | |
3501 termcap or curses, although only few of the programs require it. | |
3502 .P | |
3503 The task of MIME handling is complex enough that splitting its code | |
3504 into multiple source files improves the readability. | |
3505 The program | |
3506 .Pn mhstore , | |
3507 for instance, is compiled out of seven source files with 2\|500 | |
3508 lines of code in summary. | |
3509 The main code file | |
3510 .Fn uip/mhstore.c | |
3511 consists of 800 lines; the other 1\|700 lines of code are reused in | |
3512 other MIME handling tools. | |
3513 It seems to be worthwhile to bundle the generic MIME handling code into | |
3514 a MH-MIME library, as a companion to the MH standard library. | |
3515 This is left open for the future. | |
3516 .P | |
3517 The work already done, focussed on the non-MIME tools. | |
3518 The amount of code compiled into each program was reduced. | |
3519 This eases the understanding of the code base. | |
3520 In nmh, | |
3521 .Pn comp | |
3522 was built from six source files: | |
3523 .Fn comp.c , | |
3524 .Fn whatnowproc.c , | |
3525 .Fn whatnowsbr.c , | |
3526 .Fn sendsbr.c , | |
3527 .Fn annosbr.c , | |
3528 and | |
3529 .Fn distsbr.c . | |
3530 In mmh, it builds from only two: | |
3531 .Fn comp.c | |
3532 and | |
3533 .Fn whatnowproc.c . | |
3534 In nmh's | |
3535 .Pn comp , | |
3536 the core function of | |
3537 .Pn whatnow , | |
3538 .Pn send , | |
3539 and | |
3540 .Pn anno | |
3541 were compiled into | |
3542 .Pn comp . | |
3543 This saved the need to execute these programs with | |
3544 .Fu fork() | |
3545 and | |
3546 .Fu exec() , | |
3547 two expensive system calls. | |
3548 Whereis this approach improved the time performance, | |
3549 it interweaved the source code. | |
3550 Core functionalities were not encapsulated into programs but into | |
3551 function, which were then wrapped by programs. | |
3552 For example, | |
3553 .Fn uip/annosbr.c | |
3554 included the function | |
3555 .Fu annotate() . | |
3556 Each program that wanted to annotate messages, included the source file | |
3557 .Fn uip/annosbr.c | |
3558 and called | |
3559 .Fu annotate() . | |
3560 Because the function | |
3561 .Fu annotate() | |
3562 was used like the tool | |
3563 .Pn anno , | |
3564 it had seven parameters, reflecting the command line switches of the tool. | |
3565 When another pair of command line switches was added to | |
3566 .Pn anno , | |
3567 a rather ugly hack was implemented to avoid adding another parameter | |
3568 to the function. | |
3569 .Ci d9b1d57351d104d7ec1a5621f090657dcce8cb7f | |
3570 .P | |
3571 Separation simplifies the understanding of program code | |
3572 because the area influenced by any particular statement is smaller. | |
3573 The separating on the program-level is more strict than the separation | |
3574 on the function level. | |
3575 In mmh, the relevant code of | |
3576 .Pn comp | |
3577 comprises the two files | |
3578 .Fn uip/comp.c | |
3579 and | |
3580 .Fn uip/whatnowproc.c , | |
3581 together 210 lines of code. | |
3582 In nmh, | |
3583 .Pn comp | |
3584 comprises six files with 2\|450 lines. | |
3585 Not all of the code in these six files was actually used by | |
3586 .Pn comp , | |
3587 but the code reader needed to read all of the code first to know which | |
3588 parts were used. | |
3589 .P | |
3590 As I have read a lot in the code base during the last two years, | |
3591 I learned about the easy and the difficult parts. | |
3592 Code is easy to understand if: | |
3593 .BU | |
3594 The influenced code area is small | |
3595 .BU | |
3596 The boundaries are strictly defined | |
3597 .BU | |
3598 The code is written straight-forward | |
3599 .P | |
3600 .\" XXX move this paragraph somewhere else? | |
3601 Reading | |
3602 .Pn rmm 's | |
3603 source code in | |
3604 .Fn uip/rmm.c | |
3605 is my recommendation for a beginner's entry point into the code base of nmh. | |
3606 The reasons are that the task of | |
3607 .Pn rmm | |
3608 is straight forward and it consists of one small source code file only, | |
3609 yet its source includes code constructs typical for MH tools. | |
3610 With the introduction of the trash folder in mmh, | |
3611 .Pn rmm | |
3612 became a bit more complex, because it invokes | |
3613 .Pn refile . | |
3614 Still, it is a good example for a simple tool with clear sources. | |
3615 .P | |
3616 Understanding | |
3617 .Pn comp | |
3618 requires to read 210 lines of code in mmh, but ten times as much in nmh. | |
3619 Due to the aforementioned hack in | |
3620 .Pn anno | |
3621 to save the additional parameter, information passed through the program's | |
3622 source base in obscure ways. | |
3623 Thus, understanding | |
3624 .Pn comp , | |
3625 required understanding the inner workings of | |
3626 .Fn uip/annosbr.c | |
3627 first. | |
3628 To be sure to fully understand a program, its whole source code needs | |
3629 to be examined. | |
3630 Not doing so is a leap of faith, assuming that the developers | |
3631 have avoided obscure programming techniques. | |
3632 By separating the tools on the program-level, the boundaries are | |
3633 clearly visible and technically enforced. | |
3634 The interfaces are calls to | |
3635 .Fu exec() | |
3636 rather than arbitrary function calls. | |
3637 .P | |
3638 But the real problem is another: | |
3639 Nmh violates the golden ``one tool, one job'' rule of the Unix philosophy. | |
3640 Understanding | |
3641 .Pn comp | |
3642 requires understanding | |
3643 .Fn uip/annosbr.c | |
3644 and | |
3645 .Fn uip/sendsbr.c | |
3646 because | |
3647 .Pn comp | |
3648 does annotate and send messages. | |
3649 In nmh, there surely exists the tool | |
3650 .Pn send , | |
3651 which does (almost) only send messages. | |
3652 But | |
3653 .Pn comp | |
3654 and | |
3655 .Pn repl | |
3656 and | |
3657 .Pn forw | |
3658 and | |
3659 .Pn dist | |
3660 and | |
3661 .Pn whatnow | |
3662 and | |
3663 .Pn viamail , | |
3664 they all (!) have the same message sending function included, too. | |
3665 In result, | |
3666 .Pn comp | |
3667 sends messages without using | |
3668 .Pn send . | |
3669 The situation is the same as if | |
3670 .Pn grep | |
3671 would page without | |
3672 .Pn more | |
3673 just because both programs are part of the same code base. | |
3674 .P | |
3675 The clear separation on the surface \(en the toolchest approach \(en | |
3676 is violated on the level below. | |
3677 This violation is for the sake of time performance. | |
3678 On systems where | |
3679 .Fu fork() | |
3680 and | |
3681 .Fu exec() | |
3682 are expensive, the quicker response might be noticable. | |
3683 In the old times, sacrificing readability and conceptional beauty for | |
3684 speed might even have been a must to prevent MH from being unusably slow. | |
3685 Whatever the reasons had been, today they are gone. | |
3686 No longer should we sacrifice readability or conceptional beauty. | |
3687 No longer should we violate the Unix philosophy's ``one tool, one job'' | |
3688 guideline. | |
3689 No longer should we keep speed improvements that became unnecessary. | |
3690 .P | |
3691 Therefore, mmh's | |
3692 .Pn comp | |
3693 does no longer send messages. | |
3694 In mmh, different jobs are divided among separate programs that | |
3695 invoke each other as needed. | |
3696 In consequence, | |
3697 .Pn comp | |
3698 invokes | |
3699 .Pn whatnow | |
3700 which thereafter invokes | |
3701 .Pn send . | |
3702 The clear separation on the surface is maintained on the level below. | |
3703 Human users and the tools use the same interface \(en | |
3704 annotations, for example, are made by invoking | |
3705 .Pn anno , | |
3706 no matter if requested by programs or by human beings. | |
3707 The decrease of tools built from multiple source files and thus | |
3708 the decrease of | |
3709 .Fn uip/*sbr.c | |
3710 files confirm the improvement. | |
3711 .P | |
3712 One disadvantage needs to be taken with this change: | |
3713 The compiler can no longer check the integrity of the interfaces. | |
3714 By changing the command line interfaces of tools, it is | |
3715 the developer's job to adjust the invocations of these tools as well. | |
3716 As this is a manual task and regression tests, which could detect such | |
3717 problems, are not available yet, it is prone to errors. | |
3718 These errors will not be detected at compile time but at run time. | |
3719 Installing regression tests is a task left to do. | |
3720 In the best case, a uniform way of invoking tools from other tools | |
3721 can be developed to allow automated testing at compile time. |