mfp's two cents

...on Dynamics AX Development!
  • mfp's two cents

    I am working on AX6.0 - what are you working on?

    • 10 Comments

    The ready-set-go call has just resonated through the hallways at Microsoft, and we are now officially working on the next release of AX. What will the next release of AX look like? What features will it contain? What architectural changes will we make? What tools should we support? These are some of the many questions we will be working on during the upcoming months while we are defining the scope for the next release. I work in the Developer and Partner Tools team. This means I get to influence decisions like: "Should MorphX move into Visual Studio?", "How many layers should AX 6.0 have?", "Should X++ support eventing?", "Do we need an Entity concept in the AOT?", "How do we make our unit test cases available to partners?" - just to name a few. These are the questions that can get me out of bed in the morning - for a lot of good reasons, but primarily because I know my job makes a big difference to a lot of people.

    If you want to join me shaping the future of AX at Microsoft Development Center Copenhagen, please visit:
    http://www.microsoft.com/danmark/om/mdcc/default.mspx

  • mfp's two cents

    What's up with this semicolon?

    • 10 Comments

    The most visual idiosyncrasy in X++ is the dangling semicolon separating the variable declarations from the actual code. But why is it there and why is it needed?

    Best practices in X++ (as in most other modern languages) suggest using TitleCase when declaring (and referring to) types, and using camelCase when declaring variable types. Here is an example of what an X++ developer could write:

    AccountNum accountNum;
    ;
    accountNum = "4000";

    As X++ (unlike most other modern languages) is case insensitive, this is what the compiler will see:

    accountnum accountnum;
    ;
    accountnum = "4000";

    Suppose the dangling semicolon wasn't there. Then the "accountnum" statement in the second line is ambigious. It could either refer to the type or to the variable. The X++ compiler assumes it is the type, and thus generates a compilation error when encountering the equal (=) sign; as you cannot assign into a type. By inserting the dangling semicolon you instruct the compiler that there will be no more variable declarations; and thus "accoutnum" is a reference to the variable and not the type.

    If it was made a priority to get rid of dangling semicolons, what could be done?

    1. X++ could be made case sensitive. This would likely break all customizations and solutions available; unless it is accompanied with a code "beautifier".
    2. The compiler could be made more intelligent by looking one more token ahead before giving up. As human beings easily can see through the ambiguity; the compiler should be able to do so too. I guess the developer solving this issue would kudos in AX-land.

    The above is a draft of a blog post I wrote last week. I wrote it for two reasons: Mainly to explain the dangling semicolon issue, and secondarily to lay out bait for a developer on the X++ team. As it turned out more progress was made this weekend than the past eleven years in this corner of AX . After writing the draft above I decided to take a look under the covers in the compiler; to gauge the challenge, I guess. So I installed the latest version of VS and downloaded the latest source code for the kernel. (These are some of the freedoms you enjoy when working for Microsoft). After playing around with the grammar for a while, I came to the conclusion that the grammar is crisp and clear; the scanner is just feeding the wrong tokens to the parser. I found the spot where non-keyword tokens are evaluated. I discovered that if a token shares name with an X++ type (Class, Table, EDT, etc.) the parser assumes it is a type-token. After finding this spot it took me less than two hours to write some code that reads one token ahead and only assumes the current token is a type-token when it is followed by another non-keyword token. Sunday afternoon I had build 585 (the Release Candidate (RC0) of AX 2009) with a twist on my box: The dangling semicolon is no longer a requirement. I enjoyed the rest of the day in the sun with my family.

    This morning I have created a package with my findings and sent it to the X++ team for evaluation. This change will not make it into AX 2009; but I'm confident those of us writing X++ code at Microsoft will enjoy this very soon. The rest of you will have to wait for AX6.0.

  • mfp's two cents

    Anyone interested in developer documentation of X++ code?

    • 8 Comments

    A new feature in Dynamics AX 2009 enables developers to write developer documentation directly in the X++ Editor while writing the production code. The feature is very similar to the XML documentation feature in C#.

    Basically any method can contain /// (triple-slash) comments followed by structured documentation in XML format. Here is an example:

    The developer is assisted by a dynamic documentation template, which is inserted through an editor script. The template automatically builds a skeleton including all the required tags for the current method. On top of this the written documentation is validated by best practice rules; which effectively prevent the documentation from growing stale. Finally a tool enables extraction of the documentation, so it can be processed outside AX, e.g. for publishing on MSDN.

    But who really cares about this? Great tools won't make my day - I want documentation!

    Dynamics AX 2009 contains about 125.000 table and class methods in the SYS layer. To give a perspective on this number, it will take you over 15 years to document them all, if you can document 5 methods an hour.

    All the methods shipping with Dynamics AX 2009 will have some documentation:

    • 10% will be available in the X++ source code, in the product documentation and on MSDN. This content has been written by developers for developers. (and reviewed by Content Publishing).
    • 20% will only be available in the product documentation and on MSDN. This is pattern matched documentation for methods such as main(), construct(), pack(), unpack() and parm(). This documentation has been written once for each pattern, and then applied to all methods matching the pattern.
    • 70% will only be available in the product documentation and on MSDN. This is automatically generated minimal documentation for methods that we haven't manually documented. It contains syntax and other high level information.

    Or in other words:

    • You will never see the dreaded boilerplate "At the time of publication..." again.
    • About 40.000 methods contain human written developer documentation.
  • mfp's two cents

    AX 2012 R2 CU7 has been released!

    • 8 Comments

    Cumulative Update 7 for Dynamics AX R2 has been released today!  Download it from Partner Source or Customer Source.

    Besides 60 country specific regulatory updates and many quality improvements, these areas have been enhanced:

    Area 

    What’s new

     

    Accounts payable

    • New options for configuring workflows for vendor invoices.
    more info

    Accounts receivable

    • External documents can now be sent as email to a customer or vendor by using the email address that is specified by the address purpose field. Any report can be sent as email to an internal employee by using the worker title.
    more info

    Budgeting

    • You can create a budget plan worksheet template for Excel by using a wizard in Microsoft Dynamics AX.
    • The budget allocation process is easier, because you can use ledger allocation rules for budgets.
    • Budget planning workflows can be set up so that they can’t be accidentally deleted or reset.
    • Budget planning workflows can be set up so that they require a parent budget plan.
    • You can specify whether budget planning user groups (XDS policies) are used for budget planning. You can also specify the number of associated budget plan lines to include when budget plans are exported to Excel.
    • You can view worksheet and justification documents from the Budget plan page in Enterprise Portal for Microsoft Dynamics AX.
    • The process of creating a budget plan from an existing budget plan is enhanced.        

    more info

    Fixed assets

    • You can now transfer more than one fixed asset at the same time.
    • The acquisition cost of fixed assets can include a miscellaneous charge amount.
    • The process for acquisition proposals or depreciation proposals for fixed assets can now be run in a batch process.

    more info

    General ledger

    • An Excel template for journal entries is included on the virtual machine for demo data.
    • More understandable posting messages for journal lines that have errors in the account combination.
    • Delete an unposted journal that contains lines.
    • View advanced rules for a main account.
    • Easier dimension setup for Excel integration.
    • Display dimensions in a specified order in Management Reporter.

    more info

    Human resources

    • New preparation reports available to help make it easier for employers to complete mandatory human resource reports.
    • Changes to the forecast positions area .
    • You can require additional details when worker information is entered or changed, and optionally enable workflow.         

    more info

    Inventory and warehouse management

    • New On-hand entries cleanup batch job can be used to delete unused entries for serialized on-hand inventory, helping to improve the performance of queries for on-hand inventory.
    • You can combine two or more inventory batches into a new or existing batch.
    • Added new Role Center for costing and inventory valuation.

    more info

    Payroll

    • You can mass update benefit rates for workers.
    • Tiered contribution calculation rates for retirement benefit plans.
    • Create and update payroll tax groups.
    • Preparation of regulatory compliance reports for payroll.
    • Separate positive pay statements for Payroll bank accounts.

    more info

    Procurement and sourcing

    • Financial dimensions can be specified on sales agreements or purchase agreements.
    • A Totals FactBox is added to the Purchase orders list page.

    more info

    Product information management

    • You can determine prices using a product configuration model.

    more info

    Production control

    • Case management functionality is enhanced for documenting and releasing product changes to production.

    more info

    Project management and accounting

    • Use Microsoft Project to create or update a Microsoft Dynamics AX project plan, and integrate with an Office 365 SharePoint project site.
    • Use Microsoft Project to create or update the work breakdown structure (WBS) for a Microsoft Dynamics AX project quotation.
    • Create a WBS template for Microsoft Dynamics AX by using Microsoft Project.
    • Expanded support for working with project teams, defining project role types, and managing projects.
    • Expanded support for managing worker assignments and capacity in projects.
    • Enable audit trails on timesheet entry and reporting.
    • Improved management of project tasks in a WBS.
    • Improvements for creating WBS templates for project tasks.
    • Intercompany pro forma invoices for project costs.

    more info

    Public sector

    • The configuration keys for public sector organizations in France are enabled by default, hence the primary address of the organization no longer has to be in France if you want to use the French public sector accounting rules.
    • You can now dispose of more than one fixed asset at the same time.

    more info

    Retail

    • Prompt for a reason code when the cashier opens the cash register drawer without performing a sale transaction.
    • You can post store transactions from statements based on the end of the business day instead of the calendar day.
    • You can use a new statement method to calculate statements by shift.
    • Passwords can now be changed and reset in Microsoft Dynamics AX for Retail POS.
    • Cashiers can view additional customer account information in Retail POS.

    more info

    Sales and marketing

    • You can calculate the sales price of an item by using an attribute-based pricing formula.

    more info

    Backup and recovery

    • We have added functionality for backup and recovery for cumulative update 7 for Microsoft Dynamics AX 2012 R2.

    more info

    Data import, export, migration

    • As of CU7, the Data Import/Export Framework is shipped as part of AX instead of as an add-on.

    more info

    Office Add-ins

    • Improved performance when you use the Office Add-ins. A new Validate dimensions button helps you locate and correct financial dimensions that were entered incorrectly or that are suspended.

    more info

    Reporting

    • PowerShell commandlet to install multiple instances of SSRS on the same SQL server
    • SSRS is primed after restart to speed up "first time" execution of reports
    • Can send reports to people using a token (@<Job Title>@) instead of being forced to name people explicitly
    • MorphX compare tool enhanced to support reports
    • Management Reporter can now be installed with primary AX setup

    more info

    Sales tax processing

    • Sales taxes and ledger accounts can be reconciled more easily.
    • Performance is improved for tax reporting.
    • You can post of sales tax amounts for intercompany transactions to either the source legal entity or the destination legal entity.

    more info

  • mfp's two cents

    X++ Pedal To The Metal

    • 7 Comments

    This is a post I’ve been waiting to write for quite a while – but it had to wait until R3 became available.

    T-Shirt-Fast Xpp The SysExtension framework offers some great capabilities, but unfortunately it also comes with a performance penalty (in R2). A while ago I set out to understand where the time was spent, and hoping to optimize it. As an engineer this is a typical task with an expected outcome: A few days spent, an optimization of 10-20 percent is found. This time the task turned out to completely consume me for the better part of a week, I learned some important lessons, and the outcome exceeded my wildest imagination. This blog shares my findings.

    Starting point

    To be able to measure the impact of any changes I build a very simple test harness to exercise the SysExtension framework. A two level deep class hierarchy and one attribute that decorated the sub-class. I then compiled everything to IL, and wrote a small job to measure how many class instances I could spin up per second. This velocity measurement was around 3,400 classes/second.

    First success

    Debugging through the code I quickly learned that a lot of things were going on. This included creating a key for the attribute for various caches. This key was constructed via reflection on the attribute class. I avoided using reflection by introducing a new interface (SysExtensionIAttribute) and I fixed a number of other minor issues. Now the velocity jumped to 40,000 classes/second.

    First physical limit

    Is this an acceptable velocity? Well, how fast can it possibly be? The logic is in essence just creating a class via reflection, so I did a measurement of DictClass.MakeObject(). This could give me 84,000 classes/second. Slightly about double of the my current implementation. After some investigation I discovered two expensive calls: “new DictClass()” and “dictClass.makeObject()”. Can you spot what they have in common?  They both requires a call into the native AOS libraries. In other words an interop call. I tried various other calls into the AOS, such as “TTSBegin” (only the first is hitting the DB), and “CustParameters::Find()” (again, only the first one is hitting the DB). To my surprise the velocity of these calls where comparative to DictClass.MakeObject(). The interop overhead outweighs what the method is actually doing.  In other words, there is a limit to how many native AOS methods you can call per second. Let us call this velocity: Speed-of-sound.

    Ultimate physical limit

    Being a bit intrigued I measured the fastest and rawest possible implementation: “new MyClass()”. This would run strictly in IL, no overhead of any kind, the result was a whooping 23,800,000 classes/second.  Let us call this velocity: Speed-of-light. In the words of Barney Stinton: “Challenge accepted!” 

    Final success

    To achieve this kind of velocity the code must run 100% as IL. No calls into native AOS code. Period. Naturally there are APIs in .NET allowing for dynamically creation of class instances – they are slower than a direct instantiation, but still much faster than calling native AOS code. One other challenge was that SysExtension also can execute as pCode, and then a call into IL would cause a similar slow interop – just in the opposite direction. After a few iterations I had an implementation that would not cause an interop calls, regardless of if the code runs as IL or pCode. Take a look at SysExtensionAppClassFactory.getClassFromSysExtAttribute in R3 for details. I was pleased with the velocity: 661,000 classes/second. Or about 200 times faster than R2. Or about 15 times faster than a call to CustParameters::Find(). 

    Problem solved: The SysExtension framework no longer has performance issues.

    image

    Conclusion

    For a long time we have been hunting for SQL and RPC calls when looking for performance. RPC calls are expensive, as communication between two components (Client and Server) occurs. Just like SQL calls are expensive as the Server communicates with SQL (and waits for the reply). We still need to hunt for unnecessary RPC and SQL calls! Nothing changed; except that a third culprit has been identified: Native AOS calls. Relatively speaking the cost of calls into native AOS code is insignificant when compared to RPC or SQL calls – in the absence of these, the impact is measurable and significant.

    This is an ERP system, so there will always be SQL calls. So why be concerned with the performance of X++ code?  Well, if you can minimize the time between SQL calls, then you will also limit the time SQL holds locks, and you will experience better overall performance and scalability. After all, do you want you code to run with the speed-of-sound or speed-of-light?

    Update 11-05-2014:
    Here is the test harness I used: PrivateProject_SysExpProject.xpo

  • mfp's two cents

    Microsoft Dynamics AX 2009 White Paper: Integrating a Third Party Version Control System into Microsoft Dynamics AX 2009

    • 6 Comments

    A new white paper has been published on how to intergrate a third party version control system with AX2009. The white paper is a case study of the steps the MorphX team had to go through in order to integrate Team Foundation Server (TFS) into AX2009.  

    The white paper is available for download at these locations:

    Microsoft Download Center:
    http://www.microsoft.com/downloads/details.aspx?FamilyID=48f803fc-5ded-44a8-a442-e499f2db6382

    CustomerSource:
    https://mbs.microsoft.com/customersource/documentation/whitepapers/ax2009_integratingthirdpartyvcs

    PartnerSource:
    https://mbs.microsoft.com/partnersource/deployment/documentation/whitepapers/ax2009_integratingthirdpartyvcs

  • mfp's two cents

    Seeing is believing - AX 2012 Developer Workspace

    • 6 Comments

    Here is a sneak preview of the new MorphX developer workspace in Microsoft Dynamics AX 2012.

    Notice the clear distinction between developer and application workspaces, and how the layout of the drop down menus makes it possbile to access tools with fewer clicks. You can launch the AX client directly in development mode using: AX32.exe -development.

    This post is also available on Channel 9.

    THIS POST IS PROVIDED AS-IS AND CONFERS NO RIGHTS.

  • mfp's two cents

    Seeing is believing - AX 2012 X++ Editor

    • 5 Comments

    Here is a sneak preview of the new X++ Editor in Microsoft Dynamics AX 2012.

    Notice that the editor now features word-completion, automatic indenting, scripting, zoom, multiline editing, and much much more.

    This post is also available on Channel 9.

    THIS POST IS PROVIDED AS-IS AND CONFERS NO RIGHTS.

  • mfp's two cents

    AX6 sneak preview - X++ Unit test improvements

    • 5 Comments

    These days the first milestone of AX6 is being completed. It means the first wave of new functionality has been implemented, tested and documented. As always; it is an exciting time to be working on AX...

    One of the features coming in MorphX in AX6 is set of improvements in the X++ Unit Test framework.

    First of all the unit test framework in AX6 is leveraging the new attribute feature in the X++ langauge. For example; you can use an attribute to declaratively specify the target class for your test (i.e. the class that is being tested by this unit test). Here is how:

    [SysTestTargetAttribute('MyClass')]
    class MyTestCase extends SysTestCase
    {
    }

    Starting in AX6; you can also use attributes to mark which methods on the unit test class are test methods:

    [SysTestMethodAttribute]
    public void myTest()
    {
    }

    If you are using both unit testing and a version control system, you can benefit from marking your most critical test methods as check-in-tests. When setting up the version control system, you can specify which test project to run during check-in, and whether to run all unit test methods, or only the unit test methods that are marked as check-in-tests. During a check-in process the specified unit tests will be executed, and only if they all succeed the check-in will be submitted. This gives you the flexibility to run the most critical unit tests during the check-in process, while still having a full suite of unit tests that can be run on-demand. Here is how to mark a method as a check-in-test:

    [SysTestCheckInTestAttribute]
    public void myCheckInTest()
    {
    }
     
    Using test projects in AX6 to group your unit tests brings even more benefits. When running the test project, you now get the results visible directly in the project as small icons - and when hovering over a failed unit test, you get the failure message. 

    This posting is provided "AS IS" with no warranties, and confers no rights.

  • mfp's two cents

    We did it (again)!

    • 5 Comments

    On behalf of the Dynamics AX 2009 development team I'm proud to announce that as of build 5.0.529.0 we have reached zero X++ best practice errors in the SYS layer.

    Version 4.0 was the first release of Dynamics AX without any best practice errors. Reaching this level of code quality was a mammoth effort; due to the huge backlog and many new TwC related BP rules.

    In Dynamics AX 2009 the goal was significantly easier to reach, as we didn't have any backlog. However; we have introduced more than 60 new BP rules, including validation of XML documentation, inventory dimensions, upgrade scripts, workflow, list pages, AIF and performance. On top of this the SYS layer now contains much more functionality than ever before - the AOD file alone has grown with more than 50%. All of this now conform to the Best Practice rules implemented.

    What does this mean for you as an X++ partner developer?

    • When you use the best practice tool, and it reports a BP error - then you should pay attention to it, as you introduced a problem.
    • The high quality of the code in the SYS layer should overall make your life easier, as it conforms to a set of standards, making the code easier to understand across the entire application.

    For more information on MorphX Best Practices see: Channel 9 Screencast, or MSDN.

    For more information on the importance of static code analysis see: Compiler warnings - and so what?

Page 2 of 19 (187 items) 12345»

mfp's two cents

...on Dynamics AX Development!