Author Topic: Comments in Shapescripts  (Read 15109 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Comments in Shapescripts
« on: June 15, 2016, 02:33:59 pm »
Do comments in shapescripts affect the execution speed or are they discarded on the way in?

We are interested in making our shapescripts more expressive ina narrative sense, but if that makes them slower, then we won't.  If there's only a one-time hit on injestion then that's OK.

Support request submitted,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Comments in Shapescripts
« Reply #1 on: June 15, 2016, 04:07:00 pm »
Paolo,

I would be very surprised if comments affected the execution in a less then trivial way.

But better safe then sorry I guess  :-\

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Comments in Shapescripts
« Reply #2 on: June 15, 2016, 05:17:21 pm »
So would I Geert; but as you say, before plastering the scripts with a LOT of commentary, better find out.

They currently have some commentary, but we'd loke to "beef it up" - especially in the area of identifying common code (since you can't cross call)

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Comments in Shapescripts
« Reply #3 on: June 15, 2016, 05:21:45 pm »
BTW, I'm working on a script to export the shapescripts to textfiles so you can put them into a version control system.
I've done the same for my scripts a while ago in order to get "some" level of control on what is happening with them.
It also allows for easy searching if I need to find something in the scripts.

I'll let you know when it's finished.

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Comments in Shapescripts
« Reply #4 on: June 15, 2016, 05:41:36 pm »
BTW, I'm working on a script to export the shapescripts to textfiles so you can put them into a version control system.
I've done the same for my scripts a while ago in order to get "some" level of control on what is happening with them.
It also allows for easy searching if I need to find something in the scripts.

I'll let you know when it's finished.

Geert
That's good Geert, but what I REALLY want is to go the other way...  ;)
For each <shapescript text file> populate the MDG file in the appropriate place.  That way, I can generate the script text files from a generator and then get them inserted into the MDG without the "faffing about" we need to do at present.

We already have a large amount of common code and we'd like to increase it.

I got RSI (Repetitive Strain Injury) of the elbow updating 50+ scripts the other weekend.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Comments in Shapescripts
« Reply #5 on: June 15, 2016, 06:12:13 pm »
One of the things on my TODO list as well :)

I'm developing scripts, profiles and shapescripts and putting them into MDG files for a couple of different clients, and I'm trying to get a grip on it all.

So a tool that would allow me to push a button and regenerate my MDG, without having to point and click on 70 different things (without missing one) would be a big help for me too.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Comments in Shapescripts
« Reply #6 on: June 15, 2016, 08:23:45 pm »
I think we need a confirmation from Sparx. If I were to design this, I would compile the script upon saving and use the compiled code. But I seem to remember that until a not so long ago time it was possible to save scripts with syntax errors (until I complained about that). That's a good indication that it was not compiled then, but most likely interpreted at runtime.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Comments in Shapescripts
« Reply #7 on: June 15, 2016, 08:37:41 pm »
I think the shapescripts are interpreted and not compiled, but I don't know for sure.

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Comments in Shapescripts
« Reply #8 on: June 16, 2016, 09:49:58 am »
I think the shapescripts are interpreted and not compiled, but I don't know for sure.

Geert
Well, even if they were interpreted, they should be interpreted on a minified version minus comments and other stuff that would increase processing time.  Perhaps even on an intermediate form.

I'll await the Sparxians' response and let you know.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Comments in Shapescripts
« Reply #9 on: June 16, 2016, 05:32:07 pm »
I've received a reply from the Sparxians:

Shape Scripts are interpreted, not compiled.  Having comments in your shape script should make almost no difference to the processing time required by EA, but still could in theory make a very, very small difference.

We certainly haven't observed any noticeable difference before.

This is heartening, and I'm trying to get some more clarifications which I'll pass on.

When I was composing the original question, I had in my mind something like:
Given a total character count in a shapescript of 2500 characters in 100 lines,  Suppose 10% of the characters on 15% of the lines were within comments.   Would that be the kind of situation you (the reader) experience?  If not, what is your exemplar?

I think if we increased the level of commentary (for a variety of purposes), that same script might go up to about 3000 characters on 120 lines with the comment ratio moving to, perhaps, 15% of characters on 20% of the lines.  It might be interesting to see if there was a difference.

Thoughts?
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Comments in Shapescripts
« Reply #10 on: June 16, 2016, 06:39:08 pm »
So my suspicion was right... I for myself hardly write any comment in code (it should go to the model). Instead I try to code in a readable fashion.

Probably the comments themselves will really not affect processing time too much. But, honestly, interpreting during diagramming is poor design. Even if they were to use Java Script it would be compiled to some byte code. Probably now you know why large diagrams take ages to load.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Comments in Shapescripts
« Reply #11 on: June 18, 2016, 04:39:47 pm »
BTW, I'm working on a script to export the shapescripts to textfiles so you can put them into a version control system.
I've done the same for my scripts a while ago in order to get "some" level of control on what is happening with them.
It also allows for easy searching if I need to find something in the scripts.

I'll let you know when it's finished.

Geert
It's finished  ;D

So now there a new repository on Github with all(most all) of my shapescripts:
https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library

The script to export them can be found here, but it works in conjunction with the other wrappers in the library:
https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library/blob/master/Framework/Tools/Script%20Management/ExportAllShapeScripts.vbs

If you want to know how to use the vbscript library see: https://bellekens.com/2015/12/27/how-to-use-the-enterprise-architect-vbscript-library/

It's still a first rough version that needs some refactoring, but it got the job done :-\.

Geert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Comments in Shapescripts
« Reply #12 on: June 20, 2016, 06:59:52 pm »
Some of the refactoring is now done, and I've written a small article explaining things:
Presenting the new open source Enterprise Architect Shapescript Library

Geert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Comments in Shapescripts
« Reply #13 on: June 30, 2016, 11:29:14 pm »
I've created a new script to extract the shapescripts from MDG files and I've extracted and uploaded all of them to the github library.
Which now contains over 1000 shapescripts with more then 30.000 lines of code. :o

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Comments in Shapescripts
« Reply #14 on: July 01, 2016, 09:32:07 am »
I've created a new script to extract the shapescripts from MDG files and I've extracted and uploaded all of them to the github library.
Which now contains over 1000 shapescripts with more then 30.000 lines of code. :o

Geert
Hi Geert,
Unfortunately I don't have time to check it out right now - other issues in play.  But can you confirm that you can now reverse engineer an MDG file (not a profile in a repository) and generate text files - to be version controlled.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!