Ways Of Writing Javascript

The way developers write javascript code has changed enormously over the years.

Here are the pros & cons of the three options in the way you can write javascript these days.
  1. Hand code everything:
    • Write all javascript code from scratch.
    • Deal directly with browser compatibility issues.
    • Very flexible (upto the point, you can decide on the name of your temporary variable ;) ).

  2. Use Generic Utilities:
    You get/download the generic javascript utilities written by others (friends, fellow developers), & with little customization use them in your applications.
    • Saves some time to get things working.
    • Browser compatibility issues may be taken care by the generic utilities
    • You should deal with the customization errors
    • Flexible, until you are faced with a bug/error which was not faced by the person who created the utility. (Could be because your application required slightly different behavior)

  3. Use Javascript Toolkits/Frameworks:
    Use the popular javascript toolkits available on internet (for free). Some of the widely used toolkits are jQuery, prototype, YUI, dojo, etc.,
    • Download & use directly in your applications. As simple as including a js file & start using all the wide range of features provided.
    • Little/No javascript experience required.
    • Provides ready to use UI widgets. (like Plug & Play)
    • Provides AJAX facilities
    • Browser compatibility is no more an issue. All toolkits takes care of these internally.
    • Flexibility is less: If you want to change anything for your taste, understanding & changing the core code is time consuming.
    • Most of these toolkits provide a way for developer to extend & create your own widgets

  4. As we can see, using javascript toolkits is the best option.

    In my next article, we'll look into each of these toolkits & compare them.

No comments:

Post a Comment