Home > Architecture, Programming > From mud to structure

From mud to structure

This post is part of a series of posts on Client-Side Web Application Development using JavaScript.

Unless you put conscious effort in structuring your system, It ends up as a “Big Ball of Mud”. With JavaScript it is easier to get into this because

  • Unless you take special care everything ends up as Globals
  • JavaScript does not support Namespaces out of the box (consider this as logical organization of JavaScript code)
  • JavaScript does not support the concept of modules specifying dependencies between them out of the box (something like .NET Assemblies, AssemblyRefs in assembly metadata).


    Even though it is not possible to do these natively in the language using language specific constructs / support from the virtual machine, JavaScript being a really flexible language (it will be because it was inspired by LISP), it is possible to mimic those in multiple ways. Rather than inventing our own way to do these tasks there standard ways to implement modular JavaScript solutions.

UI Architectural Patterns

The other thing about User Interface logic is that it is the most difficult to organize. Architectural patterns can help here.  Separated Presentation patterns help you separate presentation logic from the business logic (ex: MVC) and provide a way to add structure to your application


So it is recommended that you use write

  • Modular JavaScript using a library that implements a Standard Module pattern.
  • Use a MV* framework that lets you implement one of the popular UI Architectural patterns

otherwise you application would end up as a “big ball of mud”.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: