Modular programming

Modular programming is a software design technique that emphasizes separating the functionality of a program into independent, interchangeable modules, such that each contains everything necessary to execute only one aspect of the desired functionality.

A module interface expresses the elements that are provided and required by the module. The elements defined in the interface are detectable by other modules. The implementation contains the working code that corresponds to the elements declared in the interface. Modular programming is closely related to structured programming and object-oriented programming, all having the same goal of facilitating construction of large software programs and systems by decomposition into smaller pieces, and all originating around the 1960s. While the historical usage of these terms has been inconsistent, "modular programming" now refers to the high-level decomposition of the code of an entire program into pieces: structured programming to the low-level code use of structured control flow, and object-oriented programming to the data use of objects, a kind of data structure.

In object-oriented programming, the use of interfaces as an architectural pattern to construct modules is known as interface-based programming.[citation needed]

History

Modular programming, in the form of subsystems (particularly for I/O) and software libraries, dates to early software systems, where it was used for code reuse. Modular programming per se, with a goal of modularity, developed in the late 1960s and 1970s, as a larger-scale analog of the concept of structured programming (1960s). The term "modular programming" dates at least to the National Symposium on Modular Programming, organized at the Information and Systems Institute in July 1968 by Larry Constantine; other key concepts were information hiding (1972) and separation of concerns (SoC, 1974).

Modules were not included in the original specification for ALGOL 68 (1968), but were included as extensions in early implementations, ALGOL 68-R (1970) and ALGOL 68C (1970), and later formalized.[1] One of the first languages designed from the start for modular programming was the short-lived Modula (1975), by Niklaus Wirth. Another early modular language was Mesa (1970s), by Xerox PARC, and Wirth drew on Mesa as well as the original Modula in its successor, Modula-2 (1978), which influenced later languages, particularly through its successor, Modula-3 (1980s). Modula's use of dot-qualified names, like M.a to refer to object a from module M, coincides with notation to access a field of a record (and similarly for attributes or methods of objects), and is now widespread, seen in C#, Dart, Go, Java, OCaml, and Python, among others. Modular programming became widespread from the 1980s: the original Pascal language (1970) did not include modules, but later versions, notably UCSD Pascal (1978) and Turbo Pascal (1983) included them in the form of "units", as did the Pascal-influenced Ada (1980). The Extended Pascal ISO 10206:1990 standard kept closer to Modula2 in its modular support. Standard ML (1984)[2] has one of the most complete module systems, including functors (parameterized modules) to map between modules.

In the 1980s and 1990s, modular programming was overshadowed by and often conflated with object-oriented programming, particularly due to the popularity of C++ and Java. For example, the C family of languages had support for objects and classes in C++ (originally C with Classes, 1980) and Objective-C (1983), only supporting modules 30 years or more later. Java (1995) supports modules in the form of packages, though the primary unit of code organization is a class. However, Python (1991) prominently used both modules and objects from the start, using modules as the primary unit of code organization and "packages" as a larger-scale unit; and Perl 5 (1994) includes support for both modules and objects, with a vast array of modules being available from CPAN (1993). OCaml (1996) followed ML by supporting modules and functors.

Modular programming is now widespread, and found in virtually all major languages developed since the 1990s. The relative importance of modules varies between languages, and in class-based object-oriented languages there is still overlap and confusion with classes as a unit of organization and encapsulation, but these are both well-established as distinct concepts.

Terminology

The term assembly (as in .NET languages like C#, F# or Visual Basic .NET) or package (as in Dart, Go or Java) is sometimes used instead of module. In other implementations, these are distinct concepts; in Python a package is a collection of modules, while in Java 9 the introduction of the new module concept (a collection of packages with enhanced access control) was implemented.

Furthermore, the term "package" has other uses in software (for example .NET NuGet packages). A component is a similar concept, but typically refers to a higher level; a component is a piece of a whole system, while a module is a piece of an individual program. The scale of the term "module" varies significantly between languages; in Python it is very small-scale and each file is a module, while in Java 9 it is planned to be large-scale, where a module is a collection of packages, which are in turn collections of files.

Other terms for modules include unit, used in Pascal dialects.

Language support

Languages that formally support the module concept include Ada, ALGOL, BlitzMax, C++, C#, Clojure, COBOL, Common Lisp, D, Dart, eC, Erlang, Elixir, Elm, F, F#, Fortran, Go, Haskell, IBM/360 Assembler, Control Language (CL), IBM RPG, Java,[a] Julia, MATLAB, ML, Modula, Modula-2, Modula-3, Morpho, NEWP, Oberon, Oberon-2, Objective-C, OCaml, several Pascal derivatives (Component Pascal, Object Pascal, Turbo Pascal, UCSD Pascal), Perl, PHP, PL/I, PureBasic, Python, R, Ruby,[4] Rust, JavaScript,[5] Visual Basic (.NET) and WebDNA.

Conspicuous examples of languages that lack support for modules are C and have been C++ and Pascal in their original form, C and C++ do, however, allow separate compilation and declarative interfaces to be specified using header files. Modules were added to Objective-C in iOS 7 (2013); to C++ with C++20,[6] and Pascal was superseded by Modula and Oberon, which included modules from the start, and various derivatives that included modules. JavaScript has had native modules since ECMAScript 2015.

Modular programming can be performed even where the programming language lacks explicit syntactic features to support named modules, like, for example, in C. This is done by using existing language features, together with, for example, coding conventions, programming idioms and the physical code structure. IBM i also uses modules when programming in the Integrated Language Environment (ILE).

Key aspects

With modular programming, concerns are separated such that modules perform logically discrete functions, interacting through well-defined interfaces. Often modules form a directed acyclic graph (DAG); in this case a cyclic dependency between modules is seen as indicating that these should be a single module. In the case where modules do form a DAG they can be arranged as a hierarchy, where the lowest-level modules are independent, depending on no other modules, and higher-level modules depend on lower-level ones. A particular program or library is a top-level module of its own hierarchy, but can in turn be seen as a lower-level module of a higher-level program, library, or system.

When creating a modular system, instead of creating a monolithic application (where the smallest component is the whole), several smaller modules are written separately so when they are composed together, they construct the executable application program. Typically, these are also compiled separately, via separate compilation, and then linked by a linker. A just-in-time compiler may perform some of this construction "on-the-fly" at run time.

These independent functions are commonly classified as either program control functions or specific task functions. Program control functions are designed to work for one program. Specific task functions are closely prepared to be applicable for various programs.

This makes modular designed systems, if built correctly, far more reusable than a traditional monolithic design, since all (or many) of these modules may then be reused (without change) in other projects. This also facilitates the "breaking down" of projects into several smaller projects. Theoretically, a modularized software project will be more easily assembled by large teams, since no team members are creating the whole system, or even need to know about the system as a whole. They can focus just on the assigned smaller task.

See also

Notes

  1. ^ The term "package" is used for the analog of modules in the JLS;[3] — see Java package. "Modules", a kind of collection of packages, are planned for Java 9 as part of Project Jigsaw; these were earlier called "superpackages" and planned for Java 7.

References

  1. ^ Lindsey, Charles H. (Feb 1976). "Proposal for a Modules Facility in ALGOL 68" (PDF). ALGOL Bulletin (39): 20–29. Archived from the original (PDF) on 2016-03-03. Retrieved 2014-12-01.
  2. ^ David MacQueen (August 1984). "Modules for Standard ML, LFP '84 Proceedings of the 1984 ACM Symposium on LISP and functional programming": 198–207. {{cite journal}}: Cite journal requires |journal= (help)
  3. ^ James Gosling, Bill Joy, Guy Steele, Gilad Bracha, The Java Language Specification, Third Edition, ISBN 0-321-24678-0, 2005. In the Introduction, it is stated "Chapter 7 describes the structure of a program, which is organized into packages similar to the modules of Modula." The word "module" has no special meaning in Java.
  4. ^ "Class: Module (Ruby 2.0.0)".
  5. ^ ECMAScript® 2015 Language Specification, 15.2 Modules
  6. ^ "N4720: Working Draft, Extensions to C++ for Modules" (PDF).

External links

Read other articles:

Artikel ini membutuhkan rujukan tambahan agar kualitasnya dapat dipastikan. Mohon bantu kami mengembangkan artikel ini dengan cara menambahkan rujukan ke sumber tepercaya. Pernyataan tak bersumber bisa saja dipertentangkan dan dihapus.Cari sumber: KRL Commuter Line – berita · surat kabar · buku · cendekiawan · JSTOR (Maret 2018) Penyuntingan Artikel oleh pengguna baru atau anonim untuk saat ini tidak diizinkan.Lihat kebijakan pelindungan dan log pelindung…

Badan Meteorologi, Klimatologi, dan Geofisika BMKGGambaran umumDasar hukumUU Nomor 31 Tahun 2009Bidang tugasMeteorologi, klimatologi, kualitas udara dan geofisikaSloganCepat, Tepat, Akurat, Luas dan Mudah dipahamiPegawai4833 Pegawai PNS (Oktober 2021)[1]KepalaProf. Ir. Dwikorita Karnawati, M.Sc, Ph.DSekretaris UtamaIr. Dwi Budi Sutrisno, M.ScDeputiDeputi Bidang Meteorologi BMKGGuswanto, M.SiDeputi Bidang Klimatologi BMKGDr. Ir. Dodo Gunawan, DEADeputi Bidang Geofisika BMKGDr. Suko P…

Gempa bumi Armenia 1988Gereja rusak di Gyumri setelah gempaSpitakLeninakanKirovakanYerevanWaktu UTC1988-12-07 07:41:27ISC417441USGS-ANSSComCatTanggal setempat7 Desember 1988 (1988-12-07)Waktu setempat11:41:27 AMTLama<20 detik[1]Kekuatan6.8 MwKedalaman5,4 km (3,4 mi)Episentrum40°59′13″N 44°11′06″E / 40.987°N 44.185°E / 40.987; 44.185 Nalband, RSS Armenia, Uni Soviet (sekarang Shirakamut, Provinsi Lori, Armenia)[2]…

Kanvas. Kanvas adalah media lukis yang memiliki pori-pori yang telah ditutup cat dasar berwarna putih. Media ini lebih sering digunakan untuk melukis dengan cat minyak karena cat minyak butuh ketebalan dalam pewarnaan dan kadang butuh metode palet yang membutuhkan terknik kontruksi pada bidang lukisnya. Palet pada umumnya sudah memiliki kerangka yang berbentuk persegi dan ada pula yang masih berbentuk gulungan tanpa kerangka. Referensi Mayer Ralph: The Artist's Handbook of Materials and Techniqu…

Artikel ini tidak memiliki referensi atau sumber tepercaya sehingga isinya tidak bisa dipastikan. Tolong bantu perbaiki artikel ini dengan menambahkan referensi yang layak. Tulisan tanpa sumber dapat dipertanyakan dan dihapus sewaktu-waktu.Cari sumber: Perguruan Cikini – berita · surat kabar · buku · cendekiawan · JSTOR Perguruan CikiniYayasan Perguruan CikiniTanggal pendirian1 Agustus 1942; 81 tahun lalu (1942-08-01) (sebagai Sekolah Rakyat Partikel…

Come leggere il tassoboxGhepardo Ghepardo al Masai Mara, Kenya Stato di conservazione Vulnerabile[1] Classificazione scientifica Dominio Eukaryota Regno Animalia Phylum Chordata Classe Mammalia Ordine Carnivora Sottordine Feliformia Famiglia Felidae Sottofamiglia Felinae Genere Acinonyx Specie A. jubatus[2] Nomenclatura binomiale Acinonyx jubatus(Schreber, 1775) Sottospecie *Vedi testo Distribuzione geografica del ghepardo a partire dal 2015 Il ghepardo (Acinonyx jubatus [Schrebe…

Pour les articles homonymes, voir Lawrence. Cet article est une ébauche concernant une localité du Kansas. Vous pouvez partager vos connaissances en l’améliorant (comment ?) selon les recommandations des projets correspondants. LawrenceL’hôtel de ville et le Shunganunga BoulderGéographiePays  États-UnisÉtat KansasComté comté de Douglas (siège)Superficie 90,45 km2 (2016)Surface en eau 2,04 %Altitude 264 mCoordonnées 38° 58′ 18″ N, 95° 14…

American politician (1767–1841) This article is about U.S. senator. For the singer-songwriter, see James Lanman (musician). James LanmanPortrait of Lanman by Chester Harding(courtesy Yale University Art Gallery)United States Senatorfrom ConnecticutIn officeMarch 4, 1819 – March 3, 1825Preceded byDavid DaggettSucceeded byCalvin Willey Personal detailsBorn(1767-06-14)June 14, 1767Norwich, ConnecticutDiedAugust 7, 1841(1841-08-07) (aged 74)Norwich, ConnecticutPolitical partyDemocr…

Ernst August Christian Georg (17 November 1887 – 30 Januari 1953) adalah Adipati Brunswick dari 2 November 1913 sampai 8 November 1918. Dia adalah cucu laki-laki dari George V dari Hannover dan Christian IX dari Denmark. Kerajaan Prussia telah menggulingkan Raja George dari takhta Hannover pada tahun 1866.[1] Ernest AugustusAdipati BrunswickBerkuasa1 November 1913 – 8 November 1918PendahuluWilliam VIIIPenerusKerajaan dihapuskanKepala Wangsa HannoverBerkuasa14 November 1923 – 30 Jan…

Communauté de communes des monts de Châlus Administration Pays France Région Nouvelle-Aquitaine Département Haute-Vienne Siège Châlus Communes 7 Date de création 21 décembre 2001 Date de disparition 1er janvier 2017 Code SIREN 248700148 Démographie Population 6 028 hab. (2013) Densité 30 hab./km2 Géographie Superficie 199,12 km2 Liens Site web montsdechalus.fr Fiche Banatic Données en ligne modifier  Créée en 2001, La communauté de communes des monts de Ch…

American mathematician Jacob LurieLurie in 2005Born (1977-12-07) December 7, 1977 (age 46)Washington, D.C., U.S.Alma materHarvard University (BA)Massachusetts Institute of Technology (PhD)AwardsMorgan Prize (2000)Breakthrough Prize in Mathematics (2014)MacArthur Fellowship (2014)Scientific careerFieldsAlgebraic geometryInstitutionsMassachusetts Institute of TechnologyHarvard UniversityInstitute for Advanced StudyThesisDerived algebraic geometry (2004)Doctoral advisorMichael J. Hop…

Halaman ini berisi artikel tentang senyawa kimia. Untuk sungai di Prancis, lihat Sungai Furan. Furan Nama Nama IUPAC Furan Nama lain Oksola, furfuran, divinil oksida Penanda Nomor CAS 110-00-9 Model 3D (JSmol) Gambar interaktif 3DMet {{{3DMet}}} Nomor EC Nomor RTECS {{{value}}} CompTox Dashboard (EPA) DTXSID6020646 SMILES C1=CC=CO1 Sifat Rumus kimia C4H4O Massa molar 68,7 g/mol Penampilan takberawarna, cairan mudah menguap Densitas 0,936 g/mL Titik lebur -85,6 °C &#…

International feed of Argentine TV network Telefe Television channel Telefe InternacionalCountryArgentinaBroadcast areaAsia, Americas, Europe, Canada, Oceania, IsraelNetworkTelefeHeadquartersBuenos Aires, ArgentinaProgrammingLanguage(s)SpanishPicture format1080i HDTV(downscaled to 576i/480i for the SD feed)OwnershipOwnerParamount Networks Americas(Paramount Global)Sister channelsTelefeHistoryLaunched1998LinksWebsitehttp://www.telefe.com/AvailabilityStreaming mediaSling TVInternet Protocol televi…

Région de recensement de BethelBethel Census Area La chapelle St. Sergius (en) à Chuathbaluk. Administration Pays États-Unis État Alaska Chef-lieu Aucun Démographie Population 17 013 hab. (2010) Densité 0,16 hab./km2 Géographie Coordonnées 60° 45′ nord, 160° 30′ ouest Superficie 10 524 000 ha = 105 240 km2 Superficie eau 1 262 600 ha = 12 626 km2 Superficie totale 11 7…

U.S. Bureau of Land Management map showing the principal meridians in Utah The Uintah meridian, also called the Uintah Special Meridian (USM) has a center point north of Roosevelt, Utah. The Uintah meridian was established in 1875, and governs land surveys in the Uintah and Ouray Indian Reservation in the state of Utah. References This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenge…

Lisa HaydonLahirElisabeth Marie Haydon17 Juni 1986 (umur 37)Chennai, Tamil Nadu, India[1]KebangsaanIndiaNama lainLisaPekerjaanModel, aktris, desainerTahun aktif2010–sekarangSuami/istriDino Lalvani (m. 2016)Anak1 putra Elisabeth Marie Lisa Haydon (lahir 17 Juni 1986) adalah seorang model, desainer mode, dan pemeran asal India, yang biasanya tampil dalam perfilman Hindi. Haydon membuat debut aktingnya dengan sebuah peran pendukung dalam film komedi romansa tahun 2010 Aisha…

Geitner beralih ke halaman ini. Untuk marga, lihat Geitner (marga). Timothy Geithner Menteri Keuangan Amerika Serikat ke-75Masa jabatan26 Januari 2009 – 25 Januari 2013PresidenBarack ObamaWakilNeal S. WolinPendahuluHenry PaulsonPenggantiJack LewPresiden Federal Reserve Bank of New York ke-9Masa jabatan17 November 2003 – 26 Januari 2009PendahuluWilliam Joseph McDonoughPenggantiWilliam C. DudleyWakil Menteri Keuangan Amerika Serikat Bidang Hubungan InternasionalMasa jabatan19…

National Youth Rights AssociationHeadquartersTakoma Park, Maryland, U.S.PresidentMargin ZhengVice PresidentAshawn Dabney-SmallWebsitewww.youthrights.org Youth rights Activities Bailey v. Drexel Furniture Co. Child Labor Deterrence Act Children's Online Privacy Protection Act Kids Online Safety Act Convention on the Rights of the Child Fair Labor Standards Act Hammer v. Dagenhart History of youth rights in the United States Morse v. Frederick Newsboys' strike of 1899 Prez Quebec Charter of Human …

Шалфей обыкновенный Научная классификация Домен:ЭукариотыЦарство:РастенияКлада:Цветковые растенияКлада:ЭвдикотыКлада:СуперастеридыКлада:АстеридыКлада:ЛамиидыПорядок:ЯсноткоцветныеСемейство:ЯснотковыеРод:ШалфейВид:Шалфей обыкновенный Международное научное назва…

Stadium in Chester-le-Street, England Pelaw Grange StadiumThe stadium circa.1980LocationDrum Road, Chester-le-Street DH3 2AFCoordinates54°52′37.6″N 1°34′43.3″W / 54.877111°N 1.578694°W / 54.877111; -1.578694Opened1944*TenantsGreyhound racingWebsiteOfficial website Pelaw Grange Stadium is a Greyhound Board of Great Britain regulated greyhound racing track located at North Lodge in the English county of Durham, between Chester-le-Street and Gateshead.[1]…

Kembali kehalaman sebelumnya