This commit is contained in:
TheDoubleH 2022-02-11 17:30:04 +00:00
parent de09820554
commit e4f08bf9a7
187 changed files with 6620 additions and 6342 deletions

View file

@ -5,16 +5,16 @@
<meta name=generator content="Hugo 0.92.1">
<meta name=description content>
<title>By Reference Parameters :: AL Guidelines</title>
<link href=/css/nucleus.css?1644506469 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644506469 rel=stylesheet>
<link href=/css/featherlight.min.css?1644506469 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644506469 rel=stylesheet>
<link href=/css/auto-complete.css?1644506469 rel=stylesheet>
<link href=/css/theme.css?1644506469 rel=stylesheet>
<link href=/css/theme-blue.css?1644506469 rel=stylesheet>
<link href=/css/variant.css?1644506469 rel=stylesheet>
<link href=/css/print.css?1644506469 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644506469></script>
<link href=/css/nucleus.css?1644600600 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644600600 rel=stylesheet>
<link href=/css/featherlight.min.css?1644600600 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644600600 rel=stylesheet>
<link href=/css/auto-complete.css?1644600600 rel=stylesheet>
<link href=/css/theme.css?1644600600 rel=stylesheet>
<link href=/css/theme-blue.css?1644600600 rel=stylesheet>
<link href=/css/variant.css?1644600600 rel=stylesheet>
<link href=/css/print.css?1644600600 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644600600></script>
<style>:root #header+#content>#left>#rlblock_left{display:none!important}</style>
</head>
<body data-url=/navpatterns/3-cal-coding-guidelines/design/by-reference-parameters/>
@ -32,9 +32,9 @@ ALGuidelines.Dev
<input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span>
</div>
<script src=/js/lunr.min.js?1644506469></script>
<script src=/js/auto-complete.js?1644506469></script>
<script src=/js/search.js?1644506469></script>
<script src=/js/lunr.min.js?1644600600></script>
<script src=/js/auto-complete.js?1644600600></script>
<script src=/js/search.js?1644600600></script>
</div>
<div class=highlightable>
<ul class=topics>
@ -258,19 +258,19 @@ ALGuidelines.Dev
<p>Do not declare parameters by reference if their values are not intended to be changed.</p>
<p>Unintentional value changes might propagate. Also, it might lead people to believe that value changes are intended.</p>
<p>Bad code</p>
<pre><code>LOCAL PROCEDURE ShowMessage@15(VAR Text@1000 : Text\[250\]);
<pre><code>LOCAL PROCEDURE ShowMessage@15(VAR Text@1000 : Text[250]);
BEGIN
Text := GetMessageText;
IF (Text &lt;\&gt; '') AND GenJnlLineInserted THEN
MESSAGE(Text);
Text := GetMessageText;
IF (Text &lt;&gt; '') AND GenJnlLineInserted THEN
MESSAGE(Text);
END;
</code></pre>
<p>Good code</p>
<pre><code>LOCAL PROCEDURE ShowMessage@15(Text@1000 : Text\[250\]);
<pre><code>LOCAL PROCEDURE ShowMessage@15(Text@1000 : Text[250]);
BEGIN
Text := GetMessageText;
IF (Text &lt;\&gt; '') AND GenJnlLineInserted THEN
MESSAGE(Text);
Text := GetMessageText;
IF (Text &lt;&gt; '') AND GenJnlLineInserted THEN
MESSAGE(Text);
END;
</code></pre>
<footer class=footline>
@ -285,12 +285,12 @@ END;
<div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px>
<div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div>
</div>
<script src=/js/clipboard.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644506469></script>
<script src=/js/jquery.svg.pan.zoom.js?1644506469></script>
<script src=/js/featherlight.min.js?1644506469></script>
<script src=/js/modernizr.custom-3.6.0.js?1644506469></script>
<script src=/js/relearn.js?1644506469></script>
<script src=/js/clipboard.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644600600></script>
<script src=/js/jquery.svg.pan.zoom.js?1644600600></script>
<script src=/js/featherlight.min.js?1644600600></script>
<script src=/js/modernizr.custom-3.6.0.js?1644600600></script>
<script src=/js/relearn.js?1644600600></script>
</body>
</html>

View file

@ -5,16 +5,16 @@
<meta name=generator content="Hugo 0.92.1">
<meta name=description content>
<title>Class Coupling :: AL Guidelines</title>
<link href=/css/nucleus.css?1644506469 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644506469 rel=stylesheet>
<link href=/css/featherlight.min.css?1644506469 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644506469 rel=stylesheet>
<link href=/css/auto-complete.css?1644506469 rel=stylesheet>
<link href=/css/theme.css?1644506469 rel=stylesheet>
<link href=/css/theme-blue.css?1644506469 rel=stylesheet>
<link href=/css/variant.css?1644506469 rel=stylesheet>
<link href=/css/print.css?1644506469 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644506469></script>
<link href=/css/nucleus.css?1644600600 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644600600 rel=stylesheet>
<link href=/css/featherlight.min.css?1644600600 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644600600 rel=stylesheet>
<link href=/css/auto-complete.css?1644600600 rel=stylesheet>
<link href=/css/theme.css?1644600600 rel=stylesheet>
<link href=/css/theme-blue.css?1644600600 rel=stylesheet>
<link href=/css/variant.css?1644600600 rel=stylesheet>
<link href=/css/print.css?1644600600 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644600600></script>
<style>:root #header+#content>#left>#rlblock_left{display:none!important}</style>
</head>
<body data-url=/navpatterns/3-cal-coding-guidelines/design/class-coupling/>
@ -32,9 +32,9 @@ ALGuidelines.Dev
<input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span>
</div>
<script src=/js/lunr.min.js?1644506469></script>
<script src=/js/auto-complete.js?1644506469></script>
<script src=/js/search.js?1644506469></script>
<script src=/js/lunr.min.js?1644600600></script>
<script src=/js/auto-complete.js?1644600600></script>
<script src=/js/search.js?1644600600></script>
</div>
<div class=highlightable>
<ul class=topics>
@ -257,7 +257,7 @@ ALGuidelines.Dev
<h1>Class Coupling</h1>
<p>Do not write functions that have high class coupling. This makes the code hard to maintain.</p>
<p>Bad code</p>
<pre><code>Any procedure / trigger that has class coupling of \&gt; 30
<pre><code>Any procedure / trigger that has class coupling of &gt; 30
</code></pre>
<p>Good code</p>
<pre><code>Any procedure / trigger that has class coupling of &lt;= 30\.
@ -277,12 +277,12 @@ Class coupling is computed by summing the unique instances of the following in a
<div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px>
<div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div>
</div>
<script src=/js/clipboard.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644506469></script>
<script src=/js/jquery.svg.pan.zoom.js?1644506469></script>
<script src=/js/featherlight.min.js?1644506469></script>
<script src=/js/modernizr.custom-3.6.0.js?1644506469></script>
<script src=/js/relearn.js?1644506469></script>
<script src=/js/clipboard.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644600600></script>
<script src=/js/jquery.svg.pan.zoom.js?1644600600></script>
<script src=/js/featherlight.min.js?1644600600></script>
<script src=/js/modernizr.custom-3.6.0.js?1644600600></script>
<script src=/js/relearn.js?1644600600></script>
</body>
</html>

View file

@ -5,16 +5,16 @@
<meta name=generator content="Hugo 0.92.1">
<meta name=description content>
<title>Cyclomatic Complexity :: AL Guidelines</title>
<link href=/css/nucleus.css?1644506469 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644506469 rel=stylesheet>
<link href=/css/featherlight.min.css?1644506469 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644506469 rel=stylesheet>
<link href=/css/auto-complete.css?1644506469 rel=stylesheet>
<link href=/css/theme.css?1644506469 rel=stylesheet>
<link href=/css/theme-blue.css?1644506469 rel=stylesheet>
<link href=/css/variant.css?1644506469 rel=stylesheet>
<link href=/css/print.css?1644506469 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644506469></script>
<link href=/css/nucleus.css?1644600600 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644600600 rel=stylesheet>
<link href=/css/featherlight.min.css?1644600600 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644600600 rel=stylesheet>
<link href=/css/auto-complete.css?1644600600 rel=stylesheet>
<link href=/css/theme.css?1644600600 rel=stylesheet>
<link href=/css/theme-blue.css?1644600600 rel=stylesheet>
<link href=/css/variant.css?1644600600 rel=stylesheet>
<link href=/css/print.css?1644600600 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644600600></script>
<style>:root #header+#content>#left>#rlblock_left{display:none!important}</style>
</head>
<body data-url=/navpatterns/3-cal-coding-guidelines/design/cyclomatic-complexity/>
@ -32,9 +32,9 @@ ALGuidelines.Dev
<input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span>
</div>
<script src=/js/lunr.min.js?1644506469></script>
<script src=/js/auto-complete.js?1644506469></script>
<script src=/js/search.js?1644506469></script>
<script src=/js/lunr.min.js?1644600600></script>
<script src=/js/auto-complete.js?1644600600></script>
<script src=/js/search.js?1644600600></script>
</div>
<div class=highlightable>
<ul class=topics>
@ -257,7 +257,7 @@ ALGuidelines.Dev
<h1>Cyclomatic Complexity</h1>
<p>Do not write functions that have high cyclomatic complexity. This makes the code hard to maintain.</p>
<p>Bad code</p>
<pre><code>Any procedure / trigger that has a cyclomatic complexity \&gt; 25, using the CC3 version mentioned in [this article][anchor0].
<pre><code>Any procedure / trigger that has a cyclomatic complexity &gt; 25, using the CC3 version mentioned in [this article][anchor0].
</code></pre>
<p>Good code</p>
<pre><code>Any procedure / trigger that has a cyclomatic complexity &lt;= 25, using the CC3 version.
@ -277,12 +277,12 @@ The CC3 version is computed by summing the following in a code block:
<div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px>
<div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div>
</div>
<script src=/js/clipboard.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644506469></script>
<script src=/js/jquery.svg.pan.zoom.js?1644506469></script>
<script src=/js/featherlight.min.js?1644506469></script>
<script src=/js/modernizr.custom-3.6.0.js?1644506469></script>
<script src=/js/relearn.js?1644506469></script>
<script src=/js/clipboard.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644600600></script>
<script src=/js/jquery.svg.pan.zoom.js?1644600600></script>
<script src=/js/featherlight.min.js?1644600600></script>
<script src=/js/modernizr.custom-3.6.0.js?1644600600></script>
<script src=/js/relearn.js?1644600600></script>
</body>
</html>

View file

@ -5,16 +5,16 @@
<meta name=generator content="Hugo 0.92.1">
<meta name=description content>
<title>Encapsulate Local Functionality :: AL Guidelines</title>
<link href=/css/nucleus.css?1644506469 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644506469 rel=stylesheet>
<link href=/css/featherlight.min.css?1644506469 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644506469 rel=stylesheet>
<link href=/css/auto-complete.css?1644506469 rel=stylesheet>
<link href=/css/theme.css?1644506469 rel=stylesheet>
<link href=/css/theme-blue.css?1644506469 rel=stylesheet>
<link href=/css/variant.css?1644506469 rel=stylesheet>
<link href=/css/print.css?1644506469 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644506469></script>
<link href=/css/nucleus.css?1644600600 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644600600 rel=stylesheet>
<link href=/css/featherlight.min.css?1644600600 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644600600 rel=stylesheet>
<link href=/css/auto-complete.css?1644600600 rel=stylesheet>
<link href=/css/theme.css?1644600600 rel=stylesheet>
<link href=/css/theme-blue.css?1644600600 rel=stylesheet>
<link href=/css/variant.css?1644600600 rel=stylesheet>
<link href=/css/print.css?1644600600 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644600600></script>
<style>:root #header+#content>#left>#rlblock_left{display:none!important}</style>
</head>
<body data-url=/navpatterns/3-cal-coding-guidelines/design/encapsulate-local-functionality/>
@ -32,9 +32,9 @@ ALGuidelines.Dev
<input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span>
</div>
<script src=/js/lunr.min.js?1644506469></script>
<script src=/js/auto-complete.js?1644506469></script>
<script src=/js/search.js?1644506469></script>
<script src=/js/lunr.min.js?1644600600></script>
<script src=/js/auto-complete.js?1644600600></script>
<script src=/js/search.js?1644600600></script>
</div>
<div class=highlightable>
<ul class=topics>
@ -268,12 +268,12 @@ ALGuidelines.Dev
<div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px>
<div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div>
</div>
<script src=/js/clipboard.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644506469></script>
<script src=/js/jquery.svg.pan.zoom.js?1644506469></script>
<script src=/js/featherlight.min.js?1644506469></script>
<script src=/js/modernizr.custom-3.6.0.js?1644506469></script>
<script src=/js/relearn.js?1644506469></script>
<script src=/js/clipboard.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644600600></script>
<script src=/js/jquery.svg.pan.zoom.js?1644600600></script>
<script src=/js/featherlight.min.js?1644600600></script>
<script src=/js/modernizr.custom-3.6.0.js?1644600600></script>
<script src=/js/relearn.js?1644600600></script>
</body>
</html>

View file

@ -5,16 +5,16 @@
<meta name=generator content="Hugo 0.92.1">
<meta name=description content>
<title>FINDSET FINDFIRST FINDLAST :: AL Guidelines</title>
<link href=/css/nucleus.css?1644506469 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644506469 rel=stylesheet>
<link href=/css/featherlight.min.css?1644506469 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644506469 rel=stylesheet>
<link href=/css/auto-complete.css?1644506469 rel=stylesheet>
<link href=/css/theme.css?1644506469 rel=stylesheet>
<link href=/css/theme-blue.css?1644506469 rel=stylesheet>
<link href=/css/variant.css?1644506469 rel=stylesheet>
<link href=/css/print.css?1644506469 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644506469></script>
<link href=/css/nucleus.css?1644600600 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644600600 rel=stylesheet>
<link href=/css/featherlight.min.css?1644600600 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644600600 rel=stylesheet>
<link href=/css/auto-complete.css?1644600600 rel=stylesheet>
<link href=/css/theme.css?1644600600 rel=stylesheet>
<link href=/css/theme-blue.css?1644600600 rel=stylesheet>
<link href=/css/variant.css?1644600600 rel=stylesheet>
<link href=/css/print.css?1644600600 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644600600></script>
<style>:root #header+#content>#left>#rlblock_left{display:none!important}</style>
</head>
<body data-url=/navpatterns/3-cal-coding-guidelines/design/findset-findfirst-findlast/>
@ -32,9 +32,9 @@ ALGuidelines.Dev
<input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span>
</div>
<script src=/js/lunr.min.js?1644506469></script>
<script src=/js/auto-complete.js?1644506469></script>
<script src=/js/search.js?1644506469></script>
<script src=/js/lunr.min.js?1644600600></script>
<script src=/js/auto-complete.js?1644600600></script>
<script src=/js/search.js?1644600600></script>
</div>
<div class=highlightable>
<ul class=topics>
@ -258,23 +258,23 @@ ALGuidelines.Dev
<p>FINDSET, FIND('+') or FIND('-') should only be used when NEXT is used and vice versa.</p>
<p>Bad code</p>
<pre><code>IF Cust.FIND('-') THEN
ERROR(CustIsBlockErr)
ERROR(CustIsBlockErr)
</code></pre>
<p>Good code</p>
<pre><code>IF Cust.FINDFIRST THEN
ERROR(CustIsBlockErr)
ERROR(CustIsBlockErr)
</code></pre>
<p>Bad code</p>
<pre><code>IF Cust.FINDFIRST THEN
REPEAT
...
UNTIL Cust.NEXT = 0;
REPEAT
...
UNTIL Cust.NEXT = 0;
</code></pre>
<p>Good code</p>
<pre><code>IF Cust.FINDSET THEN
REPEAT
...
UNTIL Cust.NEXT = 0;
REPEAT
...
UNTIL Cust.NEXT = 0;
</code></pre>
<footer class=footline>
</footer>
@ -288,12 +288,12 @@ UNTIL Cust.NEXT = 0;
<div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px>
<div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div>
</div>
<script src=/js/clipboard.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644506469></script>
<script src=/js/jquery.svg.pan.zoom.js?1644506469></script>
<script src=/js/featherlight.min.js?1644506469></script>
<script src=/js/modernizr.custom-3.6.0.js?1644506469></script>
<script src=/js/relearn.js?1644506469></script>
<script src=/js/clipboard.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644600600></script>
<script src=/js/jquery.svg.pan.zoom.js?1644600600></script>
<script src=/js/featherlight.min.js?1644600600></script>
<script src=/js/modernizr.custom-3.6.0.js?1644600600></script>
<script src=/js/relearn.js?1644600600></script>
</body>
</html>

View file

@ -6,16 +6,16 @@
<link rel=alternate type=application/rss+xml href=/navpatterns/3-cal-coding-guidelines/design/index.xml title="AL Guidelines">
<meta name=description content>
<title>Design :: AL Guidelines</title>
<link href=/css/nucleus.css?1644506471 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644506471 rel=stylesheet>
<link href=/css/featherlight.min.css?1644506471 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644506471 rel=stylesheet>
<link href=/css/auto-complete.css?1644506471 rel=stylesheet>
<link href=/css/theme.css?1644506471 rel=stylesheet>
<link href=/css/theme-blue.css?1644506471 rel=stylesheet>
<link href=/css/variant.css?1644506471 rel=stylesheet>
<link href=/css/print.css?1644506471 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644506471></script>
<link href=/css/nucleus.css?1644600601 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644600601 rel=stylesheet>
<link href=/css/featherlight.min.css?1644600601 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644600601 rel=stylesheet>
<link href=/css/auto-complete.css?1644600601 rel=stylesheet>
<link href=/css/theme.css?1644600601 rel=stylesheet>
<link href=/css/theme-blue.css?1644600601 rel=stylesheet>
<link href=/css/variant.css?1644600601 rel=stylesheet>
<link href=/css/print.css?1644600601 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644600601></script>
<style>:root #header+#content>#left>#rlblock_left{display:none!important}</style>
</head>
<body data-url=/navpatterns/3-cal-coding-guidelines/design/>
@ -33,9 +33,9 @@ ALGuidelines.Dev
<input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span>
</div>
<script src=/js/lunr.min.js?1644506471></script>
<script src=/js/auto-complete.js?1644506471></script>
<script src=/js/search.js?1644506471></script>
<script src=/js/lunr.min.js?1644600601></script>
<script src=/js/auto-complete.js?1644600601></script>
<script src=/js/search.js?1644600601></script>
</div>
<div class=highlightable>
<ul class=topics>
@ -275,12 +275,12 @@ ALGuidelines.Dev
<div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px>
<div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div>
</div>
<script src=/js/clipboard.min.js?1644506471></script>
<script src=/js/perfect-scrollbar.min.js?1644506471></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644506471></script>
<script src=/js/jquery.svg.pan.zoom.js?1644506471></script>
<script src=/js/featherlight.min.js?1644506471></script>
<script src=/js/modernizr.custom-3.6.0.js?1644506471></script>
<script src=/js/relearn.js?1644506471></script>
<script src=/js/clipboard.min.js?1644600601></script>
<script src=/js/perfect-scrollbar.min.js?1644600601></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644600601></script>
<script src=/js/jquery.svg.pan.zoom.js?1644600601></script>
<script src=/js/featherlight.min.js?1644600601></script>
<script src=/js/modernizr.custom-3.6.0.js?1644600601></script>
<script src=/js/relearn.js?1644600601></script>
</body>
</html>

View file

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Design on AL Guidelines</title><link>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/</link><description>Recent content in Design on AL Guidelines</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><atom:link href="https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/index.xml" rel="self" type="application/rss+xml"/><item><title>By Reference Parameters</title><link>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/by-reference-parameters/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/by-reference-parameters/</guid><description>Do not declare parameters by reference if their values are not intended to be changed.
Unintentional value changes might propagate. Also, it might lead people to believe that value changes are intended.
Bad code
LOCAL PROCEDURE ShowMessage@15(VAR Text@1000 : Text\[250\]); BEGIN Text := GetMessageText; IF (Text &amp;lt;\&amp;gt; '') AND GenJnlLineInserted THEN MESSAGE(Text); END; Good code
LOCAL PROCEDURE ShowMessage@15(Text@1000 : Text\[250\]); BEGIN Text := GetMessageText; IF (Text &amp;lt;\&amp;gt; '') AND GenJnlLineInserted THEN MESSAGE(Text); END;</description></item><item><title>Class Coupling</title><link>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/class-coupling/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/class-coupling/</guid><description>Do not write functions that have high class coupling. This makes the code hard to maintain.
LOCAL PROCEDURE ShowMessage@15(VAR Text@1000 : Text[250]); BEGIN Text := GetMessageText; IF (Text &amp;lt;&amp;gt; '') AND GenJnlLineInserted THEN MESSAGE(Text); END; Good code
LOCAL PROCEDURE ShowMessage@15(Text@1000 : Text[250]); BEGIN Text := GetMessageText; IF (Text &amp;lt;&amp;gt; '') AND GenJnlLineInserted THEN MESSAGE(Text); END;</description></item><item><title>Class Coupling</title><link>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/class-coupling/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/class-coupling/</guid><description>Do not write functions that have high class coupling. This makes the code hard to maintain.
Bad code
Any procedure / trigger that has class coupling of \&amp;gt; 30 Good code
Any procedure / trigger that has class coupling of &amp;gt; 30 Good code
Any procedure / trigger that has class coupling of &amp;lt;= 30\. Class coupling is computed by summing the unique instances of the following in a code block: - every unique usage of a complex C/AL data type (table, codeunit, etc) as 1\.</description></item><item><title>Cyclomatic Complexity</title><link>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/cyclomatic-complexity/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/cyclomatic-complexity/</guid><description>Do not write functions that have high cyclomatic complexity. This makes the code hard to maintain.
Bad code
Any procedure / trigger that has a cyclomatic complexity \&amp;gt; 25, using the CC3 version mentioned in [this article][anchor0]. Good code
Any procedure / trigger that has a cyclomatic complexity &amp;gt; 25, using the CC3 version mentioned in [this article][anchor0]. Good code
Any procedure / trigger that has a cyclomatic complexity &amp;lt;= 25, using the CC3 version. The CC3 version is computed by summing the following in a code block: - each IF statement as 1\.</description></item><item><title>Encapsulate Local Functionality</title><link>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/encapsulate-local-functionality/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/encapsulate-local-functionality/</guid><description>Any function used local must be defined as local.</description></item><item><title>FINDSET FINDFIRST FINDLAST</title><link>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/findset-findfirst-findlast/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/findset-findfirst-findlast/</guid><description>FINDSET, FIND('+') or FIND('-') should only be used when NEXT is used and vice versa.
Bad code
IF Cust.FIND('-') THEN ERROR(CustIsBlockErr) Good code
@ -19,7 +19,7 @@ PROCEDURE SetPurchLine@22(VAR CurrentPurchLine@1000 : Record 39); VAR Pegging@10
PROCEDURE SetPurchLine@22(VAR CurrentPurchLine@1000 : Record 39); VAR Pegging@1001 : Boolean; BEGIN Pegging := IsPegging(CurrentPurchLine); IF Pegging THEN CurrQuantity := CurrentPurchLine.&amp;quot;Quantity (Base)&amp;quot; ELSE CurrQuantity := CurrentPurchLine.&amp;quot;Outstanding Qty. (Base)&amp;quot;; END; Bad code</description></item><item><title>Maintainability Index</title><link>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/maintainability-index/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/maintainability-index/</guid><description>Maintainability Index: Do not write functions that have a very low maintainability index. This makes the code hard to maintain.
Bad code
Any procedure / trigger that has a maintainability index &amp;lt; 20 Good code
Any procedure / trigger that has a maintainability index \&amp;gt;= 20\. The Maintainability Index is computed as a function: - Lines Of Code (inverse proportional) - the Halstead Volume - Cyclomatic Complexity (inverse proportional). More info</description></item><item><title>Parameter Placeholders</title><link>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/parameter-placeholders/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/parameter-placeholders/</guid><description>The number of parameters passed to a string must match the placeholders.
Any procedure / trigger that has a maintainability index &amp;gt;= 20\. The Maintainability Index is computed as a function: - Lines Of Code (inverse proportional) - the Halstead Volume - Cyclomatic Complexity (inverse proportional). More info</description></item><item><title>Parameter Placeholders</title><link>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/parameter-placeholders/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/parameter-placeholders/</guid><description>The number of parameters passed to a string must match the placeholders.
Bad code
CannotDeleteLineErr@1005 : TextConst 'ENU=You cannot delete this line because one or more rating values exists.'; ... ERROR(CannotDeleteLineErr,TABLECAPTION); Good code
CannotDeleteLineErr@1005 : TextConst 'ENU=You cannot delete this line because one or more rating values exists.'; ... ERROR(CannotDeleteLineErr); Bad code
@ -29,22 +29,22 @@ LOCAL PROCEDURE Code@1(); VAR CAJnlPostBatch@1001 : Codeunit 1103; BEGIN CAJnlPo
LOCAL PROCEDURE Code@1(); BEGIN CODEUNIT.RUN(CODEUNIT::&amp;quot;CA Jnl.-Post Batch&amp;quot;,CostJnlLine); END;</description></item><item><title>Unreachable Code</title><link>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/unreachable-code/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/unreachable-code/</guid><description>Do not write code that will never be hit.
It affects code readability and can lead to wrong assumptions.
Bad code
IF Type &amp;lt;\&amp;gt; Type::FIELD THEN BEGIN ... ERROR(...); RecRef.CLOSE; END; Good code
IF Type &amp;lt;\&amp;gt; Type::FIELD THEN BEGIN ... RecRef.CLOSE; ERROR(...); END;</description></item><item><title>Unused Initialized Variables</title><link>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/unused-initialized-variables/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/unused-initialized-variables/</guid><description>The value assigned to a variable must be used. Else the variable is not necessary.
IF Type &amp;lt;&amp;gt; Type::FIELD THEN BEGIN ... ERROR(...); RecRef.CLOSE; END; Good code
IF Type &amp;lt;&amp;gt; Type::FIELD THEN BEGIN ... RecRef.CLOSE; ERROR(...); END;</description></item><item><title>Unused Initialized Variables</title><link>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/unused-initialized-variables/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/unused-initialized-variables/</guid><description>The value assigned to a variable must be used. Else the variable is not necessary.
Bad code
PROCEDURE AddEntities@1(FilterStr@1000 : Text\[250\]); VAR Vendor@1001 : Record 23; Count@1002 : Integer; BEGIN Count := 0; Vendor.SETFILTER(&amp;quot;No.&amp;quot;,FilterStr); IF Vendor.FINDSET THEN REPEAT &amp;quot;User ID&amp;quot; := USERID; &amp;quot;Vendor No.&amp;quot; := Vendor.&amp;quot;No.&amp;quot;; IF INSERT THEN Count += 1; UNTIL Vendor.NEXT = 0; END; Good code
PROCEDURE AddEntities@1(FilterStr@1000 : Text\[250\]); VAR Vendor@1001 : Record 23; BEGIN Vendor.</description></item><item><title>Unused Variables</title><link>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/unused-variables/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/unused-variables/</guid><description>Do not declare variables that are unused.
PROCEDURE AddEntities@1(FilterStr@1000 : Text[250]); VAR Vendor@1001 : Record 23; Count@1002 : Integer; BEGIN Count := 0; Vendor.SETFILTER(&amp;quot;No.&amp;quot;,FilterStr); IF Vendor.FINDSET THEN REPEAT &amp;quot;User ID&amp;quot; := USERID; &amp;quot;Vendor No.&amp;quot; := Vendor.&amp;quot;No.&amp;quot;; IF INSERT THEN Count += 1; UNTIL Vendor.NEXT = 0; END; Good code
PROCEDURE AddEntities@1(FilterStr@1000 : Text[250]); VAR Vendor@1001 : Record 23; BEGIN Vendor.</description></item><item><title>Unused Variables</title><link>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/unused-variables/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/unused-variables/</guid><description>Do not declare variables that are unused.
Unused variables affect readability.
Bad code
PROCEDURE CheckPostingDate@23(CaptionEntryNo@1005 : Text\[50\]); BEGIN IF GenJnlCheckLine.DateNotAllowed(PostingDate) THEN ERROR(DateNotAllowedErr,Caption,EntryNo) IF PostingDate \&amp;gt; MaxPostingDate THEN MaxPostingDate := PostingDate; END Good code
PROCEDURE CheckPostingDate@23(); BEGIN IF GenJnlCheckLine.DateNotAllowed(PostingDate) THEN ERROR(DateNotAllowedErr,Caption,EntryNo); IF PostingDate \&amp;gt; MaxPostingDate THEN MaxPostingDate := PostingDate; END; Bad code
PROCEDURE CheckPostingDate@23(CaptionEntryNo@1005 : Text[50]); BEGIN IF GenJnlCheckLine.DateNotAllowed(PostingDate) THEN ERROR(DateNotAllowedErr,Caption,EntryNo) IF PostingDate &amp;gt; MaxPostingDate THEN MaxPostingDate := PostingDate; END Good code
PROCEDURE CheckPostingDate@23(); BEGIN IF GenJnlCheckLine.DateNotAllowed(PostingDate) THEN ERROR(DateNotAllowedErr,Caption,EntryNo); IF PostingDate &amp;gt; MaxPostingDate THEN MaxPostingDate := PostingDate; END; Bad code
PROCEDURE IsReturned@14(EntryNo@1002 : Integer) : Decimal; VAR ItemEntry@1000 : Record 32; Quantity@1003 : Integer; BEGIN EXIT(-OutboundApplied(EntryNo,TRUE) - InboundApplied(EntryNo,TRUE)); END; Good code</description></item><item><title>Variable Capacity Mismatch</title><link>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/variable-capacity-mismatch/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/variable-capacity-mismatch/</guid><description>Do not assign a value to a variable whose capacity is smaller.
It will throw an error at runtime.
Bad code
FileName@1010 : Text\[250\]; ... UploadedFileName@1016 : Text\[1024\]; ... FileName := UploadedFileName; Good code
FileName@1010 : Text\[1024\]; ... UploadedFileName@1016 : Text\[1024\]; ... FileName := UploadedFileName; Bad code
FileName@1010 : Text\[250\]; ... UploadedFileName@1016 : Text\[1024\]; ... FileName := UploadedFileName; Good code
FileName@1010 : Text\[250\]; ... UploadedFileName@1016 : Text\[1024\]; .</description></item><item><title>WITH Scope Name Collision</title><link>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/with-scope-name-collision/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/with-scope-name-collision/</guid><description>Do not use the WITH scope when it has a variable whose name is the same as a local variable. This can lead to wrong code assumptions.
FileName@1010 : Text[250]; ... UploadedFileName@1016 : Text[1024]; ... FileName := UploadedFileName; Good code
FileName@1010 : Text[1024]; ... UploadedFileName@1016 : Text[1024]; ... FileName := UploadedFileName; Bad code
FileName@1010 : Text[250]; ... UploadedFileName@1016 : Text[1024]; ... FileName := UploadedFileName; Good code
FileName@1010 : Text[250]; ... UploadedFileName@1016 : Text[1024]; .</description></item><item><title>WITH Scope Name Collision</title><link>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/with-scope-name-collision/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://alguidelines.dev/navpatterns/3-cal-coding-guidelines/design/with-scope-name-collision/</guid><description>Do not use the WITH scope when it has a variable whose name is the same as a local variable. This can lead to wrong code assumptions.
Given that &amp;ldquo;Contract Type&amp;rdquo; is a field on table ServiceContractHeader, then in the following example there is a parameter name clash with the field name. Which one will be used?
Bad code
PROCEDURE InsertData@1(&amp;quot;Contract Type&amp;quot;@1000 : Option...); ... BEGIN ... WITH ServiceContractHeader DO BEGIN .</description></item></channel></rss>

View file

@ -5,16 +5,16 @@
<meta name=generator content="Hugo 0.92.1">
<meta name=description content>
<title>Initialized Variables :: AL Guidelines</title>
<link href=/css/nucleus.css?1644506469 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644506469 rel=stylesheet>
<link href=/css/featherlight.min.css?1644506469 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644506469 rel=stylesheet>
<link href=/css/auto-complete.css?1644506469 rel=stylesheet>
<link href=/css/theme.css?1644506469 rel=stylesheet>
<link href=/css/theme-blue.css?1644506469 rel=stylesheet>
<link href=/css/variant.css?1644506469 rel=stylesheet>
<link href=/css/print.css?1644506469 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644506469></script>
<link href=/css/nucleus.css?1644600600 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644600600 rel=stylesheet>
<link href=/css/featherlight.min.css?1644600600 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644600600 rel=stylesheet>
<link href=/css/auto-complete.css?1644600600 rel=stylesheet>
<link href=/css/theme.css?1644600600 rel=stylesheet>
<link href=/css/theme-blue.css?1644600600 rel=stylesheet>
<link href=/css/variant.css?1644600600 rel=stylesheet>
<link href=/css/print.css?1644600600 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644600600></script>
<style>:root #header+#content>#left>#rlblock_left{display:none!important}</style>
</head>
<body data-url=/navpatterns/3-cal-coding-guidelines/design/initialized-variables/>
@ -32,9 +32,9 @@ ALGuidelines.Dev
<input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span>
</div>
<script src=/js/lunr.min.js?1644506469></script>
<script src=/js/auto-complete.js?1644506469></script>
<script src=/js/search.js?1644506469></script>
<script src=/js/lunr.min.js?1644600600></script>
<script src=/js/auto-complete.js?1644600600></script>
<script src=/js/search.js?1644600600></script>
</div>
<div class=highlightable>
<ul class=topics>
@ -259,41 +259,41 @@ ALGuidelines.Dev
<p>Bad code</p>
<pre><code>PROCEDURE SetPurchLine@22(VAR CurrentPurchLine@1000 : Record 39);
VAR
Pegging@1001 : Boolean;
Pegging@1001 : Boolean;
BEGIN
IF Pegging THEN
CurrQuantity := CurrentPurchLine.&quot;Quantity (Base)&quot;
ELSE
CurrQuantity := CurrentPurchLine.&quot;Outstanding Qty. (Base)&quot;;
IF Pegging THEN
CurrQuantity := CurrentPurchLine.&quot;Quantity (Base)&quot;
ELSE
CurrQuantity := CurrentPurchLine.&quot;Outstanding Qty. (Base)&quot;;
END;
</code></pre>
<p>Good code</p>
<pre><code>PROCEDURE SetPurchLine@22(VAR CurrentPurchLine@1000 : Record 39);
VAR
Pegging@1001 : Boolean;
Pegging@1001 : Boolean;
BEGIN
Pegging := IsPegging(CurrentPurchLine);
IF Pegging THEN
CurrQuantity := CurrentPurchLine.&quot;Quantity (Base)&quot;
ELSE
CurrQuantity := CurrentPurchLine.&quot;Outstanding Qty. (Base)&quot;;
Pegging := IsPegging(CurrentPurchLine);
IF Pegging THEN
CurrQuantity := CurrentPurchLine.&quot;Quantity (Base)&quot;
ELSE
CurrQuantity := CurrentPurchLine.&quot;Outstanding Qty. (Base)&quot;;
END;
</code></pre>
<p>Bad code</p>
<pre><code>// In the example below, the function will always return FALSE.
PROCEDURE GetItemsToPlan@22() : Boolean;
BEGIN
SETRANGE(&quot;Document Type&quot;,&quot;Document Type&quot;::Order);
...
FINDSET
SETRANGE(&quot;Document Type&quot;,&quot;Document Type&quot;::Order);
...
FINDSET
END;
</code></pre>
<p>Good code</p>
<pre><code>PROCEDURE GetItemsToPlan@22() : Boolean;
BEGIN
SETRANGE(&quot;Document Type&quot;,&quot;Document Type&quot;::Order);
...
EXIT(FINDSET)
SETRANGE(&quot;Document Type&quot;,&quot;Document Type&quot;::Order);
...
EXIT(FINDSET)
END;
</code></pre>
<footer class=footline>
@ -308,12 +308,12 @@ END;
<div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px>
<div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div>
</div>
<script src=/js/clipboard.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644506469></script>
<script src=/js/jquery.svg.pan.zoom.js?1644506469></script>
<script src=/js/featherlight.min.js?1644506469></script>
<script src=/js/modernizr.custom-3.6.0.js?1644506469></script>
<script src=/js/relearn.js?1644506469></script>
<script src=/js/clipboard.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644600600></script>
<script src=/js/jquery.svg.pan.zoom.js?1644600600></script>
<script src=/js/featherlight.min.js?1644600600></script>
<script src=/js/modernizr.custom-3.6.0.js?1644600600></script>
<script src=/js/relearn.js?1644600600></script>
</body>
</html>

View file

@ -5,16 +5,16 @@
<meta name=generator content="Hugo 0.92.1">
<meta name=description content>
<title>Maintainability Index :: AL Guidelines</title>
<link href=/css/nucleus.css?1644506469 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644506469 rel=stylesheet>
<link href=/css/featherlight.min.css?1644506469 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644506469 rel=stylesheet>
<link href=/css/auto-complete.css?1644506469 rel=stylesheet>
<link href=/css/theme.css?1644506469 rel=stylesheet>
<link href=/css/theme-blue.css?1644506469 rel=stylesheet>
<link href=/css/variant.css?1644506469 rel=stylesheet>
<link href=/css/print.css?1644506469 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644506469></script>
<link href=/css/nucleus.css?1644600600 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644600600 rel=stylesheet>
<link href=/css/featherlight.min.css?1644600600 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644600600 rel=stylesheet>
<link href=/css/auto-complete.css?1644600600 rel=stylesheet>
<link href=/css/theme.css?1644600600 rel=stylesheet>
<link href=/css/theme-blue.css?1644600600 rel=stylesheet>
<link href=/css/variant.css?1644600600 rel=stylesheet>
<link href=/css/print.css?1644600600 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644600600></script>
<style>:root #header+#content>#left>#rlblock_left{display:none!important}</style>
</head>
<body data-url=/navpatterns/3-cal-coding-guidelines/design/maintainability-index/>
@ -32,9 +32,9 @@ ALGuidelines.Dev
<input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span>
</div>
<script src=/js/lunr.min.js?1644506469></script>
<script src=/js/auto-complete.js?1644506469></script>
<script src=/js/search.js?1644506469></script>
<script src=/js/lunr.min.js?1644600600></script>
<script src=/js/auto-complete.js?1644600600></script>
<script src=/js/search.js?1644600600></script>
</div>
<div class=highlightable>
<ul class=topics>
@ -260,11 +260,11 @@ ALGuidelines.Dev
<pre><code>Any procedure / trigger that has a maintainability index &lt; 20
</code></pre>
<p>Good code</p>
<pre><code>Any procedure / trigger that has a maintainability index \&gt;= 20\.
<pre><code>Any procedure / trigger that has a maintainability index &gt;= 20\.
The Maintainability Index is computed as a function:
- Lines Of Code (inverse proportional)
- the Halstead Volume
- Cyclomatic Complexity (inverse proportional).
- Lines Of Code (inverse proportional)
- the Halstead Volume
- Cyclomatic Complexity (inverse proportional).
</code></pre>
<p>More info</p>
<ul>
@ -272,7 +272,7 @@ The Maintainability Index is computed as a function:
<li><a href=http://www.aivosto.com/project/help/pm-complexity.html>Cyclomatic Complexity</a></li>
</ul>
<p>Bad code</p>
<pre><code>Any procedure / trigger that is \&gt; 100 lines of code
<pre><code>Any procedure / trigger that is &gt; 100 lines of code
</code></pre>
<p>Good code</p>
<pre><code>Any procedure / trigger that is &lt;= 100 lines of code.
@ -290,12 +290,12 @@ A full C/AL Statement counts as 1 line of code
<div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px>
<div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div>
</div>
<script src=/js/clipboard.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644506469></script>
<script src=/js/jquery.svg.pan.zoom.js?1644506469></script>
<script src=/js/featherlight.min.js?1644506469></script>
<script src=/js/modernizr.custom-3.6.0.js?1644506469></script>
<script src=/js/relearn.js?1644506469></script>
<script src=/js/clipboard.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644600600></script>
<script src=/js/jquery.svg.pan.zoom.js?1644600600></script>
<script src=/js/featherlight.min.js?1644600600></script>
<script src=/js/modernizr.custom-3.6.0.js?1644600600></script>
<script src=/js/relearn.js?1644600600></script>
</body>
</html>

View file

@ -5,16 +5,16 @@
<meta name=generator content="Hugo 0.92.1">
<meta name=description content>
<title>Parameter Placeholders :: AL Guidelines</title>
<link href=/css/nucleus.css?1644506469 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644506469 rel=stylesheet>
<link href=/css/featherlight.min.css?1644506469 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644506469 rel=stylesheet>
<link href=/css/auto-complete.css?1644506469 rel=stylesheet>
<link href=/css/theme.css?1644506469 rel=stylesheet>
<link href=/css/theme-blue.css?1644506469 rel=stylesheet>
<link href=/css/variant.css?1644506469 rel=stylesheet>
<link href=/css/print.css?1644506469 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644506469></script>
<link href=/css/nucleus.css?1644600600 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644600600 rel=stylesheet>
<link href=/css/featherlight.min.css?1644600600 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644600600 rel=stylesheet>
<link href=/css/auto-complete.css?1644600600 rel=stylesheet>
<link href=/css/theme.css?1644600600 rel=stylesheet>
<link href=/css/theme-blue.css?1644600600 rel=stylesheet>
<link href=/css/variant.css?1644600600 rel=stylesheet>
<link href=/css/print.css?1644600600 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644600600></script>
<style>:root #header+#content>#left>#rlblock_left{display:none!important}</style>
</head>
<body data-url=/navpatterns/3-cal-coding-guidelines/design/parameter-placeholders/>
@ -32,9 +32,9 @@ ALGuidelines.Dev
<input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span>
</div>
<script src=/js/lunr.min.js?1644506469></script>
<script src=/js/auto-complete.js?1644506469></script>
<script src=/js/search.js?1644506469></script>
<script src=/js/lunr.min.js?1644600600></script>
<script src=/js/auto-complete.js?1644600600></script>
<script src=/js/search.js?1644600600></script>
</div>
<div class=highlightable>
<ul class=topics>
@ -252,7 +252,6 @@ ALGuidelines.Dev
<li>
<ul>
<li><a href=#heading></a></li>
<li><a href=#heading-1></a></li>
</ul>
</li>
</ul>
@ -265,7 +264,6 @@ ALGuidelines.Dev
<main id=body-inner>
<h1>Parameter Placeholders</h1>
<p>The number of parameters passed to a string must match the placeholders.</p>
<hr>
<p>Bad code</p>
<pre><code>CannotDeleteLineErr@1005 : TextConst 'ENU=You cannot delete this line because one or more rating values exists.';
...
@ -276,7 +274,6 @@ ERROR(CannotDeleteLineErr,TABLECAPTION);
...
ERROR(CannotDeleteLineErr);
</code></pre>
<h3 id=heading></h3>
<p>Bad code</p>
<pre><code>CannotUseThisFieldErr@1020 : TextConst 'ENU=You cannot use this field for %2 fields.';
...
@ -287,7 +284,7 @@ ERROR(CannotUseThisFieldErr,0,Field.Class);
...
ERROR(CannotUseThisFieldErr,Field.Class);
</code></pre>
<h3 id=heading-1></h3>
<h3 id=heading></h3>
<footer class=footline>
</footer>
</main>
@ -300,12 +297,12 @@ ERROR(CannotUseThisFieldErr,Field.Class);
<div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px>
<div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div>
</div>
<script src=/js/clipboard.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644506469></script>
<script src=/js/jquery.svg.pan.zoom.js?1644506469></script>
<script src=/js/featherlight.min.js?1644506469></script>
<script src=/js/modernizr.custom-3.6.0.js?1644506469></script>
<script src=/js/relearn.js?1644506469></script>
<script src=/js/clipboard.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644600600></script>
<script src=/js/jquery.svg.pan.zoom.js?1644600600></script>
<script src=/js/featherlight.min.js?1644600600></script>
<script src=/js/modernizr.custom-3.6.0.js?1644600600></script>
<script src=/js/relearn.js?1644600600></script>
</body>
</html>

View file

@ -5,16 +5,16 @@
<meta name=generator content="Hugo 0.92.1">
<meta name=description content>
<title>Static Object Invocation :: AL Guidelines</title>
<link href=/css/nucleus.css?1644506469 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644506469 rel=stylesheet>
<link href=/css/featherlight.min.css?1644506469 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644506469 rel=stylesheet>
<link href=/css/auto-complete.css?1644506469 rel=stylesheet>
<link href=/css/theme.css?1644506469 rel=stylesheet>
<link href=/css/theme-blue.css?1644506469 rel=stylesheet>
<link href=/css/variant.css?1644506469 rel=stylesheet>
<link href=/css/print.css?1644506469 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644506469></script>
<link href=/css/nucleus.css?1644600600 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644600600 rel=stylesheet>
<link href=/css/featherlight.min.css?1644600600 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644600600 rel=stylesheet>
<link href=/css/auto-complete.css?1644600600 rel=stylesheet>
<link href=/css/theme.css?1644600600 rel=stylesheet>
<link href=/css/theme-blue.css?1644600600 rel=stylesheet>
<link href=/css/variant.css?1644600600 rel=stylesheet>
<link href=/css/print.css?1644600600 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644600600></script>
<style>:root #header+#content>#left>#rlblock_left{display:none!important}</style>
</head>
<body data-url=/navpatterns/3-cal-coding-guidelines/design/static-object-invocation/>
@ -32,9 +32,9 @@ ALGuidelines.Dev
<input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span>
</div>
<script src=/js/lunr.min.js?1644506469></script>
<script src=/js/auto-complete.js?1644506469></script>
<script src=/js/search.js?1644506469></script>
<script src=/js/lunr.min.js?1644600600></script>
<script src=/js/auto-complete.js?1644600600></script>
<script src=/js/search.js?1644600600></script>
</div>
<div class=highlightable>
<ul class=topics>
@ -259,15 +259,15 @@ ALGuidelines.Dev
<p>Bad code</p>
<pre><code>LOCAL PROCEDURE Code@1();
VAR
CAJnlPostBatch@1001 : Codeunit 1103;
CAJnlPostBatch@1001 : Codeunit 1103;
BEGIN
CAJnlPostBatch.Run(CostJnlLine);
CAJnlPostBatch.Run(CostJnlLine);
END;
</code></pre>
<p>Good code</p>
<pre><code>LOCAL PROCEDURE Code@1();
BEGIN
CODEUNIT.RUN(CODEUNIT::&quot;CA Jnl.-Post Batch&quot;,CostJnlLine);
CODEUNIT.RUN(CODEUNIT::&quot;CA Jnl.-Post Batch&quot;,CostJnlLine);
END;
</code></pre>
<footer class=footline>
@ -282,12 +282,12 @@ END;
<div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px>
<div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div>
</div>
<script src=/js/clipboard.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644506469></script>
<script src=/js/jquery.svg.pan.zoom.js?1644506469></script>
<script src=/js/featherlight.min.js?1644506469></script>
<script src=/js/modernizr.custom-3.6.0.js?1644506469></script>
<script src=/js/relearn.js?1644506469></script>
<script src=/js/clipboard.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644600600></script>
<script src=/js/jquery.svg.pan.zoom.js?1644600600></script>
<script src=/js/featherlight.min.js?1644600600></script>
<script src=/js/modernizr.custom-3.6.0.js?1644600600></script>
<script src=/js/relearn.js?1644600600></script>
</body>
</html>

View file

@ -5,16 +5,16 @@
<meta name=generator content="Hugo 0.92.1">
<meta name=description content>
<title>Unreachable Code :: AL Guidelines</title>
<link href=/css/nucleus.css?1644506469 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644506469 rel=stylesheet>
<link href=/css/featherlight.min.css?1644506469 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644506469 rel=stylesheet>
<link href=/css/auto-complete.css?1644506469 rel=stylesheet>
<link href=/css/theme.css?1644506469 rel=stylesheet>
<link href=/css/theme-blue.css?1644506469 rel=stylesheet>
<link href=/css/variant.css?1644506469 rel=stylesheet>
<link href=/css/print.css?1644506469 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644506469></script>
<link href=/css/nucleus.css?1644600600 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644600600 rel=stylesheet>
<link href=/css/featherlight.min.css?1644600600 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644600600 rel=stylesheet>
<link href=/css/auto-complete.css?1644600600 rel=stylesheet>
<link href=/css/theme.css?1644600600 rel=stylesheet>
<link href=/css/theme-blue.css?1644600600 rel=stylesheet>
<link href=/css/variant.css?1644600600 rel=stylesheet>
<link href=/css/print.css?1644600600 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644600600></script>
<style>:root #header+#content>#left>#rlblock_left{display:none!important}</style>
</head>
<body data-url=/navpatterns/3-cal-coding-guidelines/design/unreachable-code/>
@ -32,9 +32,9 @@ ALGuidelines.Dev
<input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span>
</div>
<script src=/js/lunr.min.js?1644506469></script>
<script src=/js/auto-complete.js?1644506469></script>
<script src=/js/search.js?1644506469></script>
<script src=/js/lunr.min.js?1644600600></script>
<script src=/js/auto-complete.js?1644600600></script>
<script src=/js/search.js?1644600600></script>
</div>
<div class=highlightable>
<ul class=topics>
@ -258,17 +258,17 @@ ALGuidelines.Dev
<p>Do not write code that will never be hit.</p>
<p>It affects code readability and can lead to wrong assumptions.</p>
<p>Bad code</p>
<pre><code>IF Type &lt;\&gt; Type::FIELD THEN BEGIN
...
ERROR(...);
RecRef.CLOSE;
<pre><code>IF Type &lt;&gt; Type::FIELD THEN BEGIN
...
ERROR(...);
RecRef.CLOSE;
END;
</code></pre>
<p>Good code</p>
<pre><code>IF Type &lt;\&gt; Type::FIELD THEN BEGIN
...
RecRef.CLOSE;
ERROR(...);
<pre><code>IF Type &lt;&gt; Type::FIELD THEN BEGIN
...
RecRef.CLOSE;
ERROR(...);
END;
</code></pre>
<footer class=footline>
@ -283,12 +283,12 @@ END;
<div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px>
<div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div>
</div>
<script src=/js/clipboard.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644506469></script>
<script src=/js/jquery.svg.pan.zoom.js?1644506469></script>
<script src=/js/featherlight.min.js?1644506469></script>
<script src=/js/modernizr.custom-3.6.0.js?1644506469></script>
<script src=/js/relearn.js?1644506469></script>
<script src=/js/clipboard.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644600600></script>
<script src=/js/jquery.svg.pan.zoom.js?1644600600></script>
<script src=/js/featherlight.min.js?1644600600></script>
<script src=/js/modernizr.custom-3.6.0.js?1644600600></script>
<script src=/js/relearn.js?1644600600></script>
</body>
</html>

View file

@ -5,16 +5,16 @@
<meta name=generator content="Hugo 0.92.1">
<meta name=description content>
<title>Unused Initialized Variables :: AL Guidelines</title>
<link href=/css/nucleus.css?1644506469 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644506469 rel=stylesheet>
<link href=/css/featherlight.min.css?1644506469 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644506469 rel=stylesheet>
<link href=/css/auto-complete.css?1644506469 rel=stylesheet>
<link href=/css/theme.css?1644506469 rel=stylesheet>
<link href=/css/theme-blue.css?1644506469 rel=stylesheet>
<link href=/css/variant.css?1644506469 rel=stylesheet>
<link href=/css/print.css?1644506469 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644506469></script>
<link href=/css/nucleus.css?1644600600 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644600600 rel=stylesheet>
<link href=/css/featherlight.min.css?1644600600 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644600600 rel=stylesheet>
<link href=/css/auto-complete.css?1644600600 rel=stylesheet>
<link href=/css/theme.css?1644600600 rel=stylesheet>
<link href=/css/theme-blue.css?1644600600 rel=stylesheet>
<link href=/css/variant.css?1644600600 rel=stylesheet>
<link href=/css/print.css?1644600600 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644600600></script>
<style>:root #header+#content>#left>#rlblock_left{display:none!important}</style>
</head>
<body data-url=/navpatterns/3-cal-coding-guidelines/design/unused-initialized-variables/>
@ -32,9 +32,9 @@ ALGuidelines.Dev
<input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span>
</div>
<script src=/js/lunr.min.js?1644506469></script>
<script src=/js/auto-complete.js?1644506469></script>
<script src=/js/search.js?1644506469></script>
<script src=/js/lunr.min.js?1644600600></script>
<script src=/js/auto-complete.js?1644600600></script>
<script src=/js/search.js?1644600600></script>
</div>
<div class=highlightable>
<ul class=topics>
@ -257,34 +257,34 @@ ALGuidelines.Dev
<h1>Unused Initialized Variables</h1>
<p>The value assigned to a variable must be used. Else the variable is not necessary.</p>
<p>Bad code</p>
<pre><code>PROCEDURE AddEntities@1(FilterStr@1000 : Text\[250\]);
<pre><code>PROCEDURE AddEntities@1(FilterStr@1000 : Text[250]);
VAR
Vendor@1001 : Record 23;
Count@1002 : Integer;
Vendor@1001 : Record 23;
Count@1002 : Integer;
BEGIN
Count := 0;
Vendor.SETFILTER(&quot;No.&quot;,FilterStr);
IF Vendor.FINDSET THEN
REPEAT
&quot;User ID&quot; := USERID;
&quot;Vendor No.&quot; := Vendor.&quot;No.&quot;;
IF INSERT THEN
Count += 1;
UNTIL Vendor.NEXT = 0;
Count := 0;
Vendor.SETFILTER(&quot;No.&quot;,FilterStr);
IF Vendor.FINDSET THEN
REPEAT
&quot;User ID&quot; := USERID;
&quot;Vendor No.&quot; := Vendor.&quot;No.&quot;;
IF INSERT THEN
Count += 1;
UNTIL Vendor.NEXT = 0;
END;
</code></pre>
<p>Good code</p>
<pre><code>PROCEDURE AddEntities@1(FilterStr@1000 : Text\[250\]);
<pre><code>PROCEDURE AddEntities@1(FilterStr@1000 : Text[250]);
VAR
Vendor@1001 : Record 23;
Vendor@1001 : Record 23;
BEGIN
Vendor.SETFILTER(&quot;No.&quot;,FilterStr);
IF Vendor.FINDSET THEN
REPEAT
&quot;User ID&quot; := USERID;
&quot;Vendor No.&quot; := Vendor.&quot;No.&quot;;
IF INSERT THEN;
UNTIL Vendor.NEXT = 0;
Vendor.SETFILTER(&quot;No.&quot;,FilterStr);
IF Vendor.FINDSET THEN
REPEAT
&quot;User ID&quot; := USERID;
&quot;Vendor No.&quot; := Vendor.&quot;No.&quot;;
IF INSERT THEN;
UNTIL Vendor.NEXT = 0;
END;
</code></pre>
<footer class=footline>
@ -299,12 +299,12 @@ END;
<div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px>
<div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div>
</div>
<script src=/js/clipboard.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644506469></script>
<script src=/js/jquery.svg.pan.zoom.js?1644506469></script>
<script src=/js/featherlight.min.js?1644506469></script>
<script src=/js/modernizr.custom-3.6.0.js?1644506469></script>
<script src=/js/relearn.js?1644506469></script>
<script src=/js/clipboard.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644600600></script>
<script src=/js/jquery.svg.pan.zoom.js?1644600600></script>
<script src=/js/featherlight.min.js?1644600600></script>
<script src=/js/modernizr.custom-3.6.0.js?1644600600></script>
<script src=/js/relearn.js?1644600600></script>
</body>
</html>

View file

@ -5,16 +5,16 @@
<meta name=generator content="Hugo 0.92.1">
<meta name=description content>
<title>Unused Variables :: AL Guidelines</title>
<link href=/css/nucleus.css?1644506469 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644506469 rel=stylesheet>
<link href=/css/featherlight.min.css?1644506469 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644506469 rel=stylesheet>
<link href=/css/auto-complete.css?1644506469 rel=stylesheet>
<link href=/css/theme.css?1644506469 rel=stylesheet>
<link href=/css/theme-blue.css?1644506469 rel=stylesheet>
<link href=/css/variant.css?1644506469 rel=stylesheet>
<link href=/css/print.css?1644506469 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644506469></script>
<link href=/css/nucleus.css?1644600600 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644600600 rel=stylesheet>
<link href=/css/featherlight.min.css?1644600600 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644600600 rel=stylesheet>
<link href=/css/auto-complete.css?1644600600 rel=stylesheet>
<link href=/css/theme.css?1644600600 rel=stylesheet>
<link href=/css/theme-blue.css?1644600600 rel=stylesheet>
<link href=/css/variant.css?1644600600 rel=stylesheet>
<link href=/css/print.css?1644600600 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644600600></script>
<style>:root #header+#content>#left>#rlblock_left{display:none!important}</style>
</head>
<body data-url=/navpatterns/3-cal-coding-guidelines/design/unused-variables/>
@ -32,9 +32,9 @@ ALGuidelines.Dev
<input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span>
</div>
<script src=/js/lunr.min.js?1644506469></script>
<script src=/js/auto-complete.js?1644506469></script>
<script src=/js/search.js?1644506469></script>
<script src=/js/lunr.min.js?1644600600></script>
<script src=/js/auto-complete.js?1644600600></script>
<script src=/js/search.js?1644600600></script>
</div>
<div class=highlightable>
<ul class=topics>
@ -258,36 +258,36 @@ ALGuidelines.Dev
<p>Do not declare variables that are unused.</p>
<p>Unused variables affect readability.</p>
<p>Bad code</p>
<pre><code>PROCEDURE CheckPostingDate@23(CaptionEntryNo@1005 : Text\[50\]);
<pre><code>PROCEDURE CheckPostingDate@23(CaptionEntryNo@1005 : Text[50]);
BEGIN
IF GenJnlCheckLine.DateNotAllowed(PostingDate) THEN
ERROR(DateNotAllowedErr,Caption,EntryNo)
IF PostingDate \&gt; MaxPostingDate THEN
MaxPostingDate := PostingDate;
IF GenJnlCheckLine.DateNotAllowed(PostingDate) THEN
ERROR(DateNotAllowedErr,Caption,EntryNo)
IF PostingDate &gt; MaxPostingDate THEN
MaxPostingDate := PostingDate;
END
</code></pre>
<p>Good code</p>
<pre><code>PROCEDURE CheckPostingDate@23();
BEGIN
IF GenJnlCheckLine.DateNotAllowed(PostingDate) THEN
ERROR(DateNotAllowedErr,Caption,EntryNo);
IF PostingDate \&gt; MaxPostingDate THEN
MaxPostingDate := PostingDate;
IF GenJnlCheckLine.DateNotAllowed(PostingDate) THEN
ERROR(DateNotAllowedErr,Caption,EntryNo);
IF PostingDate &gt; MaxPostingDate THEN
MaxPostingDate := PostingDate;
END;
</code></pre>
<p>Bad code</p>
<pre><code>PROCEDURE IsReturned@14(EntryNo@1002 : Integer) : Decimal;
VAR
ItemEntry@1000 : Record 32;
Quantity@1003 : Integer;
ItemEntry@1000 : Record 32;
Quantity@1003 : Integer;
BEGIN
EXIT(-OutboundApplied(EntryNo,TRUE) - InboundApplied(EntryNo,TRUE));
EXIT(-OutboundApplied(EntryNo,TRUE) - InboundApplied(EntryNo,TRUE));
END;
</code></pre>
<p>Good code</p>
<pre><code>PROCEDURE IsReturned@14(EntryNo@1002 : Integer) : Decimal;
BEGIN
EXIT(-OutboundApplied(EntryNo,TRUE) - InboundApplied(EntryNo,TRUE));
EXIT(-OutboundApplied(EntryNo,TRUE) - InboundApplied(EntryNo,TRUE));
END;
</code></pre>
<footer class=footline>
@ -302,12 +302,12 @@ END;
<div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px>
<div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div>
</div>
<script src=/js/clipboard.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644506469></script>
<script src=/js/jquery.svg.pan.zoom.js?1644506469></script>
<script src=/js/featherlight.min.js?1644506469></script>
<script src=/js/modernizr.custom-3.6.0.js?1644506469></script>
<script src=/js/relearn.js?1644506469></script>
<script src=/js/clipboard.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644600600></script>
<script src=/js/jquery.svg.pan.zoom.js?1644600600></script>
<script src=/js/featherlight.min.js?1644600600></script>
<script src=/js/modernizr.custom-3.6.0.js?1644600600></script>
<script src=/js/relearn.js?1644600600></script>
</body>
</html>

View file

@ -5,16 +5,16 @@
<meta name=generator content="Hugo 0.92.1">
<meta name=description content>
<title>Variable Capacity Mismatch :: AL Guidelines</title>
<link href=/css/nucleus.css?1644506469 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644506469 rel=stylesheet>
<link href=/css/featherlight.min.css?1644506469 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644506469 rel=stylesheet>
<link href=/css/auto-complete.css?1644506469 rel=stylesheet>
<link href=/css/theme.css?1644506469 rel=stylesheet>
<link href=/css/theme-blue.css?1644506469 rel=stylesheet>
<link href=/css/variant.css?1644506469 rel=stylesheet>
<link href=/css/print.css?1644506469 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644506469></script>
<link href=/css/nucleus.css?1644600600 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644600600 rel=stylesheet>
<link href=/css/featherlight.min.css?1644600600 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644600600 rel=stylesheet>
<link href=/css/auto-complete.css?1644600600 rel=stylesheet>
<link href=/css/theme.css?1644600600 rel=stylesheet>
<link href=/css/theme-blue.css?1644600600 rel=stylesheet>
<link href=/css/variant.css?1644600600 rel=stylesheet>
<link href=/css/print.css?1644600600 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644600600></script>
<style>:root #header+#content>#left>#rlblock_left{display:none!important}</style>
</head>
<body data-url=/navpatterns/3-cal-coding-guidelines/design/variable-capacity-mismatch/>
@ -32,9 +32,9 @@ ALGuidelines.Dev
<input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span>
</div>
<script src=/js/lunr.min.js?1644506469></script>
<script src=/js/auto-complete.js?1644506469></script>
<script src=/js/search.js?1644506469></script>
<script src=/js/lunr.min.js?1644600600></script>
<script src=/js/auto-complete.js?1644600600></script>
<script src=/js/search.js?1644600600></script>
</div>
<div class=highlightable>
<ul class=topics>
@ -258,50 +258,50 @@ ALGuidelines.Dev
<p>Do not assign a value to a variable whose capacity is smaller.</p>
<p>It will throw an error at runtime.</p>
<p>Bad code</p>
<pre><code>FileName@1010 : Text\[250\];
<pre><code>FileName@1010 : Text[250];
...
UploadedFileName@1016 : Text\[1024\];
UploadedFileName@1016 : Text[1024];
...
FileName := UploadedFileName;
</code></pre>
<p>Good code</p>
<pre><code>FileName@1010 : Text\[1024\];
<pre><code>FileName@1010 : Text[1024];
...
UploadedFileName@1016 : Text\[1024\];
UploadedFileName@1016 : Text[1024];
...
FileName := UploadedFileName;
</code></pre>
<p>Bad code</p>
<pre><code>FileName@1010 : Text\[250\];
<pre><code>FileName@1010 : Text[250];
...
UploadedFileName@1016 : Text\[1024\];
UploadedFileName@1016 : Text[1024];
...
FileName := UploadedFileName;
</code></pre>
<p>Good code</p>
<pre><code>FileName@1010 : Text\[250\];
<pre><code>FileName@1010 : Text[250];
...
UploadedFileName@1016 : Text\[1024\];
UploadedFileName@1016 : Text[1024];
...
FileName := COPYSTR(UploadedFileName,1,250); // In case only the first 250 chars are needed. Similar for fields
</code></pre>
<p>Bad code</p>
<pre><code>VAR
ExceededNumberTxt@001 : 'ENU=Warning: Exceeded number of unsent documents/requests'
Subject@1002 : Text\[50\];
...
ExceededNumberTxt@001 : 'ENU=Warning: Exceeded number of unsent documents/requests'
Subject@1002 : Text[50];
...
BEGIN
...
Subject := ExceededNumberTxt;
...
Subject := ExceededNumberTxt;
</code></pre>
<p>Good code</p>
<pre><code>VAR
ExceededNumberTxt@001 : 'ENU=Warning: Exceeded number of unsent documents/requests'
Subject@1002 : Text\[100\];
...
ExceededNumberTxt@001 : 'ENU=Warning: Exceeded number of unsent documents/requests'
Subject@1002 : Text[100];
...
BEGIN
...
Subject := ExceededNumberTxt';
...
Subject := ExceededNumberTxt';
</code></pre>
<footer class=footline>
</footer>
@ -315,12 +315,12 @@ Subject := ExceededNumberTxt';
<div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px>
<div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div>
</div>
<script src=/js/clipboard.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644506469></script>
<script src=/js/jquery.svg.pan.zoom.js?1644506469></script>
<script src=/js/featherlight.min.js?1644506469></script>
<script src=/js/modernizr.custom-3.6.0.js?1644506469></script>
<script src=/js/relearn.js?1644506469></script>
<script src=/js/clipboard.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644600600></script>
<script src=/js/jquery.svg.pan.zoom.js?1644600600></script>
<script src=/js/featherlight.min.js?1644600600></script>
<script src=/js/modernizr.custom-3.6.0.js?1644600600></script>
<script src=/js/relearn.js?1644600600></script>
</body>
</html>

View file

@ -5,16 +5,16 @@
<meta name=generator content="Hugo 0.92.1">
<meta name=description content>
<title>WITH Scope Name Collision :: AL Guidelines</title>
<link href=/css/nucleus.css?1644506469 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644506469 rel=stylesheet>
<link href=/css/featherlight.min.css?1644506469 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644506469 rel=stylesheet>
<link href=/css/auto-complete.css?1644506469 rel=stylesheet>
<link href=/css/theme.css?1644506469 rel=stylesheet>
<link href=/css/theme-blue.css?1644506469 rel=stylesheet>
<link href=/css/variant.css?1644506469 rel=stylesheet>
<link href=/css/print.css?1644506469 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644506469></script>
<link href=/css/nucleus.css?1644600600 rel=stylesheet>
<link href=/css/fontawesome-all.min.css?1644600600 rel=stylesheet>
<link href=/css/featherlight.min.css?1644600600 rel=stylesheet>
<link href=/css/perfect-scrollbar.min.css?1644600600 rel=stylesheet>
<link href=/css/auto-complete.css?1644600600 rel=stylesheet>
<link href=/css/theme.css?1644600600 rel=stylesheet>
<link href=/css/theme-blue.css?1644600600 rel=stylesheet>
<link href=/css/variant.css?1644600600 rel=stylesheet>
<link href=/css/print.css?1644600600 rel=stylesheet media=print>
<script src=/js/jquery.min.js?1644600600></script>
<style>:root #header+#content>#left>#rlblock_left{display:none!important}</style>
</head>
<body data-url=/navpatterns/3-cal-coding-guidelines/design/with-scope-name-collision/>
@ -32,9 +32,9 @@ ALGuidelines.Dev
<input data-search-input id=search-by type=search placeholder=Search...>
<span data-search-clear><i class="fas fa-times"></i></span>
</div>
<script src=/js/lunr.min.js?1644506469></script>
<script src=/js/auto-complete.js?1644506469></script>
<script src=/js/search.js?1644506469></script>
<script src=/js/lunr.min.js?1644600600></script>
<script src=/js/auto-complete.js?1644600600></script>
<script src=/js/search.js?1644600600></script>
</div>
<div class=highlightable>
<ul class=topics>
@ -256,25 +256,26 @@ ALGuidelines.Dev
<main id=body-inner>
<h1>WITH Scope Name Collision</h1>
<p>Do not use the WITH scope when it has a variable whose name is the same as a local variable. This can lead to wrong code assumptions.</p>
<p><strong>Given that</strong> &ldquo;Contract Type&rdquo; is a field on table ServiceContractHeader, then in the following example there is a parameter name clash with the field name. Which one will be used?</p>
<p><strong>Given that</strong> <br>
&ldquo;Contract Type&rdquo; is a field on table ServiceContractHeader, then in the following example there is a parameter name clash with the field name. Which one will be used?</p>
<p>Bad code</p>
<pre><code>PROCEDURE InsertData@1(&quot;Contract Type&quot;@1000 : Option...);
...
BEGIN
...
WITH ServiceContractHeader DO BEGIN
...
DimMgt.InsertServContractDim(...,&quot;Contract Type&quot;,&quot;Contract No.&quot;,0,...);
...
WITH ServiceContractHeader DO BEGIN
...
DimMgt.InsertServContractDim(...,&quot;Contract Type&quot;,&quot;Contract No.&quot;,0,...);
END;
</code></pre>
<p>Good code</p>
<pre><code>PROCEDURE InsertData@1(ContractType@1000 : Option...);
...
BEGIN
...
WITH ServiceContractHeader DO BEGIN
...
DimMgt.InsertServContractDim(...,ContractType,&quot;Contract No.&quot;,0,...);
...
WITH ServiceContractHeader DO BEGIN
...
DimMgt.InsertServContractDim(...,ContractType,&quot;Contract No.&quot;,0,...);
END;
</code></pre>
<footer class=footline>
@ -289,12 +290,12 @@ END;
<div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px>
<div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div>
</div>
<script src=/js/clipboard.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.min.js?1644506469></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644506469></script>
<script src=/js/jquery.svg.pan.zoom.js?1644506469></script>
<script src=/js/featherlight.min.js?1644506469></script>
<script src=/js/modernizr.custom-3.6.0.js?1644506469></script>
<script src=/js/relearn.js?1644506469></script>
<script src=/js/clipboard.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.min.js?1644600600></script>
<script src=/js/perfect-scrollbar.jquery.min.js?1644600600></script>
<script src=/js/jquery.svg.pan.zoom.js?1644600600></script>
<script src=/js/featherlight.min.js?1644600600></script>
<script src=/js/modernizr.custom-3.6.0.js?1644600600></script>
<script src=/js/relearn.js?1644600600></script>
</body>
</html>