Search code examples
javascriptjavaumlclass-diagram

Include JavaScript and HTML files in class diagram?


My current application uses a JavaFX Application class with gui code (including a webview) and regular Java classes. This webview shows a html file which has JavaScript files as reference. My JavaScript has access to one of my classes like so:

private JSONModel model = new JSONModel();
JSObject jsobj = (JSObject) webEngine.executeScript("window");
jsobj.setMember("java", model);

Meaning my d3.js has full access to call methods of my JSONModel.class. Since it is that important to the project, should I include it in my class diagram? How would I make clear that it is JavaScript and not a Java class?


Solution

  • Whether or not you include something in your class diagram depends on the purpose of this diagram.

    If you think it's important to put it on there then I guess you should.

    More or less the same applies for the difference between Java Class and JavaScript class; it all depends on the purpose and audience.

    If the purpose of the diagram is to show the structure to a business analyst then you should not show the difference (it will only confuse the poor guy and will not help to get the message across).

    If the purpose of the diagram is to instruct developers what to build, then you should somehow make the difference clear. How you do this depends on your modeling method and tool. Some tools allow to set the language of the class.

    From a pure UML standpoint I think you should work with something like a Manifestation to indicate that you implement a certain class in a certain artifact.

    From UML 2.5 specs: enter image description here

    The manifestation relation can be between an artifact, and any PackageableElement