In a large scale J2EE development, java developers usually will need to develop some foundational modules which are shared cross any top-level modules or applications. Having clear-cut dependency between modules and applications are very important in terms of loose-coupling. Many times we as the developers put application-specific logic in the foundational modules and vice verse. This creates class dependence hell.
Class dependence is important for a complex JS project too.
Class dependence is important for a complex JS project too.
There are two principles:
1) dependence should go one way not two way, that means in a class diagram, we will have, A ---> B, not A <--->B.
2) higher level JS class should not depend on lower level JS, so in class diagram, you will see all dependence arrows go up all the way to our managers JS, then to JQuery, KendoUI, then to Javascript classes itself.
The following is class diagram for implementing session time out dialog. Basically when page is loaded, an AuthToken validator runner is started and will check against Restful service if this token is valid, if not and token expired in certain threshold like 2 min, a dialog window will show with count down clock running. I will present the source code in next blog.
Another thoughts about MvvM pattern, this brings great potential that we can leverage domain objects in backend and front-end, with json as DTO to connect both. And if node.js is used to develop the backend, then lots of code can be shared cross bot ends.
This is exciting time for JS developers.
No comments:
Post a Comment