{"id":3032,"date":"2024-01-26T16:00:46","date_gmt":"2024-01-26T15:00:46","guid":{"rendered":"https:\/\/oopm.org\/?page_id=3032"},"modified":"2025-01-27T10:40:43","modified_gmt":"2025-01-27T09:40:43","slug":"48-modules","status":"publish","type":"page","link":"https:\/\/oopm.org\/?page_id=3032","title":{"rendered":"19. Modules"},"content":{"rendered":"<div class=\"pdfprnt-buttons pdfprnt-buttons-page pdfprnt-top-right\"><a href=\"https:\/\/oopm.org\/index.php?rest_route=wpv2pages3032&print=pdf\" class=\"pdfprnt-button pdfprnt-button-pdf\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/oopm.org\/wp-content\/plugins\/pdf-print\/images\/pdf.png\" alt=\"image_pdf\" title=\"View PDF\" \/><\/a><a href=\"https:\/\/oopm.org\/index.php?rest_route=wpv2pages3032&print=print\" class=\"pdfprnt-button pdfprnt-button-print\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/oopm.org\/wp-content\/plugins\/pdf-print\/images\/print.png\" alt=\"image_print\" title=\"Print Content\" \/><\/a><\/div>\n<p class=\"wp-block-paragraph\">In previous chapters, we have introduced language mechanisms for describing objects and classes of a qBeta program execution. In this chapter, language mechanisms for describing the organization of programs will be introduced. A non-trivial program will usually be large, so it is desirable to be able to split such a description into smaller, more manageable units. Such units are in general called&nbsp;<em>modules<\/em>. A module is a convenient part of a program typically kept in a file (or in a database), manipulated by an editor, and translated by a compiler.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Modularization is of the utmost importance when writing programs that are more than small examples. Since the examples must be fairly small in a book like this, it is difficult to adequately illustrate and motivate modularization. We are thus using very small examples to illustrate the principles. The modularization techniques described below are absolutely necessary for large programs and highly recommended even for moderately sized programs. The reasons for this may be summarized as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Most reasonably sized programs can be conveniently split into modules of logically related elements, since it is cumbersome to handle large programs. Large programs are easier to understand if split into a number of smaller units.<\/li>\n\n\n\n<li>When editing it is easier to manage a number of small modules instead of one large program.<\/li>\n\n\n\n<li>When several people are working on a project, each person can work on his\/her own set of modules.<\/li>\n\n\n\n<li>Modules can be saved in a library and shared by several programs. Good modularization mechanisms will thus improve&nbsp;reusability&nbsp;of code as well as of designs.<\/li>\n\n\n\n<li>A module must have a well-defined interface as discussed in <script>mkRef(\"Representative and non-representative parts\");<\/script>. As discussed in <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-foreground-color\"> <script>mkRefTxt(\"Representative and non-representative parts\",\"this chapter\");<\/script> <\/mark>, this makes it possible to prevent users of a module from seeing details about data representation and implementation of algorithms.<\/li>\n\n\n\n<li>Certain modules may exist in several&nbsp;variants. One example of this is different implementations of the same (interface) module. Another example is variants of a module corresponding to different computers. If a module has several variants it is important that the common part of two or more variants exists in only one copy. It should only be necessary to separate out the code that differs between variants, otherwise maintenance becomes complicated, since the same change may have to be made for several variants. In this version of the book, we do not discuss language mechanisms for supporting variants.<\/li>\n\n\n\n<li>A module may be used as a unit to be\u00a0separately compiled. When developing a program, it is in most cases a good idea to be able to try out even small changes in the program including if a given change may compile and works as expected. For this to work, the compiler must be fast enough to avoid breaks when waiting for the compiler. For small programs this is usually not a problem, but for very large programs, the compilation time may be long. When changing parts of a large program, it is not acceptable to be forced to recompile the whole program, since this may take several hours. For this reason, some language implementations make it possible to separately compile modules such that they do not have to be recompiled for changes not affecting these modules. With separate compilation of modules, only the modules that have been changed and those that are affected by these changes have to be recompiled. Below we explain how one module may be affected by changes in another. Separate compilation is not supported by the current implementation of qBeta, but compilation time should not be a problem for the program examples used in this book.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">In qBeta, a&nbsp;<em>module<\/em>&nbsp;is a description of a singular object. A singular object generated from a module is called a&nbsp;<em>module object<\/em>. Modules are organized in a hierarchy of nested intrinsic module objects that follow the general mechanism of nesting and intrinsic<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-color-3-color\"> <\/mark>objects in qBeta. A module may also be considered to be a program &#8211; we return to this below.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As an example, all collection classes are defined within a module called <code>Collections<\/code> and each kind\/type of collection is defined as a nested module in <code>Collections<\/code>: <\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-7387b849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<pre class=\"wp-block-code\"><code>Collections: <strong>obj<\/strong>\n   SetLib: <strong>obj<\/strong>\n      <strong>class<\/strong> Set:\n         ...\n   ListLib: <strong>obj<\/strong>\n      <strong>class<\/strong> List:\n         ... <\/code><\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full is-resized\"><img fetchpriority=\"high\" decoding=\"async\" width=\"400\" height=\"245\" src=\"https:\/\/oopm.org\/wp-content\/uploads\/2024\/10\/Modules-1-4.jpg\" alt=\"\" class=\"wp-image-8433\" style=\"width:318px;height:auto\" srcset=\"https:\/\/oopm.org\/wp-content\/uploads\/2024\/10\/Modules-1-4.jpg 400w, https:\/\/oopm.org\/wp-content\/uploads\/2024\/10\/Modules-1-4-300x184.jpg 300w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">As mentioned,  the module hierarchy of qBeta is basically a (large) nested structure of&nbsp;modules. The top-level module is called <code>qBetaWorld<\/code>. There are a number of modules nested within <code>qBetaWorld<\/code>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The module <code>qBeta<\/code>&nbsp;contains all basic declarations of qBeta.<\/li>\n\n\n\n<li>The&nbsp;<code>LIB<\/code>&nbsp;module contains all standard library modules for <code>qBeta<\/code> including <code>Collections<\/code>.<\/li>\n\n\n\n<li>The <code>MonitorSystem<\/code> from section <script>mkRef(\"Implementing a Monitor System\");<\/script> is another example of a module.<\/li>\n\n\n\n<li>The <code>Workspace<\/code> module is a a place for a user of qBeta to place his\/her example modules. One example may a module containing the <code>Bank<\/code> example used in previous sections. <\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The following example shows part of the <code>qBetaWorld<\/code> modules:  <\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-7387b849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:50%\">\n<pre class=\"wp-block-code\"><code>qBetaWorld: <strong>obj<\/strong>\n   qBeta: <strong>obj<\/strong>\n      ...\n   LIB: <strong>obj<\/strong>\n      Collections: <strong>obj<\/strong>\n         ...\n      MonitorSystemLib: <strong>obj<\/strong>\n            ...\n   Workspace: <strong>obj<\/strong>\n      Bank: <strong>obj<\/strong>\n         <strong>class<\/strong> Account:\n            -\"-\n         <strong>class<\/strong> Customer:            \n            -\"-\n         -\"-<\/code><\/pre>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:70%\">\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" width=\"553\" height=\"295\" src=\"https:\/\/oopm.org\/wp-content\/uploads\/2024\/10\/Module-2.a-3.jpg\" alt=\"\" class=\"wp-image-8430\" style=\"width:501px;height:auto\" srcset=\"https:\/\/oopm.org\/wp-content\/uploads\/2024\/10\/Module-2.a-3.jpg 553w, https:\/\/oopm.org\/wp-content\/uploads\/2024\/10\/Module-2.a-3-300x160.jpg 300w\" sizes=\"(max-width: 553px) 100vw, 553px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\">The module hierarchy is mapped to a corresponding folder hierarchy and each folder has a source file containing the corresponding qBeta code.<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-foreground-color\"> <\/mark>There will thus be a folder name <code>qBetaWorld<\/code>, which contains folders, <code>qBeta<\/code>, <code>LIB<\/code> and <code>Workspace<\/code>. The folder <code>LIB<\/code> contains folders <code>Collections<\/code>, and <code>MonitorSystemLib<\/code>, etc. The folder <code>SetLib<\/code> has a file <code>SetLib<\/code> that contains the code for class <code>Set<\/code>, etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Note that in the diagram above we have showed the module hierarchy both as a composition diagram, with objects containing intrinsic<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-color-3-color\"> <\/mark>objects, and a nesting hierarchy since the modules are descriptions of singular part objects that are nested in each other. The grey rhomb illustrates composition and the circle illustrates nesting &#8211; see also <script>mkRef(\"Notation\")<\/script>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The advantage of organizing modules in a nested hierarchy of singular object descriptors is that visibility of modules and their attributes follows the ordinary scope rules of qBeta. The module <code>Bank<\/code> may e.g. access attributes in the <code>Collections<\/code> module. The <code>Bank<\/code> object has a data-item <code>theAccountFile<\/code>, which is of type <code>Set(Account)<\/code> where <code>Set<\/code> is defined in <code>Collections<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Since modules are just nested object descriptors, all modules are visible from any module at any place in the hierarchy, but constrained by access modifiers like&nbsp;<code>%public<\/code>,&nbsp;<code>%private<\/code>, <code>%protected<\/code>, and<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-foreground-color\">&nbsp;<\/mark><code>%<code>package<\/code><\/code>.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As mentioned, the <code>Bank<\/code> may be organised as a module. As shown in chapter <script>mkRef(\"Collections\");<\/script>, the <code>Bank<\/code> uses class <code>Set<\/code> to contain the accounts of the <code>Bank<\/code>. In the next example, we show how class <code>Set<\/code> may be accessed by means of an attribute accessor for objects.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Bank: <strong>obj<\/strong>\n   <strong>class<\/strong> Account:\n      -\"-\n   -\"-\n   theAccountsFile: <strong>obj<\/strong> LIB.Collection.SetLib.Set(Account)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">As can be seen, the declaration of <code>theAccountsFile<\/code> makes use of a full path <code>LIB.Collections.SetLib.Set<\/code> to class <code>Set<\/code>. If one finds this to be too verbose, it is possible to make all public declarations in a given module visible using the <code>%visible<\/code> property:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Bank: <strong>obj<\/strong>\n   %visible LIB.Collections.SetLib\n   <strong>class<\/strong> Account:\n      -\"-\n   -\"-\n   theAccountsFile: <strong>obj<\/strong> Set(Account)<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Organizing Bank as a general module<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">At some point the code for <code>Bank<\/code> may have reached a stage where you will make it available for other programmers as a library. You then have to place it in a module other than <code>Workspace<\/code>. For this example, we place it in a module called <code>BankLib<\/code>. <\/p>\n\n\n\n<style>\n#XXX {\n  width: 30%;\n  padding-left: 15px;\n  margin-left: 15px;\n  float: right;\n  background-color: lightgray;\n  font-size: 0.875em; \/* 14px\/16=0.875em *\/\n}\n<\/style>\n<p id=\"XXX\">The convention for using reverse Internet domain names was original proposed for package names in Java. Modules as presented here has some resemblance of packages &#8211; se XXX<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next we have to decide where to place <code>BankLib<\/code> in the module hierarchy. Other programmers may use the name <code>BankLib<\/code> for other purposes in which case there may be name conflicts. To avoid name conflicts it is in general recommended to place a module in a module that has a name that is the name of the reversed Internet domain of the organization that has developed the code. If we assume that <code>BankLib<\/code> is developed by a Danish company called <code>FinSys<\/code> (Financial Systems Ltd.), then we place <code>BankLib<\/code> in the module <code>DK.FinSys<\/code>&#8211; assuming that the Internet domain of the company is <code>FinSys.DK<\/code>. <code>BankLib<\/code> may thus be referred to as <code>DK.FinSys.BankLib<\/code>:<\/p>\n\n\n\n<div class=\"wp-block-media-text is-stacked-on-mobile\" style=\"grid-template-columns:45% auto\"><figure class=\"wp-block-media-text__media\"><img decoding=\"async\" width=\"586\" height=\"396\" src=\"https:\/\/oopm.org\/wp-content\/uploads\/2024\/10\/Module-3.jpg\" alt=\"\" class=\"wp-image-8394 size-full\" srcset=\"https:\/\/oopm.org\/wp-content\/uploads\/2024\/10\/Module-3.jpg 586w, https:\/\/oopm.org\/wp-content\/uploads\/2024\/10\/Module-3-300x203.jpg 300w\" sizes=\"(max-width: 586px) 100vw, 586px\" \/><\/figure><div class=\"wp-block-media-text__content\">\n<pre class=\"wp-block-code\"><code>BankLib: <strong>obj<\/strong>\n  <strong>class<\/strong> Bank:\n      theAccountsFile: <strong>obj<\/strong> Set(Account)\n      ...\n  <strong>class<\/strong> Account(owner: <strong>ref<\/strong> Customer): \n      -\"-\n  <strong>class<\/strong> Customer:\n         -\"-<\/code><\/pre>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">As can be seen, we have placed class <code>Account<\/code> and class <code>Customer<\/code> in the <code>BankLib<\/code> module. In addition, we have defined <code>Bank<\/code> as a class and not as an object as in the example above. The reason is that different programmers should be able to create their own <code>Bank<\/code> objects. In addition the classes <code>Account<\/code> and <code>Customer<\/code> are not defined within <code>Bank<\/code>, but in <code>BankLib<\/code>, and they are used in <code>Bank<\/code>, e.g. <code>Account<\/code> in in the declaration of the <code>theAccountsfile<\/code>, and <code>Customer<\/code> in the definition of class <code>Account<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We only show the program text for (part of) <code>BankLib<\/code>. But even if modules like <code>BankLib<\/code> are placed in separate folders and files, it exists in the context for the whole of <code>qBetaLib<\/code> and the semantics is as if the whole library is one (large) text as shown in the first examples above.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A user may then create his own bank using the <code>BankLib<\/code> module and start by placing it in <code>Workspace<\/code>:<\/p>\n\n\n\n<div class=\"wp-block-media-text has-media-on-the-right is-stacked-on-mobile\" style=\"grid-template-columns:auto 43%\"><div class=\"wp-block-media-text__content\">\n<pre class=\"wp-block-code\"><code>   ToyBank: <strong>obj<\/strong> DK.FinSys.BankLib.Bank\n      aClerk: <strong>obj<\/strong>\n          handle:\n             -\"-\n      aClerk.handle<\/code><\/pre>\n<\/div><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"508\" height=\"352\" src=\"https:\/\/oopm.org\/wp-content\/uploads\/2024\/10\/Module-4-3.jpg\" alt=\"\" class=\"wp-image-8393 size-full\" srcset=\"https:\/\/oopm.org\/wp-content\/uploads\/2024\/10\/Module-4-3.jpg 508w, https:\/\/oopm.org\/wp-content\/uploads\/2024\/10\/Module-4-3-300x208.jpg 300w\" sizes=\"(max-width: 508px) 100vw, 508px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Here we have just made a simple <code>ToyBank<\/code> that contains the object <code>aClerk<\/code> from section <script>mkRef(\"The second program\");<\/script> and makes use of the module <code>DK.FinSys.BankLib<\/code>. Note that <code>ToyBank<\/code> is derived from <code>DK.FinSys.BankLib.Bank<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>ToyBank<\/code> object is a module but it is also a program. In general a program is a module. In principle any module could be viewed as a program, but for a module to be considered a program it should represent a system in a given domain and\/or solves a specific problem. However, there is no clear definition of when a module should be considered a program since any module can be executed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Organizing a program as multiple modules<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A program may also be split into modules and here we show how the example of an expression grammar from section <script>mkRef(\"A simple expression grammar\");<\/script> may be organized.<\/p>\n\n\n\n<div class=\"wp-block-media-text has-media-on-the-right is-stacked-on-mobile\" style=\"grid-template-columns:auto 33%\"><div class=\"wp-block-media-text__content\">\n<p class=\"wp-block-paragraph\">The example makes use of class <code>Grammar<\/code>, which is defined in a module <code>GrammarLib<\/code>.<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-color-3-color\"> <\/mark>It has a local module <code>demo<\/code>, which has <code>ExpressionGrammar<\/code> as a local module. The expression grammar has local modules <code>expAst<\/code> and <code>ExpParser<\/code> that contain the abstract syntax tree of the grammar and the parser for the grammar. This module hierarchy is shown in the diagram.<\/p>\n<\/div><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"357\" height=\"414\" src=\"https:\/\/oopm.org\/wp-content\/uploads\/2024\/10\/ExpressionGrammar-3.jpg\" alt=\"\" class=\"wp-image-8654 size-full\" srcset=\"https:\/\/oopm.org\/wp-content\/uploads\/2024\/10\/ExpressionGrammar-3.jpg 357w, https:\/\/oopm.org\/wp-content\/uploads\/2024\/10\/ExpressionGrammar-3-259x300.jpg 259w\" sizes=\"(max-width: 357px) 100vw, 357px\" \/><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Extending BankLib<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Next we show an extension of <code>BankLib<\/code> where we add additional modules:<\/p>\n\n\n\n<div class=\"wp-block-media-text has-media-on-the-right is-stacked-on-mobile\" style=\"grid-template-columns:auto 40%\"><div class=\"wp-block-media-text__content\">\n<pre class=\"wp-block-code\"><code>BankLIB: <strong>obj<\/strong>\n   Banking: <strong>obj<\/strong>\n      <strong>class<\/strong> Bank: ...\n      ...\n   Accounting: <strong>obj<\/strong>\n      <strong>class<\/strong> Account: ...\n      <strong>class<\/strong> SavingsAccount: Account ...   \n      <strong>class<\/strong> CreditAccount: Account ...\n      ...\n   CustomerHandling: <strong>obj<\/strong>\n     <strong>class<\/strong> Customer: ...\n     <strong>class<\/strong> CorporateCustomer: Customer ...\n     ...\n   NetBanking: <strong>obj<\/strong>\n     ...\n   BankTerminals: <strong>obj<\/strong>\n     ...<\/code><\/pre>\n<\/div><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"537\" height=\"587\" src=\"https:\/\/oopm.org\/wp-content\/uploads\/2024\/12\/CompleteBankLib-2.jpg\" alt=\"\" class=\"wp-image-10863 size-full\" srcset=\"https:\/\/oopm.org\/wp-content\/uploads\/2024\/12\/CompleteBankLib-2.jpg 537w, https:\/\/oopm.org\/wp-content\/uploads\/2024\/12\/CompleteBankLib-2-274x300.jpg 274w\" sizes=\"(max-width: 537px) 100vw, 537px\" \/><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Organizing BasicSystem and MonitorSystem<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Another example of organizing modules is the organization of <code>BasicSystem<\/code> and <code>MonitorSytem<\/code>. They may both be placed as modules in <code>LIB<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>qBetaWorld: <strong>obj<\/strong>\n   qBeta: <strong>obj<\/strong>\n      ... \n   LIB: <strong>obj<\/strong>\n      BasicSystemLib: <strong>obj<\/strong>\n         -\"-\n      MonitorSystemLib: <strong>obj<\/strong>\n         <strong>class<\/strong> MonitorProcess:\n            -\"-\n         <strong>class<\/strong> Monitor:\n           -\"-\n      ...\n   -\"-\n  <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-color-3-color\"> <\/mark>Workspace: <strong>obj<\/strong>\n      aSafeSearcher: <strong>obj<\/strong> LIB.MonitorSystemLib.MonitorSystem\n         searcherA: Searcher -\"-\n         -\"-\n         collector: <strong>obj<\/strong> Monitor -\"-\n         presenter: <strong>obj<\/strong> MonitorProcess -\"-\n         searcherA.start\n         -\"-<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">As an example, we have placed <code>aSafeSearcher<\/code> as a module\/program in <code>workspace<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example of using the package access modifiers<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In the next example we show how to use the package acces modifiers for controlling visibility of attributes within the <code>BankSys<\/code> package.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>BankLIB: <strong>obj<\/strong>\n   %package_boundary<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-color-3-color\">  <\/mark><\/code>   banking: <strong>obj<\/strong><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-custom-color-3-color\">     <\/mark> <strong>class<\/strong> Bank:\n         -\"-     \n         %package <code>         theAccountsFile: <strong>obj<\/strong> Set(Account)<\/code>   accounting: <strong>obj<\/strong><\/code>      <strong>class<\/strong> Account: \n          -\"-\n          %package\n          balance,interestRate: <strong>var<\/strong> float\n      <strong>class<\/strong> SavingsAccount: Account ...   \n      <strong>class<\/strong> CreditAccount: Account ...<code>      ...\n   customers\/customerHandling:&nbsp;<strong>obj<\/strong><\/code>      <strong>class<\/strong> Customer: ...\n     <strong> class<\/strong> CorporateCustomer: Customer ...<code>      ...<\/code>   NetBanking: <strong>obj<\/strong>\n      ...\n   BankTerminals: <strong>obj<\/strong>\n      ...<code> <\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The access modifier <code>%package_boundary<\/code> defines <code>BankLib<\/code> as the top module of the package.<\/li>\n\n\n\n<li>The <code>%package<\/code> modifier specifies that the data-items <code>balance<\/code> and <code>interestRate<\/code> of <code>Account<\/code> objects are visible in the whole <code>BankLib<\/code> package. Please be aware that thesis just an example &#8211; in a real banking system it may not be a good idea to make such attributes visible to the whole package.<\/li>\n\n\n\n<li>A <code>%package<\/code> modifier is also used to specify that <code>theAccountsFile<\/code> is visible in the whole package.<\/li>\n<\/ul>\n<div style=\"display:flex; gap:10px;justify-content:center\" class=\"wps-pgfw-pdf-generate-icon__wrapper-frontend\">\n\t\t<a  href=\"https:\/\/oopm.org?action=genpdf&amp;id=3032\" class=\"pgfw-single-pdf-download-button\" ><img src=\"https:\/\/oopm.org\/wp-content\/plugins\/pdf-generator-for-wp\/admin\/src\/images\/PDF_Tray.svg\" title=\"Generate PDF\" style=\"width:auto; height:45px;\"><\/a>\n\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>In previous chapters, we have introduced language mechanisms for describing objects and classes of a qBeta program execution. In this chapter, language mechanisms for describing the organization of programs will be introduced. A non-trivial program will usually be large, so it is desirable to be able to split such a description into smaller, more manageable [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":21,"menu_order":19,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-3032","page","type-page","status-publish","hentry"],"mb":[],"mfb_rest_fields":["title","gutenberg_elementor_mode"],"_links":{"self":[{"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/pages\/3032","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oopm.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3032"}],"version-history":[{"count":186,"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/pages\/3032\/revisions"}],"predecessor-version":[{"id":11320,"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/pages\/3032\/revisions\/11320"}],"up":[{"embeddable":true,"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/pages\/21"}],"wp:attachment":[{"href":"https:\/\/oopm.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3032"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}