Programming Microsoft Dynamics NAV(Fifth Edition)
上QQ阅读APP看书,第一时间看更新

C/AL programming language

The language in which NAV is coded is C/AL. A small sample of C/AL code within the C/AL Editor is shown here:

C/AL syntax is similar to Pascal syntax. Code readability is always enhanced by careful programmer attention to structure, logical variable naming, process flow consistent with that of the code in the base product and good documentation both inside and outside of the code.

Good software development focuses on design before coding and accomplishing design goals with a minimum of code. Dynamics NAV facilitates that approach. In 2012, a team made up of Microsoft and NAV community members began the NAV design patterns project. As defined in Wikipedia, a design pattern is a general reusable solution to a commonly occurring problem.  Links to the NAV design patterns project information follow:

A primary goal of this project is to document patterns that exist within NAV. In addition, new best practice patterns have been suggested as ways to solve common issues we encounter during our customization efforts. Now, when working on NAV enhancements, we will be aided by reference to the documentation of patterns within NAV. This allows us to spend more of our time designing a good solution using existing, proven functions (the documented patterns), spending less time writing and debugging code. A good reference for NAV design and development using patterns can be found here: https://www.packtpub.com/application-development/microsoft-dynamics-nav-2013-application-design

The NAV 2017 Reusing Code section states the following:

"Reusing code makes developing applications both faster and easier. More importantly, if you organize your C/AL code as suggested, your applications will be less prone to errors. By centralizing the code, you will not unintentionally create inconsistencies by performing the same calculation in many places, for example, in several triggers that have the same table field as their source expression. If you have to change the code, you could either forget about some of these triggers or make a mistake when you modify one of them."

Much of our NAV development work is done by assembling references to previously defined objects and functions, adding new data structure where necessary. As the tools for NAV design and development provided both by Microsoft and the NAV community continue to mature, our development work becomes more oriented to design and less to coding. The end result is that we are more productpe and cost effectpe on behalf of our customers. Everyone wins.