diff --git a/assets/icons/logo.png b/assets/icons/logo.png deleted file mode 100644 index 92fced3e..00000000 Binary files a/assets/icons/logo.png and /dev/null differ diff --git a/assets/scss/_styles_project.scss b/assets/scss/_styles_project.scss index 78520674..e165c6a4 100644 --- a/assets/scss/_styles_project.scss +++ b/assets/scss/_styles_project.scss @@ -1,2 +1,7 @@ .td-page-meta--child { display: none !important; } -.td-page-meta--project-issue { display: none !important; } \ No newline at end of file +.td-page-meta--project-issue { display: none !important; } + +.td-content pre code { + font-family: Consolas, "Courier New", monospace; + size: 115%; +} \ No newline at end of file diff --git a/content/Discussions/_index.md b/content/Discussions/_index.md deleted file mode 100644 index 6fdaeb1d..00000000 --- a/content/Discussions/_index.md +++ /dev/null @@ -1,21 +0,0 @@ -+++ -chapter = true -pre = " " -title = "Discussions" -weight = 200 -+++ - -# [Discussions](https://github.com/microsoft/alguidelines/discussions) - -We enabled the "Discussions" forum on the github-page of our repository for you to discuss anything "Design Pattern" or "Best Practices" related. - -You can find the discussions here: https://github.com/microsoft/alguidelines/discussions. - -Feel free to browse through them, find certain topics and/or participate in the discussions! - -## Create your own discussion - -You are obviously also free to start a new discussion. You can simply do that by using the "New Discussion" button on the top right. - -Or use this link: https://github.com/microsoft/alguidelines/discussions/new?category=bc-patterns - diff --git a/content/docs/BestPractices/DeleteAll/index.md b/content/docs/BestPractices/DeleteAll/index.md index 802d1e2d..3ed623a5 100644 --- a/content/docs/BestPractices/DeleteAll/index.md +++ b/content/docs/BestPractices/DeleteAll/index.md @@ -1,10 +1,10 @@ --- title: "DeleteAll" -tags: ["Performance"] +tags: ["AL","Performance"] categories: ["Best Practice"] --- -<_Created by waldo, Described by waldo_\> +_Created by waldo, Described by waldo_ ## Description @@ -25,11 +25,3 @@ Therefore it's good practice to always check if the table is empty when performi if not EmptyTableWLD.IsEmpty() then EmptyTableWLD.DeleteAll(true); ``` - -## Discussions - -You can discuss the guideline [here](https://github.com/microsoft/alguidelines/discussions/107) - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). - -If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. \ No newline at end of file diff --git a/content/docs/BestPractices/SubscriberCodeunits/index.md b/content/docs/BestPractices/SubscriberCodeunits/index.md index 2aadfa54..8c03a40b 100644 --- a/content/docs/BestPractices/SubscriberCodeunits/index.md +++ b/content/docs/BestPractices/SubscriberCodeunits/index.md @@ -1,6 +1,6 @@ --- title: "Subscriber Codeunits" -tags: ["Performance"] +tags: ["AL","Performance"] categories: ["Best Practice"] --- @@ -18,15 +18,18 @@ In general, subscribers have to be put in codeunits. There are a few performanc Let's discuss all points ## Keep the codeunit as small as possible + Every time a subscriber gets called, a new instance of the codeunit is being loaded in memory, which takes memory and processing power. The smaller the codeunit, the less memory, and the faster it is. Therefore, it's suggested to split the subscribers by functionality and avoid putting business logic in the actual codeunit. Tip: put all business logic in an "[Method Codeunit](https://alguidelines.dev/bcpatterns/generic-method-pattern/)". Examples: + - if you app does things on Sales and Purchase, create a Sales-subs codeunit, and a Purchase-subs. - if you have multiple functionalities in your app (let's call'm modules), create a subs-codeunit per module, and only add the subscribers in there that are necessary for that module. ### Bad code + ```AL codeunit 2037325 "Setup Subs" { @@ -73,6 +76,7 @@ codeunit 2037325 "Setup Subs" end; } ``` + ### Good code Split into 2 codeunits, and move the business logic out. @@ -112,6 +116,7 @@ codeunit 2037324 "RHE Setup Subs" To avoid the extra "loading of the content" while a subscriber is being executed, use Single Instance codeunit for subscribers. Do take into account, of course, that it would share the state across the entire session. ### Bad code + ```AL codeunit 2037324 "RHE Setup Subs" { @@ -124,7 +129,9 @@ codeunit 2037324 "RHE Setup Subs" end; } ``` + ### Good code + ```AL codeunit 2037324 "RHE Setup Subs" { @@ -145,6 +152,7 @@ codeunit 2037324 "RHE Setup Subs" If possible, only execute the subscriber when really necessary by using Manual Binding. ### Bad code + ```AL //subscriber - code should actually only run when Color=Red. [EventSubscriber(ObjectType::Table, Database::"Just Some Table WLD", 'OnAfterValidateEvent', 'Message 2', false, false)] @@ -162,7 +170,9 @@ If possible, only execute the subscriber when really necessary by using Manual B JustSomeTable.Validate("Message 2", format(Random(1000))); until JustSomeTable.Next() < 1; ``` + ### Good code + ```AL if JustSomeTable.FindSet() then repeat @@ -177,21 +187,15 @@ If possible, only execute the subscriber when really necessary by using Manual B ``` ## Avoid OnInsert/OnModify/OnDelete + The reason for this is, that it breaks the batch-calls: + - Any "OnInsert" subscriber breaks the bulk inserts, simply because it needs to perform an operation after every record that was inserted - Any "OnModify" subscriber slows down the "ModifyAll", simply because it needs to perform an operation after every record that was modified. I fact: 1 SQL call is turned into a loop of SQL calls. - Any "OnDelete" subscriber slows down the "DeleteAll", simply because it needs to perform an operation after every record that was deleted. I fact: 1 SQL call is turned into a loop of SQL calls. Avoid subscribers to these events. -## [Discussions](https://github.com/microsoft/alguidelines/discussions/92) - -You can discuss this guidelines [here](https://github.com/microsoft/alguidelines/discussions/92). - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). - -If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. - ## References The [Generic Method Pattern](https://alguidelines.dev/bcpatterns/generic-method-pattern/) \ No newline at end of file diff --git a/content/docs/BestPractices/_index.md b/content/docs/BestPractices/_index.md index 698e2846..9684d0df 100644 --- a/content/docs/BestPractices/_index.md +++ b/content/docs/BestPractices/_index.md @@ -5,8 +5,6 @@ description: > AL Code Best Practices --- -# Business Central Best Practices - This section will be cover things that aren't as simple as Design Patterns, but will help make sure your development is: - high-performance diff --git a/content/docs/BestPractices/begin-as-an-afterword/index.md b/content/docs/BestPractices/begin-as-an-afterword/index.md index 6a48008c..5ad547bd 100644 --- a/content/docs/BestPractices/begin-as-an-afterword/index.md +++ b/content/docs/BestPractices/begin-as-an-afterword/index.md @@ -1,6 +1,6 @@ --- title: "begin as an afterword" -tags: ["Readability"] +tags: ["AL","Readability"] categories: ["Best Practice"] --- @@ -27,8 +27,3 @@ When `begin` follows `then`, `else`, `do`, it should be on the same line, preced end; ``` -## Discussion - -Discuss this Best Practice [here](https://github.com/microsoft/alguidelines/discussions/123) - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). diff --git a/content/docs/BestPractices/begin-end/index.md b/content/docs/BestPractices/begin-end/index.md index 22433d65..9547b703 100644 --- a/content/docs/BestPractices/begin-end/index.md +++ b/content/docs/BestPractices/begin-end/index.md @@ -1,6 +1,6 @@ --- title: "Begin-End - Compound Only" -tags: ["Readability"] +tags: ["AL","Readability"] categories: ["Best Practice"] --- @@ -53,8 +53,3 @@ end else (not X) ``` -## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=begin+end+compound+only+category%3A%22BC+Best+Practices%22) - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). - -If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. diff --git a/content/docs/BestPractices/binary-operator-line-start/index.md b/content/docs/BestPractices/binary-operator-line-start/index.md index 7408ef63..d545a46c 100644 --- a/content/docs/BestPractices/binary-operator-line-start/index.md +++ b/content/docs/BestPractices/binary-operator-line-start/index.md @@ -1,6 +1,6 @@ --- title: "Binary Operator to Start Line" -tags: ["Readability"] +tags: ["AL","Readability"] categories: ["Best Practice"] --- @@ -25,9 +25,3 @@ Quantity Quantity - "Quantity Shipped" ``` - -## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=binary+operator+to+start+line+category%3A%22BC+Best+Practices%22) - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). - -If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. diff --git a/content/docs/BestPractices/case-actions/index.md b/content/docs/BestPractices/case-actions/index.md index fb041368..5062e53e 100644 --- a/content/docs/BestPractices/case-actions/index.md +++ b/content/docs/BestPractices/case-actions/index.md @@ -1,6 +1,6 @@ --- title: "CASE Action on next line" -tags: ["Readability"] +tags: ["AL","Readability"] categories: ["Best Practice"] --- @@ -8,7 +8,7 @@ _Created by Microsoft, Described by waldo_ ## Description -A CASE action should start on a line after the possibility. +A CASE action should start on a line after the possibility. ## Bad code @@ -29,9 +29,3 @@ A CASE action should start on a line after the possibility. Letter2 := '11'; end; ``` - -## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=case+action+on+next+line+category%3A%22BC+Best+Practices%22) - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). - -If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. diff --git a/content/docs/BestPractices/comments-spacing/index.md b/content/docs/BestPractices/comments-spacing/index.md index e8e2c07f..615f9e69 100644 --- a/content/docs/BestPractices/comments-spacing/index.md +++ b/content/docs/BestPractices/comments-spacing/index.md @@ -1,12 +1,13 @@ --- title: "Comment Spacing" -tags: ["Readability"] +tags: ["AL","Readability"] categories: ["Best Practice"] --- _Created by Microsoft, Described by waldo_ ## Description + Always start comments with // followed by one space character. ## Bad code @@ -14,16 +15,9 @@ Always start comments with // followed by one space character. ```al RowNo += 1000; //Move way below the budget ``` - - + ## Good code ```al RowNo += 1000; // Move way below the budget ``` - -## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=comment+spacing+category%3A%22BC+Best+Practices%22) - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). - -If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. \ No newline at end of file diff --git a/content/docs/BestPractices/end-else-pair/index.md b/content/docs/BestPractices/end-else-pair/index.md index 9c339d36..98aa85c2 100644 --- a/content/docs/BestPractices/end-else-pair/index.md +++ b/content/docs/BestPractices/end-else-pair/index.md @@ -1,6 +1,6 @@ --- title: "end else pair" -tags: ["Readability"] +tags: ["AL","Readability"] categories: ["Best Practice"] --- @@ -33,9 +33,3 @@ The `end else` pair should always appear on the same line. ... end; ``` - -## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=end+else/pair+category%3A%22BC+Best+Practices%22) - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). - -If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. diff --git a/content/docs/BestPractices/keyword-pairs-indentation/index.md b/content/docs/BestPractices/keyword-pairs-indentation/index.md index 625310f4..b25ea498 100644 --- a/content/docs/BestPractices/keyword-pairs-indentation/index.md +++ b/content/docs/BestPractices/keyword-pairs-indentation/index.md @@ -1,12 +1,13 @@ --- title: "Keyword Pairs - Indentation" -tags: ["Readability"] +tags: ["AL","Readability"] categories: ["Best Practice"] --- _Created by Microsoft, Described by waldo_ ## Description + The `if..then` pair, `while..do` pair, and `for..do` pair must appear on the same line or the same level of indentation. If possible, you can align the lines it is even much more readable. ## Bad code @@ -23,9 +24,3 @@ The `if..then` pair, `while..do` pair, and `for..do` pair must appear on the sam (a = b) then ``` - -## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=keyword+pair+indentation+category%3A%22BC+Best+Practices%22) - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). - -If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. \ No newline at end of file diff --git a/content/docs/BestPractices/line-start-keywords/index.md b/content/docs/BestPractices/line-start-keywords/index.md index 51cee4ee..113e587c 100644 --- a/content/docs/BestPractices/line-start-keywords/index.md +++ b/content/docs/BestPractices/line-start-keywords/index.md @@ -1,11 +1,12 @@ --- title: "Line Start Keywords" -tags: ["Readability"] +tags: ["AL","Readability"] categories: ["Best Practice"] --- -<_Created by Microsoft, Described by waldo_\> +_Created by Microsoft, Described by waldo_ ## Description + The `end`, `if`, `repeat`, `for`, `while`, `else` and `case` statement should always start a line. ## Bad code @@ -28,10 +29,3 @@ The `end`, `if`, `repeat`, `for`, `while`, `else` and `case` statement should al if IsSalesCycleCode then ValidatSalesCycleCode(); ``` - - -## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=line+start+keyword+category%3A%22BC+Best+Practices%22) - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). - -If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. \ No newline at end of file diff --git a/content/docs/BestPractices/lonely-repeat/index.md b/content/docs/BestPractices/lonely-repeat/index.md index 87551a9e..d15c0945 100644 --- a/content/docs/BestPractices/lonely-repeat/index.md +++ b/content/docs/BestPractices/lonely-repeat/index.md @@ -1,12 +1,13 @@ --- title: "Lonely Repeat" -tags: ["Readability"] +tags: ["AL","Readability"] categories: ["Best Practice"] --- _Created by Microsoft, Described by waldo_ ## Description + The `repeat` statement should always be alone on a line. ## Bad code @@ -14,16 +15,10 @@ The `repeat` statement should always be alone on a line. ```al if ReservEntry.FindSet() then repeat ``` - + ## Good code ```al if ReservEntry.FindSet() then repeat ``` - -## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=lonely+repeat+category%3A%22BC+Best+Practices%22) - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). - -If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. \ No newline at end of file diff --git a/content/docs/BestPractices/named-invocations/index.md b/content/docs/BestPractices/named-invocations/index.md index 9d817731..2aa77cc1 100644 --- a/content/docs/BestPractices/named-invocations/index.md +++ b/content/docs/BestPractices/named-invocations/index.md @@ -1,12 +1,13 @@ --- title: "Named Invocations" -tags: ["Readability"] +tags: ["AL","Readability"] categories: ["Best Practice"] --- _Created by Microsoft, Described by waldo_ ## Description + When calling an object statically use the Object Name, not the Object Id. ## Bad code @@ -20,9 +21,3 @@ When calling an object statically use the Object Name, not the Object Id. ```al Page.RunModal(Page::"Posted Sales Shipment Lines", SalesShptLine); ``` - -## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=named+invocations+category%3A%22BC+Best+Practices%22) - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). - -If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. diff --git a/content/docs/BestPractices/one-statement-per-line/index.md b/content/docs/BestPractices/one-statement-per-line/index.md index a8508ff5..4bc36b72 100644 --- a/content/docs/BestPractices/one-statement-per-line/index.md +++ b/content/docs/BestPractices/one-statement-per-line/index.md @@ -1,34 +1,33 @@ --- title: "One Statement per Line" -tags: ["Readability"] +tags: ["AL","Readability"] categories: ["Best Practice"] --- _Created by Microsoft, Described by waldo_ ## Description + A line of code should not have more than one statement. ## Bad code ```al if OppEntry.Find('-') then exit; -``` - +``` ## Good code ```al if OppEntry.Find('-') then exit; -``` - +``` + ## Bad code ```al TotalCost += Cost; TotalAmt += Amt; -``` - +``` ## Good code @@ -36,9 +35,3 @@ A line of code should not have more than one statement. TotalCost += Cost; TotalAmt += Amt; ``` - -## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=one+statement+per+line+category%3A%22BC+Best+Practices%22) - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). - -If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. diff --git a/content/docs/BestPractices/separate-if-and-else/index.md b/content/docs/BestPractices/separate-if-and-else/index.md index 0cfe515b..8e7aec4e 100644 --- a/content/docs/BestPractices/separate-if-and-else/index.md +++ b/content/docs/BestPractices/separate-if-and-else/index.md @@ -1,12 +1,13 @@ --- title: "Seperate if and else" -tags: ["Readability"] +tags: ["AL","Readability"] categories: ["Best Practice"] --- _Created by Microsoft, Described by waldo_ ## Description + `if` and `else` statements should be on separate lines. ## Bad code @@ -26,10 +27,3 @@ _Created by Microsoft, Described by waldo_ ... end; ``` - - -## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=separate+if+and+else+category%3A%22BC+Best+Practices%22) - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). - -If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. diff --git a/content/docs/BestPractices/spacing-binary-operators/index.md b/content/docs/BestPractices/spacing-binary-operators/index.md index 48bbbbe5..95b79808 100644 --- a/content/docs/BestPractices/spacing-binary-operators/index.md +++ b/content/docs/BestPractices/spacing-binary-operators/index.md @@ -1,46 +1,47 @@ --- title: "Spacing Binary Operators" -tags: ["Readability"] +tags: ["AL","Readability"] categories: ["Best Practice"] --- _Created by Microsoft, Described by waldo_ ## Description + There must be exactly one space character on each side of a binary operator such as = + - AND OR =. The parameter comma operator however, should have a space after the comma. ## Bad code ```al "Line Discount %" := "Line Discount Amount"/"Line Value"*100; -``` +``` ## Good code ```al "Line Discount %" := "Line Discount Amount" / "Line Value" * 100; -``` +``` ## Bad code ```al StartDate := CalcDate('<+'+Format(Days+i)+'D\>',StartDate); -``` +``` ## Good code ```al StartDate := CalcDate('<+' + Format(Days + i) + 'D\>', StartDate); -``` +``` ## Bad code ```al StartDate:=0D; // Initialize ``` - + ## Good code ```al StartDate := 0D; // Initialize -``` \ No newline at end of file +``` diff --git a/content/docs/BestPractices/suggested-abbreviations/index.md b/content/docs/BestPractices/suggested-abbreviations/index.md index 7ff5136d..722f1561 100644 --- a/content/docs/BestPractices/suggested-abbreviations/index.md +++ b/content/docs/BestPractices/suggested-abbreviations/index.md @@ -1,6 +1,6 @@ --- title: "Suggested Abbreviations" -tags: ["Readability"] +tags: ["AL","Readability"] categories: ["Best Practice"] --- @@ -359,9 +359,3 @@ If there is no other choice, then use the suggestions below. | % | Pct | | 3-tier | Three-Tier | | Outlook Synch | Osynch | - -## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=abbreviations+category%3A%22BC+Best+Practices%22) - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). - -If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. \ No newline at end of file diff --git a/content/docs/BestPractices/unnecessary-else/index.md b/content/docs/BestPractices/unnecessary-else/index.md index d190bfdf..4dd6d1bd 100644 --- a/content/docs/BestPractices/unnecessary-else/index.md +++ b/content/docs/BestPractices/unnecessary-else/index.md @@ -1,6 +1,6 @@ --- title: "Unnecessary else" -tags: ["Readability"] +tags: ["AL","Readability"] categories: ["Best Practice"] --- @@ -32,9 +32,3 @@ _Created by Microsoft, Described by waldo_ Error(BinCodeChangeNotAllowedErr, ...); end; ``` - -## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=unnecessary+else+category%3A%22BC+Best+Practices%22) - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). - -If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. diff --git a/content/docs/BestPractices/unnecessary-truefalse/index.md b/content/docs/BestPractices/unnecessary-truefalse/index.md index 8e020968..2950736f 100644 --- a/content/docs/BestPractices/unnecessary-truefalse/index.md +++ b/content/docs/BestPractices/unnecessary-truefalse/index.md @@ -1,6 +1,6 @@ --- title: "Unnecessary true/false" -tags: ["Readability"] +tags: ["AL","Readability"] categories: ["Best Practice"] --- @@ -13,29 +13,22 @@ Do not use `true` or `false` keywords unnecessarily if the expression is already ```al if IsPositive() = true then -``` - +``` + ## Good code ```al if IsPositive() then -``` - +``` ## Bad code ```al if Complete <> true then -``` - +``` + ## Good code ```al if not Complete then ``` - -## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=unnecessary+true+false+category%3A%22BC+Best+Practices%22) - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). - -If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. \ No newline at end of file diff --git a/content/docs/BestPractices/variable-naming/index.md b/content/docs/BestPractices/variable-naming/index.md index e722b779..3ead389b 100644 --- a/content/docs/BestPractices/variable-naming/index.md +++ b/content/docs/BestPractices/variable-naming/index.md @@ -1,12 +1,13 @@ --- title: "Variable Naming" -tags: ["Readability"] +tags: ["AL","Readability"] categories: ["Best Practice"] --- _Created by Microsoft, Described by waldo_ ## Description + Variables that refer to a AL object must contain the objects name, abbreviated where necessary. A variable must begin with a capital letter. @@ -20,29 +21,33 @@ If a variable is a compound of two or more words or abbreviations, each word or ```al WIPBuffer: Record "Job WIP Buffer" ``` + ## Good code + ```al JobWIPBuffer: Record "Job WIP Buffer" ``` + ## Bad code + ```al Postline: Codeunit "Gen. Jnl.-Post Line"; ``` + ## Good code + ```al GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line"; ``` + ## Bad code + ```al "Amount (LCY)": Decimal; ``` + ## Good code + ```al AmountLCY: Decimal; ``` - -## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=one+variable+naming+category%3A%22BC+Best+Practices%22) - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). - -If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. diff --git a/content/docs/BestPractices/variables-declarations-order/index.md b/content/docs/BestPractices/variables-declarations-order/index.md index 1701e044..262b768f 100644 --- a/content/docs/BestPractices/variables-declarations-order/index.md +++ b/content/docs/BestPractices/variables-declarations-order/index.md @@ -1,12 +1,13 @@ --- title: "Variables Declarations Order" -tags: ["Readability"] +tags: ["AL","Readability"] categories: ["Best Practice"] --- _Created by Microsoft, Described by waldo_ ## Description + Variables declarations should be ordered by type. In general, object and complex variable types are listed first followed by simple variables. The order should be: - Record @@ -25,7 +26,6 @@ Variables declarations should be ordered by type. In general, object and complex (Ref: [Microsoft Docs](https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/analyzers/codecop-aa0021)) - ## Bad code ```al @@ -39,9 +39,3 @@ Variables declarations should be ordered by type. In general, object and complex Vendor: Record Vendor; StartingDateFilter: Text; ``` - -## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=one+variables+declarations+order+category%3A%22BC+Best+Practices%22) - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). - -If you don't find the discussion of this guideline, please feel free to create a new one with the same title as this article. diff --git a/content/docs/Contributing/Templates/BestPractice/index.md b/content/docs/Contributing/Templates/BestPractice/index.md index dbb9e0d3..7a82fbe5 100644 --- a/content/docs/Contributing/Templates/BestPractice/index.md +++ b/content/docs/Contributing/Templates/BestPractice/index.md @@ -1,6 +1,6 @@ --- title: "Title Here" -tags: [] +tags: ["AL"] categories: ["Best Practice"] --- @@ -29,11 +29,3 @@ PutCodeblocksHere() ```al PutCodeblocksHere() ``` - -## Discussions - -Please discuss this guideline - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). - - \ No newline at end of file diff --git a/content/docs/Contributing/Templates/Patterns/index.md b/content/docs/Contributing/Templates/Patterns/index.md index 031973e1..e5fd2569 100644 --- a/content/docs/Contributing/Templates/Patterns/index.md +++ b/content/docs/Contributing/Templates/Patterns/index.md @@ -1,8 +1,8 @@ ---- -title: "Pattern Name" -tags: [] -categories: ["Pattern"] ---- ++++ +title = "Pattern Name" +tags = ["AL"] +categories = ["Pattern"] ++++ @@ -44,11 +44,3 @@ Usually, there are occasions where NOT to implement the pattern. List the disad ## List of references Youtube-link? BaseApp? Tweet? ... - -## Discussions - -Please discuss this guideline - -You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-patterns). - - diff --git a/content/docs/NAVPatterns/2-anti-patterns/_index.md b/content/docs/NAVPatterns/2-anti-patterns/_index.md index e0c88db2..e7695291 100644 --- a/content/docs/NAVPatterns/2-anti-patterns/_index.md +++ b/content/docs/NAVPatterns/2-anti-patterns/_index.md @@ -2,6 +2,7 @@ chapter = true title = "2. Anti-Patterns" weight = 130 +tags = ["C/AL"] +++ Some of the software development practices, had **not** stood the test of time. Despite that, some are still being used today by developers everywhere. diff --git a/content/docs/NAVPatterns/2-anti-patterns/nav-upgrade/index.md b/content/docs/NAVPatterns/2-anti-patterns/nav-upgrade/index.md index 2c827cdf..244abe96 100644 --- a/content/docs/NAVPatterns/2-anti-patterns/nav-upgrade/index.md +++ b/content/docs/NAVPatterns/2-anti-patterns/nav-upgrade/index.md @@ -1,6 +1,7 @@ +++ title = "Nav Upgrade" weight = 840 +tags = ["C/AL"] +++ ## Anti-Patterns in NAV Upgrade diff --git a/content/docs/NAVPatterns/2-anti-patterns/reusable-bugs/index.md b/content/docs/NAVPatterns/2-anti-patterns/reusable-bugs/index.md index 8809e65a..09d31469 100644 --- a/content/docs/NAVPatterns/2-anti-patterns/reusable-bugs/index.md +++ b/content/docs/NAVPatterns/2-anti-patterns/reusable-bugs/index.md @@ -1,6 +1,7 @@ +++ title = "Reusable Bugs" weight = 1020 +tags = ["C/AL"] +++ _By Bogdana Botez, Andreas Moth, Eric Wauters (waldo), Elly Nkya, Nikola Kukrika_ diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/_index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/_index.md index e5d3b5ba..84612f77 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/_index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/_index.md @@ -2,6 +2,8 @@ chapter = true title = "3. CAL Coding Guidelines" weight = 150 +tags = ["C/AL"] +categories = ["Best Practice"] +++ We've decided to publish our current C/AL coding guidelines. They are actual, as per January 2015 when this is published (but might fall out of sync as time goes by). diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/_index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/_index.md index e6278922..f77a18f4 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/_index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/_index.md @@ -1,6 +1,8 @@ +++ title = "Design" weight = 490 +tags = ["C/AL"] +categories = ["Best Practice"] +++ ## C/AL Coding Guidelines diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/by-reference-parameters/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/by-reference-parameters/index.md index d3689a6e..c58006b1 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/by-reference-parameters/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/by-reference-parameters/index.md @@ -1,6 +1,8 @@ +++ title = "By Reference Parameters" weight = 280 +tags = ["C/AL"] +categories = ["Best Practice"] +++ Do not declare parameters by reference if their values are not intended to be changed. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/class-coupling/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/class-coupling/index.md index 9219ad2b..aa47a30e 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/class-coupling/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/class-coupling/index.md @@ -1,6 +1,8 @@ +++ title = "Class Coupling" weight = 320 +tags = ["C/AL"] +categories = ["Best Practice"] +++ Do not write functions that have high class coupling. This makes the code hard to maintain. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/cyclomatic-complexity/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/cyclomatic-complexity/index.md index ffa2a71b..5a2aa8ac 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/cyclomatic-complexity/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/cyclomatic-complexity/index.md @@ -1,6 +1,8 @@ +++ title = "Cyclomatic Complexity" weight = 460 +tags = ["C/AL"] +categories = ["Best Practice"] +++ Do not write functions that have high cyclomatic complexity. This makes the code hard to maintain. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/encapsulate-local-functionality/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/encapsulate-local-functionality/index.md index b52d9285..04d84879 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/encapsulate-local-functionality/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/encapsulate-local-functionality/index.md @@ -1,5 +1,7 @@ +++ title = "Encapsulate Local Functionality" weight = 530 +tags = ["C/AL"] +categories = ["Best Practice"] +++ Any function used local must be defined as local. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/findset-findfirst-findlast/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/findset-findfirst-findlast/index.md index 5112e849..2dc93c17 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/findset-findfirst-findlast/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/findset-findfirst-findlast/index.md @@ -1,6 +1,8 @@ +++ title = "FINDSET FINDFIRST FINDLAST" weight = 600 +tags = ["C/AL"] +categories = ["Best Practice"] +++ FINDSET, FIND('+') or FIND('-') should only be used when NEXT is used and vice versa. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/initialized-variables/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/initialized-variables/index.md index 15903ec7..35a05a85 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/initialized-variables/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/initialized-variables/index.md @@ -1,6 +1,8 @@ +++ title = "Initialized Variables" weight = 660 +tags = ["C/AL"] +categories = ["Best Practice"] +++ Variables should always be set to a specific value, before they are used. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/maintainability-index/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/maintainability-index/index.md index 0d6a486e..051ac2fb 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/maintainability-index/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/maintainability-index/index.md @@ -1,6 +1,8 @@ +++ title = "Maintainability Index" weight = 770 +tags = ["C/AL"] +categories = ["Best Practice"] +++ [Maintainability Index][anchor0]: Do not write functions that have a very low maintainability index. This makes the code hard to maintain. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/parameter-placeholders/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/parameter-placeholders/index.md index de4ee689..8811e459 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/parameter-placeholders/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/parameter-placeholders/index.md @@ -1,6 +1,8 @@ +++ title = "Parameter Placeholders" weight = 920 +tags = ["C/AL"] +categories = ["Best Practice"] +++ The number of parameters passed to a string must match the placeholders. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/static-object-invocation/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/static-object-invocation/index.md index 54aaf03b..97e89c8a 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/static-object-invocation/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/static-object-invocation/index.md @@ -1,6 +1,8 @@ +++ title = "Static Object Invocation" weight = 1160 +tags = ["C/AL"] +categories = ["Best Practice"] +++ Call objects statically whenever possible. It reduces extra noise and removes extra variables. Downside: changing the name of the object which is called statically will need a code update. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/unreachable-code/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/unreachable-code/index.md index 6046b986..69f713e1 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/unreachable-code/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/unreachable-code/index.md @@ -1,6 +1,8 @@ +++ title = "Unreachable Code" weight = 1310 +tags = ["C/AL"] +categories = ["Best Practice"] +++ Do not write code that will never be hit. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/unused-initialized-variables/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/unused-initialized-variables/index.md index 898bac08..7e8f6738 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/unused-initialized-variables/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/unused-initialized-variables/index.md @@ -1,6 +1,8 @@ +++ title = "Unused Initialized Variables" weight = 1320 +tags = ["C/AL"] +categories = ["Best Practice"] +++ The value assigned to a variable must be used. Else the variable is not necessary. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/unused-variables/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/unused-variables/index.md index c0e5e8b3..d7bd6da8 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/unused-variables/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/unused-variables/index.md @@ -1,6 +1,8 @@ +++ title = "Unused Variables" weight = 1330 +tags = ["C/AL"] +categories = ["Best Practice"] +++ Do not declare variables that are unused. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/variable-capacity-mismatch/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/variable-capacity-mismatch/index.md index 87bbe3d6..0f3d5aab 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/variable-capacity-mismatch/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/variable-capacity-mismatch/index.md @@ -1,6 +1,8 @@ +++ title = "Variable Capacity Mismatch" weight = 1410 +tags = ["C/AL"] +categories = ["Best Practice"] +++ Do not assign a value to a variable whose capacity is smaller. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/with-scope-name-collision/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/with-scope-name-collision/index.md index 74bbdd31..d14ab704 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/design/with-scope-name-collision/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/design/with-scope-name-collision/index.md @@ -1,6 +1,8 @@ +++ title = "WITH Scope Name Collision" weight = 1450 +tags = ["C/AL"] +categories = ["Best Practice"] +++ 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. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/internally-used-dot-net-types/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/internally-used-dot-net-types/index.md index b543f50b..cb1f1493 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/internally-used-dot-net-types/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/internally-used-dot-net-types/index.md @@ -1,6 +1,8 @@ +++ title = "Internally used DotNet Types" weight = 690 +tags = ["C/AL"] +categories = ["Best Practice"] +++ _(Dynamics NAV 2015)_ diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/internationalization/_index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/internationalization/_index.md index 1881ceea..6edfff5a 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/internationalization/_index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/internationalization/_index.md @@ -1,6 +1,8 @@ +++ title = "Internationalization" weight = 700 +tags = ["C/AL"] +categories = ["Best Practice"] +++ ## C/AL Coding Guidelines diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/internationalization/using-calcdate/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/internationalization/using-calcdate/index.md index 4387da52..cf18657b 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/internationalization/using-calcdate/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/internationalization/using-calcdate/index.md @@ -1,6 +1,8 @@ +++ title = "Using Calcdate" weight = 1370 +tags = ["C/AL"] +categories = ["Best Practice"] +++ CALCDATE should only be used with DateFormula variables. Alternatively the string should be enclosed using the <> symbols. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/_index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/_index.md index 9b16cefa..714eeeb3 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/_index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/_index.md @@ -1,6 +1,8 @@ +++ title = "Localizability" weight = 750 +tags = ["C/AL"] +categories = ["Best Practice"] +++ ## C/AL Coding Guidelines diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/captionml-for-system-tables/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/captionml-for-system-tables/index.md index ad50b16c..4cad77f9 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/captionml-for-system-tables/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/captionml-for-system-tables/index.md @@ -1,6 +1,8 @@ +++ title = "CaptionML on System Pages" weight = 300 +tags = ["C/AL"] +categories = ["Best Practice"] +++ CaptionML should always be specified on a page field for a system table. By default, system tables do not have captions, so if you need to use them in the UI then captions need to be added. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/fieldcaption-and-tablecaption/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/fieldcaption-and-tablecaption/index.md index 9b05906f..ae4c8bdc 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/fieldcaption-and-tablecaption/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/fieldcaption-and-tablecaption/index.md @@ -1,6 +1,8 @@ +++ title = "FIELDCAPTION and TABLECAPTION" weight = 580 +tags = ["C/AL"] +categories = ["Best Practice"] +++ For user messages, errors etc., use FIELDCAPTION not FIELDNAME and TABLECAPTION not TABLENAME. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/global-text-constants/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/global-text-constants/index.md index 579e57df..0f8c2f63 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/global-text-constants/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/global-text-constants/index.md @@ -1,6 +1,8 @@ +++ title = "Global Text Constants" weight = 610 +tags = ["C/AL"] +categories = ["Best Practice"] +++ Declare Text Constant as global variables. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/use-text-constants/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/use-text-constants/index.md index a6209174..29129263 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/use-text-constants/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/use-text-constants/index.md @@ -1,6 +1,8 @@ +++ title = "Use Text Constants" weight = 1360 +tags = ["C/AL"] +categories = ["Best Practice"] +++ Pass user messages using Text Constants. It makes translation easy. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/using-optioncaptionml/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/using-optioncaptionml/index.md index 1de0a0c8..c02403b5 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/using-optioncaptionml/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/localizability/using-optioncaptionml/index.md @@ -1,6 +1,8 @@ +++ title = "Using OptionCaptionML" weight = 1380 +tags = ["C/AL"] +categories = ["Best Practice"] +++ The OptionCaptionML should be filled in for sourceexpression using option data types. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/_index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/_index.md index 18360f86..0a930440 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/_index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/_index.md @@ -1,6 +1,8 @@ +++ title = "Readability" weight = 980 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ ## C/AL Coding Guidelines diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/begin-as-an-afterword/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/begin-as-an-afterword/index.md index 9e967112..498e7b86 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/begin-as-an-afterword/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/begin-as-an-afterword/index.md @@ -1,6 +1,8 @@ +++ title = "Begin as an 'After Word'" weight = 230 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ When BEGIN follows THEN, ELSE, DO, it should be on the same line, preceded by one space character. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/begin-end/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/begin-end/index.md index c3351b48..a0caf6ad 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/begin-end/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/begin-end/index.md @@ -1,6 +1,8 @@ +++ title = "Begin-End - Compound Only" weight = 240 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ Only use BEGIN..END to enclose compound statements. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/binary-operator-line-start/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/binary-operator-line-start/index.md index feea3be3..8ff81042 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/binary-operator-line-start/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/binary-operator-line-start/index.md @@ -1,6 +1,8 @@ +++ title = "Binary Operator to Start Line" weight = 250 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ Do not start a line with a binary operator. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/blank-lines/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/blank-lines/index.md index 5ead097e..5929b91e 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/blank-lines/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/blank-lines/index.md @@ -1,6 +1,8 @@ +++ title = "Blank Lines" weight = 260 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ Do not use blank lines at the beginning or end of any functions, after BEGIN, before END, or inside multiline expressions. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/case-actions/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/case-actions/index.md index dc76df2f..d4bbea8c 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/case-actions/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/case-actions/index.md @@ -1,6 +1,8 @@ +++ title = "CASE Action" weight = 310 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ A CASE action should start on a line after the possibility. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/colon-usage-in-case/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/colon-usage-in-case/index.md index 137c127c..e02393fe 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/colon-usage-in-case/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/colon-usage-in-case/index.md @@ -1,6 +1,8 @@ +++ title = "Colon usage in CASE" weight = 340 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ The last possibility on a CASE statement must be immediately followed by a colon. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/comments-curly-brackets/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/comments-curly-brackets/index.md index 5c4ea36c..049cbd86 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/comments-curly-brackets/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/comments-curly-brackets/index.md @@ -1,6 +1,8 @@ +++ title = "Comments inside Curly Brackets" weight = 350 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ Never use curly bracket comments. During development, the "Block comment" functionality can be used instead. However, in production code, block comments are not recommended. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/comments-spacing/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/comments-spacing/index.md index 9ffc3802..7203208c 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/comments-spacing/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/comments-spacing/index.md @@ -1,6 +1,8 @@ +++ title = "Comment Spacing" weight = 360 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ Always start comments with // followed by one space character. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/end-else-pair/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/end-else-pair/index.md index 520c1b95..a31fb67e 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/end-else-pair/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/end-else-pair/index.md @@ -1,6 +1,8 @@ +++ title = "END ELSE Pair" weight = 540 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ The END ELSE pair should always appear on the same line. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/indentation/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/indentation/index.md index 9b15844a..614aab16 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/indentation/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/indentation/index.md @@ -1,6 +1,8 @@ +++ title = "Indentation" weight = 650 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ In general, use an indentation of two space characters. Logical expressions in the IF, WHILE, and UNTIL parts are indented at least 3, 6, and 6 spaces respectively. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/keyword-pairs-indentation/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/keyword-pairs-indentation/index.md index acd13053..e109817a 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/keyword-pairs-indentation/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/keyword-pairs-indentation/index.md @@ -1,6 +1,8 @@ +++ title = "Keyword Pairs - Indentation" weight = 730 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ The IF..THEN pair, WHILE..DO pair, and FOR..DO pair must appear on the same line or the same level of indentation. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/line-start-keywords/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/line-start-keywords/index.md index ec7754ec..58ce7884 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/line-start-keywords/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/line-start-keywords/index.md @@ -1,6 +1,8 @@ +++ title = "Line Start Keywords" weight = 740 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ The END, IF, REPEAT, FOR, WHILE, ELSE and CASE statement should always start a line. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/lonely-repeat/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/lonely-repeat/index.md index a5e278e4..a7bae1df 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/lonely-repeat/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/lonely-repeat/index.md @@ -1,6 +1,8 @@ +++ title = "Lonely Repeat" weight = 760 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ The REPEAT statement should always be alone on a line. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/named-invocations/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/named-invocations/index.md index bff692d7..64b8fff3 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/named-invocations/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/named-invocations/index.md @@ -1,6 +1,8 @@ +++ title = "Named Invocations" weight = 830 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ When calling an object statically use the name, not the number diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/nested-withs/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/nested-withs/index.md index b1a57b16..3dcabde2 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/nested-withs/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/nested-withs/index.md @@ -1,6 +1,8 @@ +++ title = "Nested WITHs" weight = 850 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ Do not nest WITHs that reference different types of objects. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/one-statement-per-line/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/one-statement-per-line/index.md index 348ddaac..5d9e6379 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/one-statement-per-line/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/one-statement-per-line/index.md @@ -1,6 +1,8 @@ +++ title = "One Statement Per Line" weight = 910 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ A line of code should not have more than one statement. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/separate-if-and-else/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/separate-if-and-else/index.md index 8b9948fa..f1c05ab4 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/separate-if-and-else/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/separate-if-and-else/index.md @@ -1,6 +1,8 @@ +++ title = "Separate IF and ELSE" weight = 1050 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ IF and ELSE statements should be on separate lines. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/spacing-binary-operators/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/spacing-binary-operators/index.md index 6766688a..ec18a52d 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/spacing-binary-operators/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/spacing-binary-operators/index.md @@ -1,6 +1,8 @@ +++ title = "Spacing Binary Operators" weight = 1120 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ There must be exactly one space character on each side of a binary operator such as = + - AND OR =. The parameter comma operator however, should have no spaces. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/spacing-brackets-and/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/spacing-brackets-and/index.md index 1187bcce..087b1ac8 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/spacing-brackets-and/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/spacing-brackets-and/index.md @@ -1,6 +1,8 @@ +++ title = "Spacing Brackets and ::" weight = 1130 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ There must be no spaces characters before and after [] dimension brackets symbols or :: option symbols. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/spacing-unary-operators/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/spacing-unary-operators/index.md index 63277cff..970b2d16 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/spacing-unary-operators/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/spacing-unary-operators/index.md @@ -1,6 +1,8 @@ +++ title = "Spacing Unary Operators" weight = 1140 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ There must be no space between a unary operator and its argument (except for the NOT keyword). diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/suggested-abbreviations/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/suggested-abbreviations/index.md index df4af1ec..97b84557 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/suggested-abbreviations/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/suggested-abbreviations/index.md @@ -1,6 +1,8 @@ +++ title = "Suggested Abbreviations" weight = 1170 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ ### Suggested Abbreviations diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/temporary-variable-naming/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/temporary-variable-naming/index.md index 53630c54..bbd36a69 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/temporary-variable-naming/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/temporary-variable-naming/index.md @@ -1,6 +1,8 @@ +++ title = "Temporary Variable Naming" weight = 1200 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ The name of a temporary variable must be prefixed with the word Temp and not otherwise. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/textconst-suffixes/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/textconst-suffixes/index.md index 09f44459..7de92fbf 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/textconst-suffixes/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/textconst-suffixes/index.md @@ -1,6 +1,8 @@ +++ title = "TextConst Suffixes" weight = 1210 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ TextConst variable names should have a suffix (an approved three-letter suffix: Msg, Tok, Err, Qst, Lbl, Txt) describing usage. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unary-operator-line-end/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unary-operator-line-end/index.md index c121de69..11ad406e 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unary-operator-line-end/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unary-operator-line-end/index.md @@ -1,6 +1,8 @@ +++ title = "Unary Operator Line End" weight = 1250 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ Do not end a line with unary operator. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-compound-parenthesis/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-compound-parenthesis/index.md index 2e3f3f14..127418c2 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-compound-parenthesis/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-compound-parenthesis/index.md @@ -1,6 +1,8 @@ +++ title = "Unnecessary Compound Parenthesis" weight = 1260 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ Use parenthesis only to enclose compound expressions inside compound expressions. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-else/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-else/index.md index 8ba88518..f3755ab2 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-else/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-else/index.md @@ -1,6 +1,8 @@ +++ title = "Unnecessary ELSE" weight = 1270 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ ELSE should not be used when the last action in the THEN part is an EXIT, BREAK, SKIP, QUIT, ERROR. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-function-parenthesis/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-function-parenthesis/index.md index 44bc6402..9750286a 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-function-parenthesis/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-function-parenthesis/index.md @@ -1,6 +1,8 @@ +++ title = "Unnecessary Function Parenthesis" weight = 1280 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ Do not use parenthesis in a function call if the function does not have any parameters. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-separators/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-separators/index.md index 2a653922..ecefcdf6 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-separators/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-separators/index.md @@ -1,6 +1,8 @@ +++ title = "Unnecessary Separators" weight = 1290 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ There should be no unnecessary separators. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-truefalse/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-truefalse/index.md index ed6e3679..181b2067 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-truefalse/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/unnecessary-truefalse/index.md @@ -1,6 +1,8 @@ +++ title = "Unnecessary TRUE/FALSE" weight = 1300 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ Do not use TRUE or FALSE keywords unnecessarily if the expression is already an logical expression. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/variable-already-scoped/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/variable-already-scoped/index.md index 73e682b5..f24f9358 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/variable-already-scoped/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/variable-already-scoped/index.md @@ -1,6 +1,8 @@ +++ title = "Variable Already Scoped" weight = 1400 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ Do not use scope ''.'' qualifier unnecessarily when a variable is already implicitly or explicitly scoped. It keeps the code simpler. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/variable-naming/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/variable-naming/index.md index 9b2b5639..a678e0a3 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/variable-naming/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/variable-naming/index.md @@ -1,6 +1,8 @@ +++ title = "Variable Naming" weight = 1420 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ Variables that refer to a C/AL object must contain the objects name, abbreviated where necessary. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/variables-declarations-order/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/variables-declarations-order/index.md index a578ca7d..d9b7cc08 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/variables-declarations-order/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/readability/variables-declarations-order/index.md @@ -1,6 +1,8 @@ +++ title = "Variables Declarations Order" weight = 1430 +tags = ["C/AL","Readability"] +categories = ["Best Practice"] +++ Variables declarations should be ordered by type. In general, object and complex variable types are listed first followed by simple variables. The order should be the same as the object list in the object designer for C/AL objects. Afterwards come the complex variables like RecordRef, .NET, FieldRef etc. At the end come all the simple data types in no particular order. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/_index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/_index.md index b755e886..cc4c977b 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/_index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/_index.md @@ -1,6 +1,8 @@ +++ title = "UX" weight = 1390 +tags = ["C/AL"] +categories = ["Best Practice"] +++ ## C/AL Coding Guidelines diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/actions-images/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/actions-images/index.md index c07df2c0..863d0609 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/actions-images/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/actions-images/index.md @@ -1,6 +1,8 @@ +++ title = "Actions - Images" weight = 200 +tags = ["C/AL"] +categories = ["Best Practice"] +++ All actions must have an image assigned to them. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/confirm/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/confirm/index.md index fb3394f9..155b747d 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/confirm/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/confirm/index.md @@ -1,6 +1,8 @@ +++ title = "CONFIRM" weight = 380 +tags = ["C/AL"] +categories = ["Best Practice"] +++ Always end CONFIRM with a question mark. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/fielderror/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/fielderror/index.md index 1e041417..1f87ff3a 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/fielderror/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/fielderror/index.md @@ -1,6 +1,8 @@ +++ title = "FIELDERROR" weight = 590 +tags = ["C/AL"] +categories = ["Best Practice"] +++ Never use FIELDERROR with a period as it is automatically inserted. diff --git a/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/message-and-error/index.md b/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/message-and-error/index.md index 93ede77d..93bce63a 100644 --- a/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/message-and-error/index.md +++ b/content/docs/NAVPatterns/3-cal-coding-guidelines/ux/message-and-error/index.md @@ -1,6 +1,8 @@ +++ title = "MESSAGE and ERROR" weight = 790 +tags = ["C/AL"] +categories = ["Best Practice"] +++ Always end MESSAGE or ERROR with a period. diff --git a/content/docs/NAVPatterns/4-get-involved/_index.md b/content/docs/NAVPatterns/4-get-involved/_index.md index 98bf3470..43d27a4a 100644 --- a/content/docs/NAVPatterns/4-get-involved/_index.md +++ b/content/docs/NAVPatterns/4-get-involved/_index.md @@ -2,6 +2,7 @@ chapter = true title = "(OLD) Get Involved" weight = 170 +tags = ["C/AL"] +++ **Reminder, this is an ARCHIVE of the Patterns site, this information is not current.** diff --git a/content/docs/NAVPatterns/4-get-involved/code-of-conduct/index.md b/content/docs/NAVPatterns/4-get-involved/code-of-conduct/index.md index 02cdce3a..76927c3e 100644 --- a/content/docs/NAVPatterns/4-get-involved/code-of-conduct/index.md +++ b/content/docs/NAVPatterns/4-get-involved/code-of-conduct/index.md @@ -1,6 +1,7 @@ +++ title = "Code of Conduct" weight = 330 +tags = ["C/AL"] +++ Find below the rules to be used when disseminating or relating to the NAV Design Patterns. diff --git a/content/docs/NAVPatterns/4-get-involved/patterns-authors/index.md b/content/docs/NAVPatterns/4-get-involved/patterns-authors/index.md index de316d5c..104b6b21 100644 --- a/content/docs/NAVPatterns/4-get-involved/patterns-authors/index.md +++ b/content/docs/NAVPatterns/4-get-involved/patterns-authors/index.md @@ -1,6 +1,7 @@ +++ title = "Patterns Authors" weight = 930 +tags = ["C/AL"] +++ This is the list of people that have been part of the NAV Design Patterns team. If you would like to join the project follow the instructions provided on [Be a NAV Pattern Author][anchor0] page. diff --git a/content/docs/NAVPatterns/4-get-involved/template-for-writing-nav-design-patterns/index.md b/content/docs/NAVPatterns/4-get-involved/template-for-writing-nav-design-patterns/index.md index 77a8b22b..a47abbd6 100644 --- a/content/docs/NAVPatterns/4-get-involved/template-for-writing-nav-design-patterns/index.md +++ b/content/docs/NAVPatterns/4-get-involved/template-for-writing-nav-design-patterns/index.md @@ -1,6 +1,7 @@ +++ title = "Template for writing Nav Design Patterns" weight = 1180 +tags = ["C/AL"] +++ This is a guideline, some parts are optional (if there's no content, remove the whole paragraph). diff --git a/content/docs/NAVPatterns/_index.md b/content/docs/NAVPatterns/_index.md index 5865a369..644ec7ec 100644 --- a/content/docs/NAVPatterns/_index.md +++ b/content/docs/NAVPatterns/_index.md @@ -1,6 +1,7 @@ +++ title = "NAV Patterns Archive" weight = 20 +tags = ["C/AL"] +++ ## About the archive diff --git a/content/docs/NAVPatterns/patterns/_index.md b/content/docs/NAVPatterns/patterns/_index.md index 075fc693..527ceb23 100644 --- a/content/docs/NAVPatterns/patterns/_index.md +++ b/content/docs/NAVPatterns/patterns/_index.md @@ -1,8 +1,8 @@ --- -title: "Patterns" +title: "1. Patterns" weight: 110 -tags: ["NAV", "C/AL"] -categories: ["Archived Pattern"] +tags: ["C/AL"] +categories: ["Pattern"] description: > Patterns described to be used with Microsoft Dynamics NAV --- diff --git a/content/docs/NAVPatterns/patterns/activity-log/index.md b/content/docs/NAVPatterns/patterns/activity-log/index.md index 37a327a2..f6acd62a 100644 --- a/content/docs/NAVPatterns/patterns/activity-log/index.md +++ b/content/docs/NAVPatterns/patterns/activity-log/index.md @@ -1,6 +1,8 @@ +++ title = "Activity Logs" weight = 210 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Originally by Ciprian Iordache at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/argument-table/index.md b/content/docs/NAVPatterns/patterns/argument-table/index.md index 13a4c70d..b413e0c8 100644 --- a/content/docs/NAVPatterns/patterns/argument-table/index.md +++ b/content/docs/NAVPatterns/patterns/argument-table/index.md @@ -1,6 +1,8 @@ +++ title = "Argument Table" weight = 220 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Originally By Nikola Kukrika and waldo_ diff --git a/content/docs/NAVPatterns/patterns/blocked-entity/_index.md b/content/docs/NAVPatterns/patterns/blocked-entity/_index.md index 765791a5..79b0f5ac 100644 --- a/content/docs/NAVPatterns/patterns/blocked-entity/_index.md +++ b/content/docs/NAVPatterns/patterns/blocked-entity/_index.md @@ -1,6 +1,8 @@ +++ title = "Blocked Entity" weight = 270 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Originally by Abhishek Ghosh at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/blocked-entity/data-driven-blocked-entity/index.md b/content/docs/NAVPatterns/patterns/blocked-entity/data-driven-blocked-entity/index.md index 295cf07b..3e4413b3 100644 --- a/content/docs/NAVPatterns/patterns/blocked-entity/data-driven-blocked-entity/index.md +++ b/content/docs/NAVPatterns/patterns/blocked-entity/data-driven-blocked-entity/index.md @@ -1,6 +1,8 @@ +++ title = "Data Driven Blocked Entity" weight = 470 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Written by Bogdan Andrei Sturzoiu, at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/cached-web-service-calls/index.md b/content/docs/NAVPatterns/patterns/cached-web-service-calls/index.md index baa4cea5..fd64729e 100644 --- a/content/docs/NAVPatterns/patterns/cached-web-service-calls/index.md +++ b/content/docs/NAVPatterns/patterns/cached-web-service-calls/index.md @@ -1,6 +1,8 @@ +++ title = "Cached Web Server Calls" weight = 290 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Originally by Mostafa Balat, Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/conditional-cascading-update/index.md b/content/docs/NAVPatterns/patterns/conditional-cascading-update/index.md index a690d1ff..2b29989d 100644 --- a/content/docs/NAVPatterns/patterns/conditional-cascading-update/index.md +++ b/content/docs/NAVPatterns/patterns/conditional-cascading-update/index.md @@ -1,6 +1,8 @@ +++ title = "Conditional Cascading Update" weight = 370 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Originally by Jan Hoek at IDYN_ diff --git a/content/docs/NAVPatterns/patterns/copy-document/index.md b/content/docs/NAVPatterns/patterns/copy-document/index.md index 324b617a..98f1bd0b 100644 --- a/content/docs/NAVPatterns/patterns/copy-document/index.md +++ b/content/docs/NAVPatterns/patterns/copy-document/index.md @@ -1,6 +1,8 @@ +++ title = "Copy Document" weight = 390 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Bogdan Sturzoiu at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/create-data-from-templates/index.md b/content/docs/NAVPatterns/patterns/create-data-from-templates/index.md index 9ecad138..d51d6c92 100644 --- a/content/docs/NAVPatterns/patterns/create-data-from-templates/index.md +++ b/content/docs/NAVPatterns/patterns/create-data-from-templates/index.md @@ -1,6 +1,8 @@ +++ title = "Create Data from Templates" weight = 400 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Originally by Nikola Kukrika at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/create-urls-to-nav-clients/index.md b/content/docs/NAVPatterns/patterns/create-urls-to-nav-clients/index.md index fdcbee7c..5f604ef4 100644 --- a/content/docs/NAVPatterns/patterns/create-urls-to-nav-clients/index.md +++ b/content/docs/NAVPatterns/patterns/create-urls-to-nav-clients/index.md @@ -1,6 +1,8 @@ +++ title = "Create URLs to NAV Clients" weight = 410 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Mike Borg Cardona and Bogdana Botez at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/creating-custom-charts/index.md b/content/docs/NAVPatterns/patterns/creating-custom-charts/index.md index 4bd83358..64d58fd4 100644 --- a/content/docs/NAVPatterns/patterns/creating-custom-charts/index.md +++ b/content/docs/NAVPatterns/patterns/creating-custom-charts/index.md @@ -1,6 +1,8 @@ +++ title = "Creating Custom Charts" weight = 420 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Originally by Nikola Kukrika at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/cross-session-events/index.md b/content/docs/NAVPatterns/patterns/cross-session-events/index.md index 1a5fae83..b9aecd0b 100644 --- a/content/docs/NAVPatterns/patterns/cross-session-events/index.md +++ b/content/docs/NAVPatterns/patterns/cross-session-events/index.md @@ -1,6 +1,8 @@ +++ title = "Cross Session Events" weight = 430 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Nikolai L'Estrange, from TVision Technology Ltd. in the UK_ diff --git a/content/docs/NAVPatterns/patterns/currently-active-record/index.md b/content/docs/NAVPatterns/patterns/currently-active-record/index.md index 1f1f56a0..ad7e9e2e 100644 --- a/content/docs/NAVPatterns/patterns/currently-active-record/index.md +++ b/content/docs/NAVPatterns/patterns/currently-active-record/index.md @@ -1,6 +1,8 @@ +++ title = "Currently Active Record" weight = 450 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Authors: Henrik Langbak and Kim Ginnerup, Bording Data_ diff --git a/content/docs/NAVPatterns/patterns/data-migration-facade/index.md b/content/docs/NAVPatterns/patterns/data-migration-facade/index.md index bd0650da..874f937b 100644 --- a/content/docs/NAVPatterns/patterns/data-migration-facade/index.md +++ b/content/docs/NAVPatterns/patterns/data-migration-facade/index.md @@ -1,6 +1,8 @@ +++ title = "Data Migration Façade" weight = 480 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By David Bastide and Soumya Dutta at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/discovery-event/index.md b/content/docs/NAVPatterns/patterns/discovery-event/index.md index eba8381a..d8cbf195 100644 --- a/content/docs/NAVPatterns/patterns/discovery-event/index.md +++ b/content/docs/NAVPatterns/patterns/discovery-event/index.md @@ -1,6 +1,8 @@ +++ title = "Discovery Event" weight = 500 +tags = ["C/AL"] +categories = ["Pattern"] +++ _by waldo_ diff --git a/content/docs/NAVPatterns/patterns/document/index.md b/content/docs/NAVPatterns/patterns/document/index.md index 653ed482..66120a29 100644 --- a/content/docs/NAVPatterns/patterns/document/index.md +++ b/content/docs/NAVPatterns/patterns/document/index.md @@ -1,6 +1,8 @@ +++ title = "Document" weight = 510 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Xavier Garonnat, knk Ingénierie (France), xgaronnat@knk.fr_ diff --git a/content/docs/NAVPatterns/patterns/easy-update-of-setup-or-supplementary-information/index.md b/content/docs/NAVPatterns/patterns/easy-update-of-setup-or-supplementary-information/index.md index aea9f8d3..f652f12f 100644 --- a/content/docs/NAVPatterns/patterns/easy-update-of-setup-or-supplementary-information/index.md +++ b/content/docs/NAVPatterns/patterns/easy-update-of-setup-or-supplementary-information/index.md @@ -1,6 +1,8 @@ +++ title = "Easy Update Of Setup Or Supplementary Information" weight = 520 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Originally by Anders Larsen at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/error-message-processing/index.md b/content/docs/NAVPatterns/patterns/error-message-processing/index.md index 2b736c8c..3d129c1e 100644 --- a/content/docs/NAVPatterns/patterns/error-message-processing/index.md +++ b/content/docs/NAVPatterns/patterns/error-message-processing/index.md @@ -1,6 +1,8 @@ +++ title = "Error Message Processing" weight = 550 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Jesper Schulz at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/extending-the-role-center-headlines/index.md b/content/docs/NAVPatterns/patterns/extending-the-role-center-headlines/index.md index f3006cde..3f5b4615 100644 --- a/content/docs/NAVPatterns/patterns/extending-the-role-center-headlines/index.md +++ b/content/docs/NAVPatterns/patterns/extending-the-role-center-headlines/index.md @@ -1,6 +1,8 @@ +++ title = "Extending the Role Center Headlines" weight = 560 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By David Bastide at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/feature-localization-for-data-structures/index.md b/content/docs/NAVPatterns/patterns/feature-localization-for-data-structures/index.md index 14ee3b5e..cd110eb1 100644 --- a/content/docs/NAVPatterns/patterns/feature-localization-for-data-structures/index.md +++ b/content/docs/NAVPatterns/patterns/feature-localization-for-data-structures/index.md @@ -1,6 +1,8 @@ +++ title = "Feature Localization For Data Structures" weight = 570 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Originally by Bogdan Sturzoiu at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/hooks/index.md b/content/docs/NAVPatterns/patterns/hooks/index.md index b23b7e88..9134887d 100644 --- a/content/docs/NAVPatterns/patterns/hooks/index.md +++ b/content/docs/NAVPatterns/patterns/hooks/index.md @@ -1,6 +1,8 @@ +++ title = "Hooks" weight = 620 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Eric Wauters ([waldo][anchor0]), Partner-Ready-Software_ diff --git a/content/docs/NAVPatterns/patterns/implementation-of-surrogate-keys-using-autoincrement-pattern/index.md b/content/docs/NAVPatterns/patterns/implementation-of-surrogate-keys-using-autoincrement-pattern/index.md index e8bce739..a89b6b1b 100644 --- a/content/docs/NAVPatterns/patterns/implementation-of-surrogate-keys-using-autoincrement-pattern/index.md +++ b/content/docs/NAVPatterns/patterns/implementation-of-surrogate-keys-using-autoincrement-pattern/index.md @@ -1,6 +1,8 @@ +++ title = "Surrogate keys using Autoincrement Pattern" weight = 630 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By [Soren Klemmensen][anchor0], [_Partner-Ready-Software_ ][anchor1] & [360 Visibility][anchor2]_ diff --git a/content/docs/NAVPatterns/patterns/instructions-in-the-ui/index.md b/content/docs/NAVPatterns/patterns/instructions-in-the-ui/index.md index a1ec6258..fdbe7999 100644 --- a/content/docs/NAVPatterns/patterns/instructions-in-the-ui/index.md +++ b/content/docs/NAVPatterns/patterns/instructions-in-the-ui/index.md @@ -1,6 +1,8 @@ +++ title = "Instructions in the UI" weight = 670 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Originally by Nikola Kukrika at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/integration-of-addresses/index.md b/content/docs/NAVPatterns/patterns/integration-of-addresses/index.md index d397581d..95521bba 100644 --- a/content/docs/NAVPatterns/patterns/integration-of-addresses/index.md +++ b/content/docs/NAVPatterns/patterns/integration-of-addresses/index.md @@ -1,6 +1,8 @@ +++ title = "Integration of Addresses" weight = 680 +tags = ["C/AL"] +categories = ["Pattern"] +++ {{< youtube 60Wrx9N-gfY>}} diff --git a/content/docs/NAVPatterns/patterns/journal-error-processing/index.md b/content/docs/NAVPatterns/patterns/journal-error-processing/index.md index a45fa1b6..7dbcd05e 100644 --- a/content/docs/NAVPatterns/patterns/journal-error-processing/index.md +++ b/content/docs/NAVPatterns/patterns/journal-error-processing/index.md @@ -1,6 +1,8 @@ +++ title = "Journal Error Processing" weight = 710 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Originally by Bogdana Botez at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/journal-template-batch-line/index.md b/content/docs/NAVPatterns/patterns/journal-template-batch-line/index.md index 36cd27de..99fe99af 100644 --- a/content/docs/NAVPatterns/patterns/journal-template-batch-line/index.md +++ b/content/docs/NAVPatterns/patterns/journal-template-batch-line/index.md @@ -1,6 +1,8 @@ +++ title = "Journal Template Batch Line" weight = 720 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Originally by Bogdana Botez at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/master-data/index.md b/content/docs/NAVPatterns/patterns/master-data/index.md index 6dcc814a..f42cbbd4 100644 --- a/content/docs/NAVPatterns/patterns/master-data/index.md +++ b/content/docs/NAVPatterns/patterns/master-data/index.md @@ -1,6 +1,8 @@ +++ title = "Master Data" weight = 780 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By [Soren Klemmensen][anchor0], [_Partner-Ready-Software_ ][anchor1] & [360 Visibility][anchor2]_ diff --git a/content/docs/NAVPatterns/patterns/multi-file-download/index.md b/content/docs/NAVPatterns/patterns/multi-file-download/index.md index 775bb447..fe7bb5f8 100644 --- a/content/docs/NAVPatterns/patterns/multi-file-download/index.md +++ b/content/docs/NAVPatterns/patterns/multi-file-download/index.md @@ -1,6 +1,8 @@ +++ title = "Multi-file Download" weight = 800 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Martin Dam at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/multi-page-list/index.md b/content/docs/NAVPatterns/patterns/multi-page-list/index.md index bc7b8f68..3fea0820 100644 --- a/content/docs/NAVPatterns/patterns/multi-page-list/index.md +++ b/content/docs/NAVPatterns/patterns/multi-page-list/index.md @@ -1,6 +1,8 @@ +++ title = "Multi-Page List" weight = 810 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Bogdana Botez at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/multilanguage-application-data/index.md b/content/docs/NAVPatterns/patterns/multilanguage-application-data/index.md index 83d06dfd..79495c6f 100644 --- a/content/docs/NAVPatterns/patterns/multilanguage-application-data/index.md +++ b/content/docs/NAVPatterns/patterns/multilanguage-application-data/index.md @@ -1,6 +1,8 @@ +++ title = "Multilanguage Application Data" weight = 820 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Originally by Bogdana Botez at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/net-exception-handling-in-cal/_index.md b/content/docs/NAVPatterns/patterns/net-exception-handling-in-cal/_index.md index b96c39fc..9175a3e3 100644 --- a/content/docs/NAVPatterns/patterns/net-exception-handling-in-cal/_index.md +++ b/content/docs/NAVPatterns/patterns/net-exception-handling-in-cal/_index.md @@ -1,6 +1,8 @@ +++ title = "NET Exception Handling in CAL" weight = 860 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Originally by Mostafa Balat, Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/net-exception-handling-in-cal/tryfunction-net-exception-handling-in-cal/index.md b/content/docs/NAVPatterns/patterns/net-exception-handling-in-cal/tryfunction-net-exception-handling-in-cal/index.md index 80239de5..209b5c70 100644 --- a/content/docs/NAVPatterns/patterns/net-exception-handling-in-cal/tryfunction-net-exception-handling-in-cal/index.md +++ b/content/docs/NAVPatterns/patterns/net-exception-handling-in-cal/tryfunction-net-exception-handling-in-cal/index.md @@ -1,6 +1,8 @@ +++ title = "TryFunction NET Exception Handling in CAL" weight = 1240 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Originally by Mostafa Balat, Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/no-series/index.md b/content/docs/NAVPatterns/patterns/no-series/index.md index a841e1e1..d59f2b3a 100644 --- a/content/docs/NAVPatterns/patterns/no-series/index.md +++ b/content/docs/NAVPatterns/patterns/no-series/index.md @@ -1,6 +1,8 @@ +++ title = "No Series" weight = 870 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Bogdana Botez, at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/notifications/_index.md b/content/docs/NAVPatterns/patterns/notifications/_index.md index 270c0fc4..52b7d965 100644 --- a/content/docs/NAVPatterns/patterns/notifications/_index.md +++ b/content/docs/NAVPatterns/patterns/notifications/_index.md @@ -1,5 +1,7 @@ +++ title = "Notifications" weight = 890 +tags = ["C/AL"] +categories = ["Pattern"] +++ A collection of patterns about notifications. diff --git a/content/docs/NAVPatterns/patterns/notifications/in-context-notifications/index.md b/content/docs/NAVPatterns/patterns/notifications/in-context-notifications/index.md index 9c603272..1efa1a09 100644 --- a/content/docs/NAVPatterns/patterns/notifications/in-context-notifications/index.md +++ b/content/docs/NAVPatterns/patterns/notifications/in-context-notifications/index.md @@ -1,6 +1,8 @@ +++ title = "In-context Notifications" weight = 640 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Soumya Dutta at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/notifications/notification-lifecycle-management-pattern/index.md b/content/docs/NAVPatterns/patterns/notifications/notification-lifecycle-management-pattern/index.md index 89cd570c..b8d3195d 100644 --- a/content/docs/NAVPatterns/patterns/notifications/notification-lifecycle-management-pattern/index.md +++ b/content/docs/NAVPatterns/patterns/notifications/notification-lifecycle-management-pattern/index.md @@ -1,6 +1,8 @@ +++ title = "Notification Lifecycle Management Pattern" weight = 880 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By David Bastide at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/observer/index.md b/content/docs/NAVPatterns/patterns/observer/index.md index 2ebeab8e..9be9315e 100644 --- a/content/docs/NAVPatterns/patterns/observer/index.md +++ b/content/docs/NAVPatterns/patterns/observer/index.md @@ -1,6 +1,8 @@ +++ title = "Observer" weight = 900 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Nikolai L'Estrange, from TVision Technology Ltd. in the UK_ diff --git a/content/docs/NAVPatterns/patterns/posting-routine-select-behavior/index.md b/content/docs/NAVPatterns/patterns/posting-routine-select-behavior/index.md index 738afa38..79bc2d92 100644 --- a/content/docs/NAVPatterns/patterns/posting-routine-select-behavior/index.md +++ b/content/docs/NAVPatterns/patterns/posting-routine-select-behavior/index.md @@ -1,6 +1,8 @@ +++ title = "Posting Routine - Select Behavior" weight = 940 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By waldo_ diff --git a/content/docs/NAVPatterns/patterns/product-name/index.md b/content/docs/NAVPatterns/patterns/product-name/index.md index d3c841b4..f5f5d49c 100644 --- a/content/docs/NAVPatterns/patterns/product-name/index.md +++ b/content/docs/NAVPatterns/patterns/product-name/index.md @@ -1,6 +1,8 @@ +++ title = "Product Name" weight = 950 +tags = ["C/AL"] +categories = ["Pattern"] +++ #### **Abstract** diff --git a/content/docs/NAVPatterns/patterns/queries/_index.md b/content/docs/NAVPatterns/patterns/queries/_index.md index f823a5fd..30ab3a09 100644 --- a/content/docs/NAVPatterns/patterns/queries/_index.md +++ b/content/docs/NAVPatterns/patterns/queries/_index.md @@ -1,5 +1,7 @@ +++ title = "Queries" weight = 960 +tags = ["C/AL"] +categories = ["Pattern"] +++ Expand to see NAV design patterns which use queries. diff --git a/content/docs/NAVPatterns/patterns/queries/select-distinct-with-queries/index.md b/content/docs/NAVPatterns/patterns/queries/select-distinct-with-queries/index.md index 6630bca8..b0fe885a 100644 --- a/content/docs/NAVPatterns/patterns/queries/select-distinct-with-queries/index.md +++ b/content/docs/NAVPatterns/patterns/queries/select-distinct-with-queries/index.md @@ -1,6 +1,8 @@ +++ title = "SELECT DISTINCT with Queries" weight = 1040 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Bogdana Botez, at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/queries/use-queries-to-detect-duplicate-records/index.md b/content/docs/NAVPatterns/patterns/queries/use-queries-to-detect-duplicate-records/index.md index e26e5399..b2681324 100644 --- a/content/docs/NAVPatterns/patterns/queries/use-queries-to-detect-duplicate-records/index.md +++ b/content/docs/NAVPatterns/patterns/queries/use-queries-to-detect-duplicate-records/index.md @@ -1,6 +1,8 @@ +++ title = "Use Queries to Detect Duplicate Records" weight = 1340 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Originally by Abshishek Ghosh and Bogdan Sturzoiu at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/queries/use-queries-to-replace-nested-loops/index.md b/content/docs/NAVPatterns/patterns/queries/use-queries-to-replace-nested-loops/index.md index 3caea2a9..a61d2583 100644 --- a/content/docs/NAVPatterns/patterns/queries/use-queries-to-replace-nested-loops/index.md +++ b/content/docs/NAVPatterns/patterns/queries/use-queries-to-replace-nested-loops/index.md @@ -1,6 +1,8 @@ +++ title = "Use Queries to Replace Nested Loops" weight = 1350 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Originally by Bogdan Sturzoiu, Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/read-once-initialization-and-validation/index.md b/content/docs/NAVPatterns/patterns/read-once-initialization-and-validation/index.md index 370b210c..580a7489 100644 --- a/content/docs/NAVPatterns/patterns/read-once-initialization-and-validation/index.md +++ b/content/docs/NAVPatterns/patterns/read-once-initialization-and-validation/index.md @@ -1,6 +1,8 @@ +++ title = "Read-once Initialization and Validation" weight = 970 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Tim Grant_ diff --git a/content/docs/NAVPatterns/patterns/released-entity/index.md b/content/docs/NAVPatterns/patterns/released-entity/index.md index 89723cb0..f4b2eeb8 100644 --- a/content/docs/NAVPatterns/patterns/released-entity/index.md +++ b/content/docs/NAVPatterns/patterns/released-entity/index.md @@ -1,6 +1,8 @@ +++ title = "Released Entity" weight = 1000 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Authors: Henrik Langbak and Kim Ginnerup, Bording Data_ diff --git a/content/docs/NAVPatterns/patterns/report-selection/index.md b/content/docs/NAVPatterns/patterns/report-selection/index.md index 7a16d6a8..e5b2ff95 100644 --- a/content/docs/NAVPatterns/patterns/report-selection/index.md +++ b/content/docs/NAVPatterns/patterns/report-selection/index.md @@ -1,6 +1,8 @@ +++ title = "Report Selection" weight = 1010 +tags = ["C/AL"] +categories = ["Pattern"] +++ From the PRS workshop at NAVTechDays 2013, this pattern was written by 2 work groups diff --git a/content/docs/NAVPatterns/patterns/security/1-sensitive-data-encapsulation/index.md b/content/docs/NAVPatterns/patterns/security/1-sensitive-data-encapsulation/index.md index 3f0c1582..89adf3be 100644 --- a/content/docs/NAVPatterns/patterns/security/1-sensitive-data-encapsulation/index.md +++ b/content/docs/NAVPatterns/patterns/security/1-sensitive-data-encapsulation/index.md @@ -1,6 +1,8 @@ +++ title = "Sensitive Data Encapsulation" weight = 120 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Bogdana Botez at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/security/2-data-encryption/index.md b/content/docs/NAVPatterns/patterns/security/2-data-encryption/index.md index 1fb363a8..20c4d26b 100644 --- a/content/docs/NAVPatterns/patterns/security/2-data-encryption/index.md +++ b/content/docs/NAVPatterns/patterns/security/2-data-encryption/index.md @@ -1,6 +1,8 @@ +++ title = "Data Encryption" weight = 140 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Bogdana Botez at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/security/3-single-point-of-access/index.md b/content/docs/NAVPatterns/patterns/security/3-single-point-of-access/index.md index e275700c..e2c42eb8 100644 --- a/content/docs/NAVPatterns/patterns/security/3-single-point-of-access/index.md +++ b/content/docs/NAVPatterns/patterns/security/3-single-point-of-access/index.md @@ -1,6 +1,8 @@ +++ title = "Single Point of Access" weight = 160 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Bogdana Botez at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/security/4-masked-text/index.md b/content/docs/NAVPatterns/patterns/security/4-masked-text/index.md index c8593751..9f08fce5 100644 --- a/content/docs/NAVPatterns/patterns/security/4-masked-text/index.md +++ b/content/docs/NAVPatterns/patterns/security/4-masked-text/index.md @@ -1,6 +1,8 @@ +++ title = "Masked Text" weight = 180 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Bogdana Botez at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/security/5-ssl-in-nav/index.md b/content/docs/NAVPatterns/patterns/security/5-ssl-in-nav/index.md index 5a64d5c1..0c8eaf6e 100644 --- a/content/docs/NAVPatterns/patterns/security/5-ssl-in-nav/index.md +++ b/content/docs/NAVPatterns/patterns/security/5-ssl-in-nav/index.md @@ -1,6 +1,8 @@ +++ title = "SSL in NAV" weight = 190 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Bogdana Botez at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/security/_index.md b/content/docs/NAVPatterns/patterns/security/_index.md index 18985e6f..19fab25e 100644 --- a/content/docs/NAVPatterns/patterns/security/_index.md +++ b/content/docs/NAVPatterns/patterns/security/_index.md @@ -1,6 +1,8 @@ +++ title = "Security" weight = 1030 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Bogdana Botez at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/setup-specificity-fallback/index.md b/content/docs/NAVPatterns/patterns/setup-specificity-fallback/index.md index 5022e8c5..d5ca5897 100644 --- a/content/docs/NAVPatterns/patterns/setup-specificity-fallback/index.md +++ b/content/docs/NAVPatterns/patterns/setup-specificity-fallback/index.md @@ -1,6 +1,8 @@ +++ title = "Setup Specificity Fallback" weight = 1060 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Jan Hoek at IDYN_ diff --git a/content/docs/NAVPatterns/patterns/silent-file-upload-and-download/index.md b/content/docs/NAVPatterns/patterns/silent-file-upload-and-download/index.md index 440c4b38..d6b21254 100644 --- a/content/docs/NAVPatterns/patterns/silent-file-upload-and-download/index.md +++ b/content/docs/NAVPatterns/patterns/silent-file-upload-and-download/index.md @@ -1,6 +1,8 @@ +++ title = "Silent File Upload and Download" weight = 1080 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Bogdana Botez, at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/singleton/_index.md b/content/docs/NAVPatterns/patterns/singleton/_index.md index ae9bdf13..8c61390d 100644 --- a/content/docs/NAVPatterns/patterns/singleton/_index.md +++ b/content/docs/NAVPatterns/patterns/singleton/_index.md @@ -1,6 +1,8 @@ +++ title = "Singleton" weight = 1090 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Bogdana Botez at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/singleton/singleton-codeunit/index.md b/content/docs/NAVPatterns/patterns/singleton/singleton-codeunit/index.md index 1c7069a7..1d8a7a83 100644 --- a/content/docs/NAVPatterns/patterns/singleton/singleton-codeunit/index.md +++ b/content/docs/NAVPatterns/patterns/singleton/singleton-codeunit/index.md @@ -1,6 +1,8 @@ +++ title = "Singleton Codeunit" weight = 1100 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Bogdana Botez at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/singleton/singleton-table/_index.md b/content/docs/NAVPatterns/patterns/singleton/singleton-table/_index.md index d2cec690..31bbebb7 100644 --- a/content/docs/NAVPatterns/patterns/singleton/singleton-table/_index.md +++ b/content/docs/NAVPatterns/patterns/singleton/singleton-table/_index.md @@ -1,6 +1,8 @@ +++ title = "Singleton Table" weight = 1110 +tags = ["C/AL"] +categories = ["Pattern"] +++ ## Singleton Table diff --git a/content/docs/NAVPatterns/patterns/singleton/singleton-table/cue-table/index.md b/content/docs/NAVPatterns/patterns/singleton/singleton-table/cue-table/index.md index 913383a6..eff99fd9 100644 --- a/content/docs/NAVPatterns/patterns/singleton/singleton-table/cue-table/index.md +++ b/content/docs/NAVPatterns/patterns/singleton/singleton-table/cue-table/index.md @@ -1,6 +1,8 @@ +++ title = "Cue Table" weight = 440 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Bogdana Botez at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/singleton/singleton-table/setup-table/index.md b/content/docs/NAVPatterns/patterns/singleton/singleton-table/setup-table/index.md index fe9800e2..11ec5be1 100644 --- a/content/docs/NAVPatterns/patterns/singleton/singleton-table/setup-table/index.md +++ b/content/docs/NAVPatterns/patterns/singleton/singleton-table/setup-table/index.md @@ -1,6 +1,8 @@ +++ title = "Setup Table" weight = 1070 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Abhishek Ghosh, at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/standard-journal/index.md b/content/docs/NAVPatterns/patterns/standard-journal/index.md index 1ebb3b12..43f4d4fd 100644 --- a/content/docs/NAVPatterns/patterns/standard-journal/index.md +++ b/content/docs/NAVPatterns/patterns/standard-journal/index.md @@ -1,6 +1,8 @@ +++ title = "Standard Journal" weight = 1150 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Bogdana Botez, at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/temporary-dataset-report/index.md b/content/docs/NAVPatterns/patterns/temporary-dataset-report/index.md index 72a7d87d..b54a4c68 100644 --- a/content/docs/NAVPatterns/patterns/temporary-dataset-report/index.md +++ b/content/docs/NAVPatterns/patterns/temporary-dataset-report/index.md @@ -1,6 +1,8 @@ +++ title = "Temporary Dataset Report" weight = 1190 +tags = ["C/AL"] +categories = ["Pattern"] +++ _Originally by Abhishek Ghosh, at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/totals-and-discounts-on-subpages-sales-and-purchases/index.md b/content/docs/NAVPatterns/patterns/totals-and-discounts-on-subpages-sales-and-purchases/index.md index 19143556..88d0d8a4 100644 --- a/content/docs/NAVPatterns/patterns/totals-and-discounts-on-subpages-sales-and-purchases/index.md +++ b/content/docs/NAVPatterns/patterns/totals-and-discounts-on-subpages-sales-and-purchases/index.md @@ -1,6 +1,8 @@ +++ title = "Totals and Discounts on Subpages Sales and Purchases" weight = 1220 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Nikola Kukrika at Microsoft Development Center Copenhagen_ diff --git a/content/docs/NAVPatterns/patterns/transfer-custom-fields/index.md b/content/docs/NAVPatterns/patterns/transfer-custom-fields/index.md index 3d0d3e78..7745afe0 100644 --- a/content/docs/NAVPatterns/patterns/transfer-custom-fields/index.md +++ b/content/docs/NAVPatterns/patterns/transfer-custom-fields/index.md @@ -1,6 +1,8 @@ +++ title = "Transfer Custom Fields" weight = 1230 +tags = ["C/AL"] +categories = ["Pattern"] +++ {{< youtube cGaBqwfGCws>}} diff --git a/content/docs/NAVPatterns/patterns/variant-facade/index.md b/content/docs/NAVPatterns/patterns/variant-facade/index.md index 0c377d39..cb969300 100644 --- a/content/docs/NAVPatterns/patterns/variant-facade/index.md +++ b/content/docs/NAVPatterns/patterns/variant-facade/index.md @@ -1,6 +1,8 @@ +++ title = "Variant Facade" weight = 1440 +tags = ["C/AL"] +categories = ["Pattern"] +++ _By Nikola Kukrika, waldo and Gary Winter_ diff --git a/content/docs/NAVPatterns/related-links/index.md b/content/docs/NAVPatterns/related-links/index.md index bda8b801..dbcd675d 100644 --- a/content/docs/NAVPatterns/related-links/index.md +++ b/content/docs/NAVPatterns/related-links/index.md @@ -1,6 +1,7 @@ +++ title = "Related Links" weight = 990 +tags = ["C/AL"] +++ Find below some related NAV Design Patterns links. diff --git a/content/docs/_index.md b/content/docs/_index.md index 4adca734..a570e221 100644 --- a/content/docs/_index.md +++ b/content/docs/_index.md @@ -3,7 +3,7 @@ title: "AL Guidelines" linkTitle: Docs weight: 20 description: > - Patterns and Best Practices for AL Develolpment + Patterns and Best Practices for AL Development --- ## Business Central Design Patterns & Best Practices @@ -40,4 +40,4 @@ This project is a Microsoft Business Central Community initiative with support f #### Contributing To find out more about contributing, read up here: -[Contributing](/contributing/) \ No newline at end of file +[Contributing](/contributing/) diff --git a/content/docs/patterns/event-bridge-pattern/index.md b/content/docs/patterns/event-bridge-pattern/index.md index ca46e5b2..e9e2e63c 100644 --- a/content/docs/patterns/event-bridge-pattern/index.md +++ b/content/docs/patterns/event-bridge-pattern/index.md @@ -1,6 +1,6 @@ --- title: "Event Bridge" -tags: ["Interface"] +tags: ["AL","Interface","Extendability"] categories: ["Pattern"] --- @@ -109,7 +109,3 @@ The naming convention (both starting with "IScale") also makes it very easy to f ## When not to use Obviously, the events should be carefully considered: only the events that make sense to "share" over all implementations, need this approach. - -## Discussions - -You can discuss this pattern [here](https://github.com/microsoft/alguidelines/discussions/66) \ No newline at end of file diff --git a/content/docs/patterns/facade-pattern/index.md b/content/docs/patterns/facade-pattern/index.md index ef138707..d9e44757 100644 --- a/content/docs/patterns/facade-pattern/index.md +++ b/content/docs/patterns/facade-pattern/index.md @@ -1,6 +1,6 @@ --- title: "Façade" -tags: [""] +tags: ["AL","Decoupling","Readability","Testability","Extendability"] categories: ["Pattern"] --- @@ -9,6 +9,7 @@ _Created by Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides (Gang of Fo ## Abstract The intent of this pattern is to provide a unified API to a single or a collection of potentially complex subsystems. If you apply this pattern as a general pattern, you will ensure improved: + - Decoupling - Encapsulation - Readability @@ -22,6 +23,7 @@ Whenever you want to write an isolated piece of business logic, from now on refe ## Problem The facade pattern addresses two main problems: + - Over time as systems grow, they tend to become complex and harder to comprehend. By adding a facade on top of the subsystem, that complexity is hidden, and a clear API is defined. - Any object or method which is publicly accessible, may not receive breaking changes in future releases without announced deprecation. This complicates maintainability of the system. By adding a facade, you ensure that the subsystem is inaccessible to the outside systems, enabling you to change the implementation details of the subsystem at will. @@ -59,7 +61,7 @@ This is arguably one of easiest patterns to understand and implement. Loosely sp To achieve this, we are using [access modifiers](https://docs.microsoft.com/bs-cyrl-ba/dynamics365/business-central/dev-itpro/developer/devenv-using-access-modifiers). Let's try to take a look at an example, taken from the system application: [the Image module](https://github.com/microsoft/ALAppExtensions/tree/main/Modules/System/Image). I'm using this very simplified example for illustration purposes. Notice, that even the full subsystem at time of writing isn't complex - it merely has a single codeunit containing the implementation details. However, as it is expected that the complexity will increase over time or that the implementation details can change, the subsystem is already equipped with a facade from the beginning. -*The Facade* +_The Facade_ ```AL codeunit 3971 Image @@ -90,6 +92,7 @@ codeunit 3971 Image ``` The facade codeunit above has some characteristics: + - Access is explicitly set to Public, to underline that this is a facade. - All methods are public. - All methods are documented. @@ -102,7 +105,7 @@ Anyone who wants to access the subsystem, will only have to relate to this one p Test of the subsystem can be limited to testing the facade - it is strictly speaking the only thing that needs verification, that it functions as designed. It is the contract of the subsystem. -*The Subsystem* +_The Subsystem_ ```AL codeunit 3970 "Image Impl." @@ -135,6 +138,7 @@ codeunit 3970 "Image Impl." There are no rules for the subsystem, except that access needs to be **internal**. How you implement, how much you document, how you test, is entirely up to you and not the business of the outside caller. Of course, you should apply all of the best practices and patterns anyway, as you and possibly other developers will have to understand, extend and maintain the subsystem too. But from the view of this pattern, the complexity of the subsystem is irrelevant - just as long as it's not accessible. ## Usage + The facade pattern is one of the most prominent patterns in the [system application](https://github.com/microsoft/ALAppExtensions/tree/main/Modules/System). You will find plenty of examples here. ## Benefits @@ -142,18 +146,23 @@ The facade pattern is one of the most prominent patterns in the [system applicat The benefits of this rather simple pattern should be abundantly clear by now. But let's go over them once more, structured by the advantages this patterns brings: ### Decoupling + As the entire subsystem is inaccessible to outside systems, no dependencies can be taken. Hence this patterns strongly promotes the decoupling of objects. ### Encapsulation + The entire purpose of this very pattern is to encapsulate complexity; you hide away the implementation details behind an easy to understand facade. ### Readability + If done right, the developer doesn't need to be able to understand the details of the subsystem. Everything relevant to using the subsystem is described in the facade. ### Testability + Ensuring the correct behaviour of the subsystem can be done by testing the facade. The facade defines the contract of your subsystem - what does it expose and how should it behave. That contract should be covered with adequate tests, which will ensure that it is upheld, even if you decide to change the implementation of the subsystem. ### Maintainability + The one thing you may not change freely, is the facade and the test of the facade. It can be extended, but you should not break any existing APIs. But that leaves the entire subsystem to be completely rewritten, if you desire to do so. As no external dependencies can exist, there is no risk of introducing any syntactical breaking changes to the outside world. And as the tests of the public facade remain, there is no risk of introducing semantical breaking changes either - the contract is upheld, as long as your tests pass. ## When not to use @@ -173,6 +182,3 @@ This is one of the most commonly used and discussed, initially described here: It is also a key pattern in the design of our system application modules, which is described here: [Module Architecture](https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-blueprint) - -## Discussions -You can discuss this pattern [here](https://github.com/microsoft/alguidelines/discussions/42) \ No newline at end of file diff --git a/content/docs/patterns/generic-method-pattern/index.md b/content/docs/patterns/generic-method-pattern/index.md index 13083941..f5ad9769 100644 --- a/content/docs/patterns/generic-method-pattern/index.md +++ b/content/docs/patterns/generic-method-pattern/index.md @@ -1,6 +1,6 @@ --- title: "Generic Method" -tags: [""] +tags: ["AL","Decoupling","Readability","Testability","Extendability"] categories: ["Pattern"] --- @@ -9,6 +9,7 @@ _Created by Gary Winter (Cloud Ready Software), Described by waldo (iFacto Busin ## Abstract The goal of this pattern is to facilitate a lot of things in one single awesome way of writing code. If you apply this pattern as a general pattern, you'll implement: + - Extensibility - Decoupling - Readability @@ -25,11 +26,11 @@ Usually, when you ask people where to place code, they all have their own opinio ## Description -What if we have some kind of "standard way" to always write our code. The *Generic Method Pattern* is kind of like what it says: a generic way to implement a method. +What if we have some kind of "standard way" to always write our code. The _Generic Method Pattern_ is kind of like what it says: a generic way to implement a method. ### What is a method? -Well, a method is *a significant piece of business logic* - maybe best explained by some examples: +Well, a method is _a significant piece of business logic_ - maybe best explained by some examples: - Posting a document - Any button on a page that executes business logic @@ -41,7 +42,7 @@ In a way, except "data validation", most of the things we write in our daily lif ### The Pattern **One method, one codeunit** -The idea is to put the code in one *encapsulated* codeunit with the purpose to have all the code in that one codeunit function for that one method. This way, the codeunit will stay relatively small and readable. +The idea is to put the code in one _encapsulated_ codeunit with the purpose to have all the code in that one codeunit function for that one method. This way, the codeunit will stay relatively small and readable. Let me start by showing an example, so you can refer to this complete example during the rest of the article: @@ -101,17 +102,19 @@ codeunit 53100 "WLD BlockCustomer Meth" ``` Within that codeunit, the pattern is always the same: + - One public (internal) procedure - The rest is always local So, from outside the codeunit, there is only one clear entrypoint: that one (public) internal function with its parameters. The **pattern** within the codeunit exists of a few layers: + - The UI layer - The Event layer - The method layer -*The UI layer* +_The UI layer_ The UI layer takes care of the UI, obviously. What is important in this case, is that you always make sure that there is a "HideDialog" parameter that the business logic can use to still decide whether to use the dialog or not. These are the UI Layer parts, where you see the public function gets the HideDialog, and passes it to the UI-related procedures, where the business logic for showing the UI takes place. Also, the default answer of the confirmation is handled there as well (what if the business logic calls this method with HideDialog to "true"). @@ -152,7 +155,7 @@ codeunit 53100 "WLD BlockCustomer Meth" } ``` -*The Event layer* +_The Event layer_ This layer is going to add flexibility to any app that has a dependency on this app. By default, the pattern always foresees an `OnBefore` and an `OnAfter` event. This is the relevant code for the event layer: @@ -183,7 +186,7 @@ codeunit 53100 "WLD BlockCustomer Meth" } ``` -*The method layer* +_The method layer_ The last layer is obviously where the business logic will be written. The relevant part is: @@ -211,7 +214,9 @@ codeunit 53100 "WLD BlockCustomer Meth" ... } ``` + Usually indicated with a "do"-function, the business logic takes place in that procedure. Obviously, when you have a decent amount of code, it's recommended that you make it readable by applying all the Best Practices in terms of readability in the codeunit. Though, a few pointers here: + - keep the [cyclomatic complexity](https://en.wikipedia.org/wiki/Cyclomatic_complexity) low - one line (function call) after an IF-clause - one line (function call) after a repeat @@ -243,11 +248,12 @@ tableextension 53100 "Customer Ext BASE" extends Customer This practice improves readability. In fact, by doing this, you just extended the suggestions-list in VSCode (IntelliSense) indicating a new method that your class can do. This is very convenient for the developer that might need your new method. -*Note - it could very well be that there simply isn't any table that can act as a class for our method. In that case, you could use a codeunit as well.* +_Note - it could very well be that there simply isn't any table that can act as a class for our method. In that case, you could use a codeunit as well._ **Naming Conventions** You might have noticed that the naming of our method is quite strict: + - codeunit name: `WLD BlockCustomer Meth` - internal proc: `BlockCustomer` - do-procedure: `DoBlockCustomer` @@ -255,6 +261,7 @@ You might have noticed that the naming of our method is quite strict: It is important to align these namings. It indicates that the codeunit only does one thing (remember: encapsulation), and it improves searchability from outside the codeunit (for example when you're searching symbols or something). ## Usage + Currently, there is no usage of this pattern in the BaseApp. The pattern has a main advantage in an ISV product, just because of the decoupling and extensibility. Although, I have seen many occasions where parts of the pattern was useful on PTE's as well. You simply never know if ever at the customer site, there is going to be another partner that needs to create its own PTE, and has to depend on yours. So I'd say, this pattern is everywhere applicable, no matter the type of the app. @@ -264,9 +271,11 @@ The pattern has a main advantage in an ISV product, just because of the decoupli As I said, it will facilitate a lot of advantages. Let's explain a bit more in depth: ### Extensibility -Thanks to the *event layer*, by applying this pattern for all methods, we will automatically have the bare minimum of events that we need to hook into a method: the `OnBefore-` and the `OnAfter`. Of course it would make sense to even add more events to the method when appropriate (eg, when you're inserting a record in a table, it might be interesting to also raise an event just before you call the insert). + +Thanks to the _event layer_, by applying this pattern for all methods, we will automatically have the bare minimum of events that we need to hook into a method: the `OnBefore-` and the `OnAfter`. Of course it would make sense to even add more events to the method when appropriate (eg, when you're inserting a record in a table, it might be interesting to also raise an event just before you call the insert). ### Decoupling + Thanks to these same events, and the fact the pattern foresees a handler as well, we are able to "decouple" our method as well. What do I mean with that? Well, we can simply subscribe to the `OnBefore`event, and set `IsHandled` to `true`. This means it will never execute the do-procedure, which means, the original procedure/method/business logic is "decoupled". We can use this obviously for implementing our own method (a new way to accomplish this method), or to disable the method by simply subscribing to it, and only providing the `IsHandled := true` in our subscriber. However, there are many more usages where we can use this for. @@ -277,34 +286,41 @@ if you would apply this pattern to your product, at the customer, you'll be able This gives a lot of flexibility. ### Readability + When we talk about readability, we actually talk about the part where we expose our method on the class. The rule is: never call the codeunit, but only from one place: from its "class" - or in BC terms: its table (or codeunit). In terms of readability, that means that intellisense comes into play. In stead of: + ```AL Codeunit.Run(Codeunit::"Sales-Post", SalesHeader); ``` + you simply get + ```AL SalesHeader.Post(); ``` + THAT is readable. The previous is not! That is just something we got used to. ### Testability + There are two things in terms of testability where this pattern helps a lot. -*Unit testing* +_Unit testing_ You can interpret "unit testing" very broadly. But just imagine: when you're building your software entirely out of "methods" - which means: when you'd build your software entirely with this "Generic Method Pattern". Now, the list of methods, are all the units that you need to test: if you test all your methods, you kind of like test the majority of your software, right? So you could simply set up rules in your company like: EVERY method needs a test-codeunit. And even more: since every method only has one global function - it's pretty easy to know the context, and all the flavors to test your method. The pattern describes the tests that needs to be written. -*Disabling methods* +_Disabling methods_ Coming back to the "decoupling" part - in tests, you actually might need it more than you realize. Just imagine: you want to test method 1, but method 2 comes in the way by interfering with configurations that you need to do, or UI that is popping up, while it could be completely pointless. Solution: simply - within your test-codeunit - subscribe (with a manual subscriber) to method 2, set `IsHandled` to `false` - done! ### Encapsulation -Don't underestimate the power of the encapsulation part of this pattern. One of the first questions that people ask themselves when reading into this pattern is: "*isn't it going to consume all my codeunit-id's*" or "*so many codeunits, that can't be readable, right?*". + +Don't underestimate the power of the encapsulation part of this pattern. One of the first questions that people ask themselves when reading into this pattern is: "_isn't it going to consume all my codeunit-id's_" or "_so many codeunits, that can't be readable, right?_". The fact that the functionality of one method is encapsulated in one codeunit is very powerful. You'll avoid [Boat anchors](https://sourcemaking.com/antipatterns/boat-anchor) simply because because, thanks to the encapsulation, there is a limited amount of code in the codeunit, of course. And because of that, it so much more maintainable, upgradable, readable, .. . Only advantages. @@ -316,13 +332,14 @@ So all I can say is: use your common sense. One example: set the bar at "validation code": any code that is solely there to facilitate data integrity doesn't belong in method codeunits. -Another tip might be: don't let the amount of codelines trick you in deciding to *not* use this pattern: when it's a method, it's a method. When it makes sense to be able to extend, decouple, .. then this pattern can help. +Another tip might be: don't let the amount of codelines trick you in deciding to _not_ use this pattern: when it's a method, it's a method. When it makes sense to be able to extend, decouple, .. then this pattern can help. ## Snippets [waldo's CRS AL Language Extension](https://marketplace.visualstudio.com/items?itemName=waldo.crs-al-language-extension) contains snippets that help you in setting up the boiler plate code in a matter of seconds. The snippets are: + - `tcodeunitMethodWithoutUIwaldo` - `tcodeunitMethodWithUIwaldo` @@ -331,7 +348,3 @@ The snippets are: There have been a number of occasions where people have been sharing this pattern. Here is one: {{< youtube id="CWpaD9RUa6U" yt_start="1516" >}} - - -## Discussions -You can discuss this pattern [here](https://github.com/microsoft/alguidelines/discussions/41) \ No newline at end of file diff --git a/layouts/partials/navbar.html b/layouts/partials/navbar.html index 4826ff28..8cff9995 100644 --- a/layouts/partials/navbar.html +++ b/layouts/partials/navbar.html @@ -1,7 +1,7 @@ {{ $cover := and (.HasShortcode "blocks/cover") (not .Site.Params.ui.navbar_translucent_over_cover_disable) }}