Chapter 1. Introducing Dynamics NAV Patterns and Software Architecture

 

"Design patterns have always been the "secret source" of NAV, enabling developers to learn new areas of the application and be productive without a huge ramp up. This makes design patterns key to understanding the architecture of NAV and writing repeatable code."

 
 --Michael Nielsen, Director of NAV Development

In this book, we will journey into how to build repeatable and upgradable solutions for Microsoft Dynamics NAV. We will do this using a combination of design patterns and coding best practices. We will also cover anti-patterns, and the methodologies of handling the legacy code.

By improving the repeatability and upgradability of your software, the total cost of ownership (TCO) is reduced, which leads to better margins and better return on investment (ROI).

The examples and screenshots are based on the current version of the product, Microsoft Dynamics NAV 2015, but all of the concepts can be applied to any older version of the product too.

In this chapter, we will cover:

  • Introduction to Software Design Patterns
  • Pattern elements and hierarchy
  • The Dynamics NAV building blocks
  • The Metadata driven development

What do we mean by 'patterns'?

Wherever you look in life, you see patterns. Even life itself follows a pattern. Patterns help us in being organized by giving us structure, which makes things easier for us to understand. Without structure, we start being stressed and disorganized.

As this is true for many things in our lives, this is also true in computer programming. Applying structure in our computer programs make them easier to understand and maintain. Each profession has patterns that have proven to be successful in certain conditions, and unsuccessful in other conditions.

Software design patterns

Good old Wikipedia defines software design patterns succinctly as "A general reusable solution to a commonly occurring problem within a given context in software design." By nature, people look for ways to get organized and structured. It is not a surprise that during the 1970s and 1980s people started to look for structures in computer programming, which was a new, fast growing business.

You can read more about the software Design Patterns on Wikipedia at https://en.wikipedia.org/wiki/Software_design_pattern. Software design patterns, especially in object-oriented programming (OOP), gained popularity in the 1990s when after Design Patterns: Elements of Reusable Object-Oriented Software was published by the Gang of Four, Erich Gamma, Chard Helm, Ralph Johnson, and John Vlissides. They published 23 classic software design patterns. Since then, many other patterns have been documented. Many of these were based on object-oriented programming, but people also started to document patterns outside this context.

The Procedural software design patterns

The product that we work with, Microsoft Dynamics NAV, has a programming language that people refer to as Procedural. It was invented in the 1980s and is based on Pascal, which is a very popular programming language that is still loved by many.

Note

In this article, Paul Ford explains the history of code, procedural languages, and object oriented programming at http://www.bloomberg.com/graphics/2015-paul-ford-what-is-code/#b06g24t20w15.

As with everything in life, we seek structure, hence we can apply software design patterns to Procedural languages. We just need to look carefully at all the object-oriented content that is available, and cherry-pick what applies. We can then complete this content with specifics of our language.

Procedural languages preceded the more modern object-oriented languages. One of the challenges that object-oriented programming is trying to solve is grouping things together that belong together. For this, classes are used. In this book, we will attempt to do this as well by treating tables and codeunits as a class, and then grouping functions together accordingly.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset