Sparx Systems Forum

Enterprise Architect => Suggestions and Requests => Topic started by: mcoletti on May 17, 2013, 01:25:14 am

Title: Code engineering: import javascript
Post by: mcoletti on May 17, 2013, 01:25:14 am
Hi, I am developing some code in Google Apps script. I have several javascript sources. Is there a way to import them in EA? This could help saving some manual typing time.
Regards,
Massimo
Title: Re: Code engineering: import javascript
Post by: F@lk on May 23, 2013, 05:10:38 pm
I also need that feature since parts of our product (web interface) is written in JavaScript. And the JS/UML plugin for Eclipse does not work.
Title: Re: Code engineering: import javascript
Post by: Eve on May 24, 2013, 08:55:19 am
The problem with Javascript is that even when written as object oriented it doesn't really match the way we expect object oriented code to look. I'm not even 100% sure we could write a parser to detect the class definitions etc. in a consistent way.
Title: Re: Code engineering: import javascript
Post by: F@lk on May 24, 2013, 04:58:56 pm
js/uml (http://jsuml.gaertner-network.de/) seems to restrict to JavaScript that is written in the styles of JSDoc, Dojo, or YUI. I think that way can be a good compromise. Usually a programmers decides for a known pattern to code object-oriented, and so the parser can decide as well, maybe using information given by user settings.

A class here is usually written like this:
Code: [Select]
var Foo = new (function () {
   var m_fooParam = 0;
   ...
   this.setFooParam = function (fooParam) {
      ...
   };
   this.getFooParam = function () {
      return m_fooParam;
   };
   ...
});