The NEW Microsoft in Design Patterns

Hi everyone. It has been a while since I blogged and especially about patterns.

This is being written from Kastrup Airport Denmark and I just got back from Lyngby where I did a Master Class Summer School.

As always I had a lot of experienced people in the class and we ended up talking about legacy code and programming the “old” way and the “new” way.

Some programmers find it not so easy to see that our source code is improving. In this post I want to highlight some examples anyone can find in NAV2016 code that illustrates how Microsoft is moving forward and moving to more modern code in AL.

Natural Language Programming & Refactoring

I agree, it is not easy to find the places but Microsoft is moving into more readable code and doing refactoring.

About half a year ago I blogged about the refactoring Microsoft did in codeunit 80 and 90.

If you look at how they refactored you can clearly see that they are moving to more readable code, what I call “Natural Language Programming”.

MandatoryFields

 

Old Code

MandatoryFields2

Arguments Table

Another thing I blogged about last year is the introduction of the Arguments Table.

This is where Microsoft started to use a table as a class. The table has a function “Send”. Making this probably as close as we can get to OOP in AL.

ArgumentsEmail

Auto Increment

The Auto Increment property is a great way to solve performance issues caused by Transaction Isolation.

Microsoft changed the Reservation Entry table to be Auto Increment, instead of LOCKTABLE, FINDLAST, +1

Encapsulation

This was implemented in NAV long time ago in codeunit 99000854 Inventory Profile Offsetting

Encapsulation

So, you can see AL is a modern programming language that allow you to write decent code and Microsoft is taking the lead!

Enjoy summer


Related
Recommended