That's the question… Many rookies have problems with decision where to put the code (or from where to call it). When you watch some beginner in NAV where the code is placed and from where it is called, you can find out that in many cases used triggers are the triggers, which in 99% are not used in the application and many Pro developers nearly do not know what the triggers are doing :-).
I had a thought. To create small decision tree which can help developers to find out, which trigger will be best for calling the code, and where to place the code in (table, codeunit etc.). I placed the first file to google code repository site under project named "The Art of NAV". I will try to keep this site as the Home page of this project. We will see, maybe I will find better tool for that.
I am waiting for your opinions and comment. I will try to keep the project live and up to date. We will see, if it helps you.
This is a first step I am doing and I am thinking about it as an initial step for something I am calling "NAV Art" or "The Art of NAV". My target is to help all developers to make the code as clear as possible and make some order in the NAV word. Of course, there is no simple manual or something for that, but I want to open some discussion about that and give some ways for the specific problems. I hope that I am not alone in that and you all will try to participate in this.
Original Visio file can be downloaded from The Art of NAV and you can find there 200DPI images of the diagrams too. Included images on this page are just examples.
I am Waiting for your comments...
Great story as for me. It would be great to read more about that theme. Thnx for posting that material.
1) There is missing "No" text on the edge from "Process based on Rec" and "Isn't codeunit better".
2) I do not understand your sentence "When you are in "Function working on REC" you can't go to "Isn't codeunit better"" - yes, you cannot go there, if you find that the process is based on the rec. In this case the recommendation is to place the code into function defined in the table and the decision tree ends.
The last two steps of the second picture look a bit strange to me. When you are in "Function working on REC" you can't go to "Isn't codeunit better"
x: Process based on the current record?
Yes ==> x+1
No ==> use Codeunit
x+1: Complex function?
Yes ==> Use Codeunit
No ==> Use Function working on REC
May be yes, may be no. First thing is discussion about some things, than the result can be included in the wiki. I do not want to insert into wiki something which is not in some state good for release. I want first to discuss about the things and than make some conclusions which can be on the wiki.
Isn't that what the NAV book wiki (http://wiki.dynamicsbook.com) is for?