What are your thoughts about good style formscripting?

I frequently get the question, what my top rules are while creating software for microsoft crm, especially formscripting. So, this is my top list of thoughts, i have in mind. What are yours?

  • client development in mscrm is web development, so everything you know about good webdesign (technical) matters
  • treat javascript as a first class programming language, apply patterns of real life coding and don’t get trapped in the „it is just a little bit scripting“ trap
    • use code conventions
    • apply OO or functional designprinciples, whatever applies for you and the problem
    • think in patterns, where applicable (ok, 99% will be the observerpattern, i know)
    • apply automated testing where possible (for example use http://qunitjs.com/ because it fits well in the jquery landscape)
  • use „namespaces“ in javascript
  • minimize transport of data
    • fetch/upload only really necessary data
    • combine/minify scripts ( for example http://ajaxmin.codeplex.com/ )
    • latency matters more than bandwidth
  • use asynchrounous requests as often as possible
    • think about enabling fields after an asynchrounous fetch instead of disabling fields after a synchronous one
    • sometimes, more than one request is necessary for one operation: even they can be made parallel, one only hast to ensure, that every answer is there before continuing with processing ( barrier pattern (well, not really a pattern, more a technique))
    • thinking functional and using the functional aspects of javascript helps a lot in making things parallel
  • beware oft he fact, that webresources are loaded in parallel, so do not use code from one resource in another while loading, call everything in the onloadevent
  • try to find a good balance between using a big library (jquery or knockout or whatever) and setting up small functionality on your own (for example: if you have to parse the searchpart of your url, you could use bbq (http://benalman.com/projects/jquery-bbq-plugin/ ) or write a regular expression to find what you need.)

Have fun, Christian

No comments yet.

Leave a Reply