google-code-export / umple

Automatically exported from code.google.com/p/umple
1 stars 0 forks source link

Refactor getCode method in Constraint into a derived attribute #509

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

  String getCode(){
    return StringFormatter.format(gen.translate((getNegated()?"Not":"")+format,this),inject);
  }

Can be a derived attribute

Original issue reported on code.google.com by aforw...@gmail.com on 9 Feb 2014 at 10:57

GoogleCodeExporter commented 9 years ago

Original comment by aforw...@gmail.com on 9 Feb 2014 at 10:59

GoogleCodeExporter commented 9 years ago

Original comment by TimothyCLethbridge on 14 Feb 2014 at 8:34

GoogleCodeExporter commented 9 years ago
If the getCode method in the Constraint class is being changed into a derived 
attribute, then should the getCode method in Constraint's parent class, 
CodeBlock, also be changed to a derived attribute?

If so, I can create a separate issue and assign it to myself to work on.

Original comment by TylerJDMcConnell on 20 Feb 2014 at 8:19

GoogleCodeExporter commented 9 years ago
First, I notice that superclass and class CAN have the same attribute, but 
there is a warning that is created

http://cruise.eecs.uottawa.ca/umpleonline/umple.php?model=140226557089

Original comment by aforw...@gmail.com on 26 Feb 2014 at 10:49

GoogleCodeExporter commented 9 years ago

Now looking at the CodeBlock and Constraint, they have different "code" 
attributes, so I would make both derived attributes and for the time being we 
will live with the warning (and possibly a separate ticket to deal with that).

FYI, this is what I see for the current implementations:

class CodeBlock
{

  public String getCode()
  {
    return !codes.containsKey(languageUsed) ? "".equals(languageUsed) ? null : codes.get("") : codes.get(languageUsed);
  }

}

class Constraint
{

  String getCode(){
    return StringFormatter.format(gen.translate((getNegated()?"Not":"")+format,this),inject);
  }

}

Original comment by aforw...@gmail.com on 26 Feb 2014 at 10:55

GoogleCodeExporter commented 9 years ago
Okay, I was thinking there shouldn't be a problem in changing both getCode 
methods to derived attributes, each with their own implementation. Should I 
create a separate ticket for changing the CodeBlock getCode method, or should I 
make the change within this issue?

Original comment by TylerJDMcConnell on 27 Feb 2014 at 3:29

GoogleCodeExporter commented 9 years ago
One ticket is fine, rename the title.  If that bothers you, create a separate 
ticket.

Original comment by aforw...@gmail.com on 27 Feb 2014 at 3:31

GoogleCodeExporter commented 9 years ago

Original comment by TylerJDMcConnell on 27 Feb 2014 at 3:33

GoogleCodeExporter commented 9 years ago
I've refactored the getCode method in Constraint and submitted a patch to the 
Umple-Dev mailing list for review, but I'm having issues refactoring the 
getCode method in the CodeBlock class.

Whenever I change the getCode method in CodeBlock to be a derived attribute the 
CodeBlock class and all of its children classes become abstract. I have no idea 
why this is happening. Any insights would be welcome.

Original comment by TylerJDMcConnell on 28 Feb 2014 at 5:34

GoogleCodeExporter commented 9 years ago
Splitting work to change getCode in CodeBlock into derived attribute into a 
separate issue due to problems with inheritance.

Original comment by TylerJDMcConnell on 28 Feb 2014 at 7:50

GoogleCodeExporter commented 9 years ago

Original comment by TylerJDMcConnell on 4 Mar 2014 at 5:28