Book a Demo

Author Topic: method-internal dependencies  (Read 4762 times)

ArkosX

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
method-internal dependencies
« on: August 29, 2013, 03:45:36 am »
Hi all,

class A{

  void method() {
    B b= new B();
    ...
  }

}//- class A

That means A depends on B. For example, if I remove default constructor from B, A will not work.

Therefore I want that in the model when I reverse engineer A and B, that dependency appears in the model.

How do I get that?
It seems that associations are only created if (in example) A has an instance of B as attribute, as return type for method, or as parameter for a method.
Thanks folks,
Luis

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: method-internal dependencies
« Reply #1 on: August 29, 2013, 04:21:53 am »
If it does not appear then Sparx hasn't implemented it. The cross-compiler is EA-internal and hard wired. You can#t modify it.

There is a new feature where you can define your own BNF syntax for RE. I have no experience with that yet, but definitely it will be a lot of work to learn that. (Maybe the syntax files for Cxx are public. You need to check that on your own.)

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: method-internal dependencies
« Reply #2 on: August 29, 2013, 09:05:57 am »
EA doesn't parse inside the bodies of methods, so it can't do this.

ArkosX

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: method-internal dependencies
« Reply #3 on: August 29, 2013, 05:38:22 pm »
I was afraid, that was the answer.
That is IMO a great drawback: for me it's basic that type of dependency. A reverse engineering process is just getting a partial model. More even with synchronization: it means that whenever I add class in the code, I have to manually add the association? This is the death of Model Driven Development. This is the kind of things why many people (and that means companies) are against MDD: synchronization doesn't work.
In case of Java at least, an easy solution would be to add as associations the "imports" (every class used has its import), which means it wouldn't require go through the code, the syntax extremely easy to find and to handle.  :)
Really, a pity. :'(
« Last Edit: August 29, 2013, 05:41:44 pm by lfrobledanoesteban »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: method-internal dependencies
« Reply #4 on: August 29, 2013, 08:53:00 pm »
I wouldn't say it's the death of it. Just look at EA's price. I would really mind to pay a much higher price for such fiddly things (which they are). I understand your position - but I won't pay for it. Maybe some smart add-in could pave the way to what you want. There's room for 3rd party add-ins.

Honestly, a full C parser is a nightmare. The inventor should be clubbed with a teaspoon. Preferably with a plastic one so it takes longer.

q.
« Last Edit: August 29, 2013, 08:55:23 pm by qwerty »

ArkosX

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: method-internal dependencies
« Reply #5 on: August 30, 2013, 01:14:24 am »
I'm sorry but cannot agree.
-For Eclipse users, see at TopCased price (free). If EA wants to keep its thousands customers -each of them paying little, yes, I give you that :P-.
-For me the issue is quite relevant. There are relations which EA is not able to show, which means that the model doesn't fully model the code, which means that I still have to look at the code to understand the architecture. That is what I meant about being dead: cannot survive on its own :P
-A C parser is hard, but:
-- I think most of Software Engineers have done a parser -simplified but probably with compiler- in few months of part time during the undergrad studies.
-- This doesn't need to be a full parser, no semantic, and most of the code can be jumped over.
--That means, that IMO -only my opinion-, resources needed are little and even if the amount a customer pays is not huge, there are many.

Of course all these are strategic issues and a business has to set its priorities, but IMO business goals should lead the technical aspects and not the only way around.

My point was only to highlight the importance of this for me. It might be completely superficial for other customers, and in that case you guys are doing it perfectly. :)

I'm finding problems with the code synchronization and Eclipse Integration. Just take into account that that can be a decisive issue for others to start using EA. Whether it is a 1 person issue or a 1000.000 potential customers' is EA's to analyse :P

PS. wasn't it said that C was invented as a bet of designing the most complicated language :P, and java is just its child!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: method-internal dependencies
« Reply #6 on: August 30, 2013, 07:45:30 pm »
It's a bit like politics: larger groups find their targets easier to be reached. So (honestly!) good luck for finding companions to achieve what you want  :)

Have you ever looked into C's syntax definition? It IS a nightmare. There are enough priests out there who can't tell heaven from hell. Probably using C over Assembler is preferred (though I heard that C is not really a language but an assembly) but writing a C compiler is definitely a nightmare. Further ALL C derivates have inherited that brown stinky sauce which is called C. And the worst is probably what they introduced with a pre-compiler. That's really making it an assembler. How can you RE a source when it's not constant but depends on compile time settings? You would need to put that into your RE system somehow. Do you have any idea how to manage that? Don't tell me "by defining Language Macros". .... Stop .... That will take me to far ::)

q.

ArkosX

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: method-internal dependencies
« Reply #7 on: August 31, 2013, 03:01:02 am »
Yeah, I get that of politics, but really, it is strategy, and it is gooood :) I mean it. I understand that not all customer requests cannot be satisfied. ;)

Remember, a grammar definition and a compiler is a tree-like, which means that you can stop caring about its branches as soon as you are not interested in details. That would apply for this case, were only variable declarations are interesting, whereas function/method calls are not.
But in this very particular case, as I said, it is just enough to read the initial imports, which means, even forgetting about grammars, just a text lineal text reading could solve the problem (there is no nesting, no sub elements, no nothing :D ) . Read Java "import" lines, and get the last word before the semicolon, and there you are, you got a class which is somehow related with the class at hand. Problem solved  8-)

PS. I actually think I did see the C grammar many years ago. I did even do a compiler of a simplification of pascal, and a parser of a simplied version of XML when it was a not completely defined language. BTW, at that time my parser was faster than Internet Explorer :)).

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: method-internal dependencies
« Reply #8 on: August 31, 2013, 05:31:19 am »
Quote
...
That's all pure subjective, and has no relevance to what's provided in practice ...
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: method-internal dependencies
« Reply #9 on: August 31, 2013, 06:16:53 am »
Quote
Quote
...
That's all pure subjective, and has no relevance to what's provided in practice ...
Confirmed. A short time ago I started writing an Objective-C cross-compiler. The only chance you get is heuristics by compiling the OS library sources. But even with that it will probably fail with what users present in reality. I for myself would not accept something based on a heuristic. Except for myself in very limited ranges where I know it might fail. But as a vendor? No!

q.
« Last Edit: August 31, 2013, 06:18:08 am by qwerty »

ArkosX

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: method-internal dependencies
« Reply #10 on: September 04, 2013, 05:23:32 pm »
Quote
Quote
...
That's all pure subjective, and has no relevance to what's provided in practice ...
Sorry but I don't understand, because I addressed different things, specifically "has no relevance to what's provided in practice".
My point is that:
1) I understand that if nobody misses the fact that a internally used class is a class dependency, then EA doesn't include it. Of course I'm not aware whether Im the only one or there are many requests. For me is basic though, and so I wanted to state it.
2) To parse Java code for that topic is easy.

If you mean that those are only opinions or statements biased by ma own experience, of course, they are.