Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Use requirejs for dependency management #39

Open
jbeezley opened this issue Mar 7, 2014 · 3 comments
Open

Use requirejs for dependency management #39

jbeezley opened this issue Mar 7, 2014 · 3 comments

Comments

@jbeezley
Copy link

jbeezley commented Mar 7, 2014

I started branch vgl/require-js-loader to explore using requirejs to load dependencies within the project. I wrote a shim in src/init.js that will keep the code working until we start building with it. I converted src/actor.js to use the define call. I am looking for some feedback on the style. It will take a significant amount of work and a large diff to make the change, but it won't change the API from the user's perspective.

The overall benefit of this beyond making the CMakeLists file more maintainable is that we can easily examine the dependencies between modules. The class inheritance style that currently exists allows me to create graphs like the one attached below, but with a full view of the dependency tree.

vglclassdiagram

@aashish24
Copy link
Member

This looks great. Is the tree generated via the requirejs output (I think tha's what you are saying). On the define, what's the advantage? Also, do you have to pass the boundingObject?

@jbeezley
Copy link
Author

jbeezley commented Mar 7, 2014

One can generate the tree pretty easily once the dependencies are listed in a well defined manner. It may be possible to do so directly with requirejs, but it really isn't hard write something that does it.

The advantage of the define function is that 1. dependencies are explicitly listed, and 2. requirejs takes care of loading the modules in the correct order so you don't have to manage that in the CMakeLists.

For this style of module loading, you do have to pass boundingObject for it to work as intended. Like I said, it will require a major overhaul, so maybe it is something better left for later.

@aashish24
Copy link
Member

I see. Yes, I guess we can refactor it like that but let's to do if some other time. I see what you are doing to get the dependencies. Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants