|
1 | 1 | # Top 10 Recommendations for Fortran Modernization
|
| 2 | + |
| 3 | +Modernizing Fortran codebases is a crucial step toward improving code quality |
| 4 | +and ensuring maintainability. It helps developers uncover hidden bugs and |
| 5 | +reduces the risk of introducing new errors during development. Additionally, |
| 6 | +these efforts support modern compilers and tools in generating optimized code |
| 7 | +and identifying potential issues early. Ultimately, modernization boosts |
| 8 | +developer productivity and enhances code robustness. |
| 9 | + |
| 10 | +## Context and motivation |
| 11 | + |
| 12 | +This project is inspired by the [OWASP](https://owasp.org/) community-led |
| 13 | +initiative, which regularly publishes the most relevant Top 10 Secure Coding |
| 14 | +Recommendations. These are widely adopted by the industry to help developers |
| 15 | +avoid common security vulnerabilities. The OWASP initiative thrives on |
| 16 | +collaboration and knowledge sharing through platforms like their [GitHub |
| 17 | +repository](https://github.com/OWASP/Top10). |
| 18 | + |
| 19 | +Beyond OWASP, various open catalogs provide comprehensive collections of checks |
| 20 | +(rules) to help ensure secure coding practices. Each check describes specific |
| 21 | +scenarios and necessary actions, offering extensive documentation, example |
| 22 | +codes, automated code analysis tools, and references to other resources. |
| 23 | +Notable examples include [SEI CERT |
| 24 | +C](https://wiki.sei.cmu.edu/confluence/display/c) and |
| 25 | +[CWE](https://cwe.mitre.org/). |
| 26 | + |
| 27 | +Building on these foundations, this project aims to start a similar |
| 28 | +community-driven initiative focused on modern Fortran software development. |
| 29 | +Leveraging the existing [Open Catalog on Best Practices for Modernization and |
| 30 | +Performance](https://github.com/codee-com/open-catalog/), we seek to establish |
| 31 | +a dedicated set of Top 10 Recommendations and related checks to address the |
| 32 | +specific challenges of Fortran Modernization. |
| 33 | + |
| 34 | +Modernizing Fortran code encompasses updating and maintaining legacy Fortran |
| 35 | +codes (e.g., F77, F90) with extensive development histories. It also involves |
| 36 | +refactoring existing Fortran codes to leverage the features of the latest |
| 37 | +Fortran standards (e.g., transitioning from F90 to F23). |
| 38 | + |
| 39 | +## Methodology |
| 40 | + |
| 41 | +To develop the Top 10 Recommendations for Fortran Modernization, we adopted a |
| 42 | +comprehensive and community-focused approach. First, we conducted an extensive |
| 43 | +review of existing resources on the topic to identify an initial draft of the |
| 44 | +most recurrent recommendations. These were later discussed with the Fortran |
| 45 | +development community to collect insights and feedback (e.g., in Fortran |
| 46 | +Discourse |
| 47 | +[[12](https://fortran-lang.discourse.group/t/our-initiative-to-publish-the-fortran-lang-top-10-recommendation-for-fortran-modernization-is-it-really-new-or-even-feasible/7774)]), |
| 48 | +which were crucial for shaping the final proposal. |
| 49 | + |
| 50 | +The presented Top 10 Recommendations are prioritized to guide developers |
| 51 | +through a progression of modernization efforts. Each recommendation is detailed |
| 52 | +with specific checks that describe actionable steps, including examples of |
| 53 | +before and after code snippets, the rationale behind the changes, and links to |
| 54 | +further reading. |
| 55 | + |
| 56 | +To ensure the recommendations remain relevant and comprehensive, we plan to |
| 57 | +continuously review community input and update the guidelines as the Fortran |
| 58 | +standards evolve and new best practices emerge. |
| 59 | + |
| 60 | +## Top 10 Recommendations |
| 61 | + |
| 62 | +1. [Strict compliance with modern Fortran |
| 63 | + standards](Recommendations/R1_ModernStandardCompliance.md). |
| 64 | + |
| 65 | +2. [Declare procedures in modules](Recommendations/R2_ProceduresInModules.md). |
| 66 | + |
| 67 | +3. [Restrict data visibility with |
| 68 | + modules](Recommendations/R3_RestrictDataVisibility.md). |
| 69 | + |
| 70 | +4. [Improve dummy arguments |
| 71 | + semantics](Recommendations/R4_ImproveDummyArguments.md). |
| 72 | + |
| 73 | +5. [Improve data type consistency and |
| 74 | + management](Recommendations/R5_ImproveDataTypes.md). |
| 75 | + |
| 76 | +6. [Avoid legacy control-flow |
| 77 | + constructs](Recommendations/R6_AvoidLegacyControlFlow.md). |
| 78 | + |
| 79 | +7. [Enhance source code semantics](Recommendations/R7_EnhanceCodeSemantics.md). |
| 80 | + |
| 81 | +8. [Adhere to code conventions](Recommendations/R8_CodeConventions.md). |
| 82 | + |
| 83 | +9. [Adopt modern development |
| 84 | + practices](Recommendations/R9_ModernDevelopmentPractices.md). |
| 85 | + |
| 86 | +10. [Proper C/C++ interoperability](Recommendations/R10_CInteroperability.md). |
| 87 | + |
| 88 | +## References |
| 89 | + |
| 90 | +- [1] Fortran Community. "Fortran Best Practices". Accessed: Jun. 06, 2024. |
| 91 | + [Online] Available: https://fortran-lang.org/en/learn/best_practices/ |
| 92 | + |
| 93 | +- [2] Fortran Wiki Contributors. "Modernizing Old Fortran". Accessed: Jun. 06, |
| 94 | + 2024. [Online] Available: |
| 95 | + https://fortranwiki.org/fortran/show/Modernizing+Old+Fortran |
| 96 | + |
| 97 | +- [3] Fortran Discourse Community. "Fortran Discourse". Accessed: Jun. 06, |
| 98 | + 2024. [Online] Available: https://fortran-lang.discourse.group |
| 99 | + |
| 100 | +- [4] Reinhold Bader. "Fortran code modernization". Accessed: Jun. 06, 2024. |
| 101 | + [Online] Available: |
| 102 | + https://www.ugent.be/hpc/en/training/2018/modern_fortran_materials/modernfortran2018.pdf |
| 103 | + |
| 104 | +- [5] The Numerical Algorithms Group. "Fortran Modernisation Workshop". |
| 105 | + Accessed: Jun. 06, 2024. [Online] Available: |
| 106 | + https://blog.rwth-aachen.de/hpc_import_20210107/attachments/39157901/39420371.pdf |
| 107 | + |
| 108 | +- [6] The Carpentries. "Best Practices in Modern Fortran". Accessed: Jun. 06, |
| 109 | + 2024. [Online] Available: |
| 110 | + https://wvuhpc.github.io/Modern-Fortran/11-Best-Practices/index.html |
| 111 | + |
| 112 | +- [7] Norman S. Clerman, Walter Spector. "Modern Fortran: Style and Usage". 1st |
| 113 | + Edition, 2011. |
| 114 | + |
| 115 | +- [8] Michael Metcalf, John Reid, Malcolm Cohen, Reinhold Bader. "Modern |
| 116 | + Fortran Explained". 6th Edition, 2023. |
| 117 | + |
| 118 | +- [9] Fortran Users of NERSC (FUN). "FUN Training July 2023: Modern Fortran |
| 119 | + Basics". Accessed: Jun. 06, 2024. [Online] Available: |
| 120 | + https://www.nersc.gov/users/training/past-training-events/2023/fun-training-july-2023-modern-fortran-basics/ |
| 121 | + |
| 122 | +- [10] Jack Carlson, Olaf David. "Fortran 90/95 Coding Conventions - Fortran |
| 123 | + Features that are obsolescent and/or discouraged". Accessed: Jun. 06, 2024. |
| 124 | + [Online] Available: |
| 125 | + https://alm.engr.colostate.edu/cb/wiki/16983#section-Fortran+Features+that+are+obsolescent+and_2For+discouraged |
| 126 | + |
| 127 | +- [11] GitHub Collaborators. "Best practices and styles guidelines of Fortran |
| 128 | + FOSS Programmers". Accessed: Jun. 06, 2024. [Online] Available: |
| 129 | + https://github.com/Fortran-FOSS-Programmers/Best_Practices |
| 130 | + |
| 131 | +- [12] Fortran Discourse Community. "Our initiative to publish the |
| 132 | + 'Fortran-lang Top 10 Recommendation for Fortran modernization', is it really |
| 133 | + new or even feasible?". Accessed: Jun. 06, 2024. [Online] Available: |
| 134 | + https://fortran-lang.discourse.group/t/our-initiative-to-publish-the-fortran-lang-top-10-recommendation-for-fortran-modernization-is-it-really-new-or-even-feasible/7774 |
| 135 | + |
| 136 | +- [13] GitHub Collaborators. "Open Catalog of Best Practices for Modernization |
| 137 | + and Optimization". Accessed: Jun. 06, 2024. [Online] Available: |
| 138 | + https://github.com/codee-com/open-catalog |
0 commit comments