Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : Reopen class in canJs

$
0
0
Classes should not get so big that they are hard to maintain in the first place. Each Class or Control should do one thing.

Take a paginated Grid for example. We could create a giant Control to run the whole thing, but instead we break it into smaller pieces like this:

- Grid
- Next/Prev Button
- Page Number (string that says 2 of 10)

Then we create a Control that glues this all together. So that's 4 separate Controls that we now have instead of some monolithic Control.

When you build an application like this it is easier to test, debug and maintain. You also get the added benefit of reusing these smaller Controls elsewhere because the functionality isn't part of some mammoth Control.

Viewing all articles
Browse latest Browse all 3491

Trending Articles