MAS 500 Best Coding Practices

1 minute read time.

In MAS 500 R&D we continually perform code reviews for internal as well as external developers.  We ran across a few common themes recently that I thought would be helpful to share with those of you integrating or customizing MAS 500.   Several of these topics are explained in more detail in our SDK documentation.  Here are our recent top 10 best practices for well performing and well mannered, multi-user MAS 500 code:

 

1) Respect UpdateDate, UpdateUser, and UpdateCounter when updating MAS 500 tables. The UpdateCounter column is used for optimistic concurrency.

 

2) Respect application logical locks; for details see stored procedures like 'sp%logical%‘.

 

3) Do not use implicit transactions.

  • Manage your database transactions and keep them small with no user interaction including error conditions.

 

4) Connections from the client should support application roles and not use connection pooling.

 

5) Connections from a middle-tier do not need to support application roles.

  • However, auditing will not reflect the actual user.

 

6) Test your application for simple multi-user using optimistic concurrency.

 

7) Test your application using LUA/UAC.

  • Create a local user in the windows user group and test the application.
  • You should not need to be a user in the administrators group to run your application
  • This is very important for Terminal Services/Citrix support.
  • Test your application with a MAS 500 user other than admin and consider also testing with domain user accounts.

 

8) Default connection isolation is read committed; consider using (nolock) query hint to avoid unnecessary shared locks when possible.

 

9) Crystal report performance is critical, it can affect the entire system not just the user running the report.

  • Avoid queries directly to base tables, for example timInventory.
  • Crystal has no native way to send a (nolock) query hint.
  • Create a view and add the (nolock) hint to the base tables in the view
  • Avoid subreports, most cases the constraint can't be passed as the where clause of the subreport query.
  • Utility to fix up database names PrestoCrystalDatabase.exe.

 

10) Test, Test, Test

Message Edited by JG on 04-03-2009 11:54 AM