Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - orientphoebus

Pages: [1] 2
1
Suggestions and Requests / Suggest a refactor function
« on: December 01, 2005, 01:04:06 pm »
I have 2 classes drawed in class diagram. Class2 is associated to Class1 with it's field named m_Class1.

So the association line's "Target role" picks "m_Class1".

When I change the field's name in Class2's attribute dialog. Say, change to "mmm_Class1", the association line is not changing accordingly. And when I generate the code, it generate 2 fields for Class2: "m_Class1" & "mmm_Class1".

Can EA provide some automatic refactoring feature?

2
Suggestions and Requests / Re: Suggest template modification for C# or Java
« on: December 12, 2005, 08:01:47 am »
Thanks for letting me know the #TYPE#, but I have more comments on related topic:

0. Trivial suggest: The Note explain about using #TYPE# is really too easy to skip when reading the help doc, maybe you should Bold the paragraph, in stead of Italic it.

1. #TYPE# is not working if I set this way:
1) set the attribute's Type to the collection's item type.
2) In the Attribute properties dialog, "Detail" tab, check "Attribute is a Collection", type in "IList<#TYPE#>" or "#TYPE#[]" in "Container Type:" Combo box.
The above method will generate code like:
Quote
private Class2 IList<#TYPE#> m_class2;

I think the above method is suppose to let us override the collection setting for specific attribute instead of using the Class level or the Global level settings. Am I using it right or it acctually means something else?

2. Collection setting in Class level won't work after sync the code:
1) First create 2 classes in class diagram, link them with "association" relationship, set the target is 1..*, generate the code. With Global setting using IList<#TYPE#>, we can get code like
Quote
private IList<Class2> m_class2;

2)Second, sync the code with the diagram, we can see the type of the attribute m_class2 is "IList<Class2>". (I hope the reverse engineering can set the type to Class2 still and set the detail to "Attribute is a Collection" checked and set the "Container Type:" to  IList<#TYPE#>)
After that, I want to change the attribute's type to Class2[], the only way I can do is modify the Type box to type in "Class2[]", that's really not smart. I hope I can set the class's collection to "#TYPE#[]" and it will automatically go through the attributes and find all the collection ones with no specific "Container Type" and overwrite them.

3. If what I understand the "Container Type:" correctly, it would be better to provide dropdown list which get the options from Class level and Global setting of the "collection class". Cause currently, the Combo box is always empty when you open the drop down.

4. This is a minor one. In "Code Generation Templates...", when I "Get Default Tempalte" and save, the left side "Templates" box "Modified" column is still marking that template "Yes", it shall change back to "No", otherwise it's hard to trace what changed.

5. For above 1~3 suggestion, if Sparx cannot modify EA to provide them very soon, my 1st script will still be usefull, although 2nd can be dumped anyways. It might be good to change my logic to use #TYPE# instead of hard-coding to find <> or [].
About, the generating comments part I tried several ways to sync with the code, it seems working fine. The purpose is just for if the field or property has no comments at all, it will generate one simple one, at leaset can tell something. If the commens is modifed by developer, sure it will lose when sync back, but it won't hurt anything. And if, just if, we can override the reverse part in add-ins, we can lay down a rule for our group to always keep that line. It's a customer self defined stuff for sure, if Sparx integrate this approach into your production, the comment part is not proper to be put as a standard logic.

6. For reverse engineering, an easy approach will be allowing user to override the function in add-ins, by doing these:
1) Provide event handlers for "pre" and "post" jobs of Reverse Engineering. Acctually, if these "pre" and "post" jobs are available for any existing menu tasks would provide user great flexibility and less coding when developing their add-ins.
2) Provide a data structure (or probably just open us the one Sparx is using internally) for accessing source code fields, properties or operations. Especially if it can be something like Java or .Net's Reflection classes and operations, it would be nice.
The above aproch step 2) might be hard to provide, if there is too much legacy design in existing EA Reverse Engineering. But I suppose step 1) should be relatively easy, and it will help the end user of the add-ins. Cause for now, I can build an add-in to provide menu items, but end users must remember to run them before or after existing menu functions.

Thanks

3
Suggestions and Requests / Suggest template modification for C# or Java
« on: December 02, 2005, 01:36:30 pm »
In order to deal with 1..* relationships. I modified these templates:
They are for "Forword Engineering". Not found the way for "Reverse Engineering" yet. Please help if anyone know how to do it.:

Attribuite Declaration:
Quote
$typeName=%attType%
%if attType==""%
$typeName=%genOptCSDefaultAttributeType%
%endIf%
$arrayTypeName=$typeName+"[]"
$genericCollectionTypeName="<"+$typeName+">"
$attrComment=%XML_COMMENT(genOptWrapComment)%
$attrCommentLength=%LENGTH($attrComment)%

$ttt
%if attTag:"Attribute" != ""%
%REPLACE(attTag:"Attribute", ";", "\n")%
%endIf%

%if classStereotype == "enumeration"%
%PI=""%
%attName%
%attInitial ? " = " value%
%endTemplate%

%if attCollection == "T" and attContainerType != "" and attContainerType != "Array" and attContainerType != "[]"%
%if $attrCommentLength == "0" %
/// <summary>
/// Collection of $typeName
/// </summary>
%endIf%
%endIf%

%PI=" "%
%CONVERT_SCOPE(attScope)%
%attStatic=="T" ? "static" : ""%
%attConst=="T" ? "readonly" : ""%
%if attCollection == "T" and attContainerType != ""%
%if attContainerType == "Array" or attContainerType == "[]"%
$arrayTypeName
%else%
%REPLACE(attContainerType,"<>",$genericCollectionTypeName)%
%endIf%
%else%
$typeName
%endIf%
%PI=""%
%attName%
%attInitial ? " = " value%

%if attStereotype == "property"%

{\n\t//read property\n\tget{;}\n\t//write property\n\tset{;}\n}
%endTemplate%

;


Linked Attribute Declaration:
Quote
$type=%linkAttName%
$linkName="<"+%linkAttName%+">"
%if linkAttCollectionClass != "" and linkCard != "" and linkCard != "0" and linkCard != "0..1" and linkCard != "1"%
%if linkAttCollectionClass == "Array" or linkAttCollectionClass == "[]" %
$type+="[]"
%else%
$type=%REPLACE(linkAttCollectionClass,"<>",$linkName)%
%endIf%
%endIf%

%PI=" "%
%CONVERT_SCOPE(linkAttAccess)%
%linkAttTargetScope=="classifier" ? "static" : ""%
$type
%PI=""%

%if linkAttRole != ""%



4
Suggestions and Requests / Re: Proberbly a rework needed for "Local Path
« on: December 12, 2005, 08:09:31 am »
hi, mikewhit

I agree. Acctually I like it. But just it's kind of an advance method. And it's not a "direct" approach for users' common habbit.

And my last point is, if user clear the path of all the classes of a package, it's not convenient to set them back, at leas not straight forward.

A good UI shall be easy to use first, then provides advance methods.

5
Suggestions and Requests / Proberbly a rework needed for "Local Path&quo
« on: December 12, 2005, 06:43:07 am »
What I'd like is a menu under "Code Generation" , which allows to choose or type in a directory (if the typed in one is not existing, it shall create a new directory with prompt) as the path of generating code files for all the classes under the package.

If the classes has filenames already, change the path of the filename, sure a warning will be necessary. If the classes has no filenames, by default it use the choosed directory + class name + source code type file extention.

The reason is when user use the "Clear filename" function of "Code Engineering" instead of "Local Path", all the filenames are lost, the ways to get it back is really tricky and not convenient: either set them back one by one; or generate to an empty folder and then manipulate "Local path" to replace them.

Although my aproach won't deal with "One file has multiple classes", that is not happening often, and sure is not a very good practice in most of the cases.

Even with the new approach, "Local Path" can still be kept. It's quite useful in some cases.

I myself can create a add-in for this task, but it will be nice if Sprax can integrate the function with "Reset options for the package" menu item under "Code Engineering".

Please see related discussion in :
http://www.sparxsystems.com.au/cgi-bin/yabb/YaBB.pl?board=Automation;action=display;num=1134139300

6
Suggestions and Requests / Suggest to support Generic Collection
« on: December 01, 2005, 12:55:13 pm »
For Java 1.5 and c# 2.0. for detail see the post in General Board :
http://www.sparxsystems.com.au/cgi-bin/yabb/YaBB.pl?board=general;action=display;num=1133469005

7
General Board / About Collection code engineering, for tanja &
« on: December 12, 2005, 08:15:55 am »
I had a good discussion with Sparx' Simon about this issue in this post:

http://www.sparxsystems.com.au/cgi-bin/yabb/YaBB.pl?board=suggestions;action=display;num=1133559390

And Tanja, If you are still coming to this forum, can you answer me this question? Or anyone use Rational Rose recently can answer it?
Quote
A question for you as you just come from Rose world. I have not use it for a long time:
How is rose support Qualified Collections when doing Code Engineering? Can it deal with roundtrip for this kind of code?

public class ClassA{
 public Map<string, ClassB> listBs;
}


8
General Board / Re: java forward/reverse/synch
« on: December 12, 2005, 08:11:04 am »
Sorry rhk , I mess you with tanja

9
General Board / Re: java forward/reverse/synch
« on: December 02, 2005, 11:21:08 am »
Sure thanks, I just got mine "Forward" working:
http://www.sparxsystems.com.au/cgi-bin/yabb/YaBB.pl?board=suggestions;action=display;num=1133559390

Please post yours if it's different.

for the "reverse", is what "Transformation templates... Ctrl+Alt+H" for? The online help really doesn't help much here.

RHK,
A question for you as you just come from Rose world. I have not use it for a long time:
How is rose support Qualified Collections when doing Code Engineering? Can it deal with roundtrip for this kind of code?
Quote
public class ClassA{
      public Map<string, ClassB> listBs;
}



10
General Board / Re: java forward/reverse/synch
« on: December 02, 2005, 09:34:04 am »
RHK,

Please post here how you finished the "Forward" part.

For the forward part, one-to-many relationship, by default, EA doesn't generate like this:

Quote
public ClassB[] classB;


Many other Case tool do this.
Thanks

11
General Board / Is there a reference guild for EA macros?
« on: December 02, 2005, 11:22:30 am »
For "Code Generation Templates" and "Transformation Templates"

12
General Board / Re: Code Engineering 4 Aggregatt/Compositt relatio
« on: December 02, 2005, 07:28:53 am »
Please! anybody help me with this? There proberbly is some "Code Template" for Java can solve this. But which one? Please help.

13
General Board / Re: Code Engineering 4 Aggregatt/Compositt relatio
« on: December 01, 2005, 12:52:22 pm »
After read this post
http://www.sparxsystems.com.au/cgi-bin/yabb/YaBB.pl?board=general;action=display;num=1128520043

I found the problem is similar. here is rhk's original problem:
Quote
The class "A" has a property named "x" and the type of "x" is the Class "B". In the detail dialog for the property x I have set the multiplicity to 0..* and have set the Container Type of the Collection to java.util.Set. Additionally I've checked the "attribute is a Collection".
 
The code-generator produces confused code:
 
public class A {
    private B xjava.util.Set;
}
 
So it just adds the "Container Type" behind the propertyname without a whitespace.  
 
But what I expect to be generated is:
 
public class A {
    private java.util.Set<B> x;
}
 
How can this be solved?


I think the reason is EA fails to deal with Generic Collection. For me, I am not using Java now, but c#2.0 is coming. Really hope EA can solve this soon. I don't want to go that Heavy Pricy Rational Rose.

14
General Board / Code Engineering 4 Aggregatt/Compositt relations
« on: December 01, 2005, 12:30:05 pm »
I am using c#. When doing reverse engineering, it seems like EA only reverse the basic association relationships. for one-to-many , I need to modify the line manually.  And for bi-direction, it creat 2 association lines in class diagram. Can it be a little smarter?

I think it is because the collection is not strong typed. For .Net 2.0, and Java1.5, there is Generic Collection. What is EA's plan to adapt them? Do I have to modify templates and "Automatic interface" to make it work. It shall be a build in feature.

What I hope is with Aggregation or Composition relationship drawed in diagrams, and specify "List<>" as the collection class(or specify "object array", or "IDictionary<>" for qualified collection ),  code generation will provide code like:
Quote
class Parent{
   public List<Child> Children;
 }

For reverse engineering, EA found above code would automatically put composition relationship with 0..* on the diagram.

Have your development teams include this in your next release plan? This will cause EA, which I like very much already, stands a lot of higher than other Case tool.



But for now, what I need is the reverse engineering automatically take the field's name as reference and find the class (in the same namespace) as the collection's item class, then when draw diagrams, automatically link the classes with Aggregation or composition. Can I use "Automation Interface" to define some "Reverse Engineering" rules? I am totally newbie in Add-ins area. If it's not for "Reverse" , please let me know.

Another suggestion for code generation, currently, it put unnecessary "import" or "using" for relationship between 2 classes in the same namesapce or package. Can you take them out? I think it's an easy fix.
Thanks

15
General Board / Re: About upgrade
« on: December 01, 2005, 10:54:15 am »
What do you mean later prolong? Do you mean almost always free?

Pages: [1] 2