Tag Results

JavaScript is today one of the most popular programming languages and it is not by accident that is so. If you just take a look at some of Google’s products like gmail, google docs etc you will see that the possibilities are endless.

Whether we like it or not Modern Web Applications needs a lot of JavaScript(in some web apps the amount of it is even greater than server side code).

If from the very beginning you think that the old way of javascript coding and architecture you used will satisfy and prevent bigger problems than you need to rethink.

Even great frameworks like Jquery will not help you because they were not meant for it, and it is not their job to solve the problems that you will face.

Let’s for a moment think about GMAIL(one of my favorite web applications) and think about architecture that we would use if we are up to building it in the first place.

No doubt for this venture is primarily necessary to have a good framework or set of frameworks, but even a best framework can not prevent you from writing unmaintainable code.

Javascript maintainability have little to do with the language, and almost everything to do with programmer diligence as in any other language.

So let’s get back to the GMAIL, what would you do.

Divide and conquer.

Start from a big picture, from top to bottom and try not to focus on some technical details from the very beginning.

Instead, try to isolate and design specific parts of page as standalone modules.

That communication between them should not be a direct one, because modules should not know about each other, and I will now list the very known reasons for that:

Scalable.

Modules are isolated pieces of code that when well designed, work independently of other modules and therefore can be removed and added as necessary.

Team-ready.

Because the application functionality is divided into these modules, team can easily split work.

Each developer on a team can be assigned a set of modules to develop and can work in parallel with minimal conflicts. Additionally, everyone can write in their own preferred style within the context of the pattern without preferences getting in the way of progress.

Deferrable.

Another advantage of its isolation and containment is that you can inject it on demand without worrying about its impact on other modules.

There are many frameworks that can help you accomplish this principles and set of guidelines and I will add here a list of frameworks which helped me with this.

- backbone.js

- require.js

- underscore.js

- jquery

- jquery ui js and css -

- twitter bootstrap js and css

Everything I’ve said so far is well known, but I had to mention it since due to this way of thinking I am able to build much more complex web applications in easier way, and I am loving it.

There are no frameworks for big or small projects, they all solve just some set of problems you will face, but not all of them. You have to change old habits and try to think in new ways.

Try and see what is the best framework combination for you and your team.

Let me use my remaining text space to quote some very smart people.

“The secret to building large apps is never build large apps. Break your applications into small pieces. Then, assemble those testable, bite-sized pieces into your big application” -

Justin Meyer, author JavaScriptMVC

“The more tied components are to each other, the less reusable they will be, and the more difficult it becomes to make changes to one without accidentally affecting another” -

Rebecca Murphey, author of jQuery Fundamentals.