Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
UML中的继承和依赖建模_Uml - Fatal编程技术网

UML中的继承和依赖建模

UML中的继承和依赖建模,uml,Uml,我试图在Cairngorm微体系结构中为Flex RIA应用程序建模类关系。我有点困惑 例如,我有两个类FrontController和Controller。控制器扩展了FrontController。 另一方面,我有ICommand接口和SaveEmployeeCommand,它们实现ICommand FrontController有两种方法 public function addCommand( commandName : String, commandRef : Class, useW

我试图在Cairngorm微体系结构中为Flex RIA应用程序建模类关系。我有点困惑

例如,我有两个类FrontController和Controller。控制器扩展了FrontController。 另一方面,我有ICommand接口和SaveEmployeeCommand,它们实现ICommand

FrontController有两种方法

  public function addCommand( commandName : String, commandRef : Class, useWeakReference : Boolean = true ) : void
  {
     if( commands[ commandName ] != null )
        throw new CairngormError( CairngormMessageCodes.COMMAND_ALREADY_REGISTERED, commandName );

     commands[ commandName ] = commandRef;
     CairngormEventDispatcher.getInstance().addEventListener( commandName, executeCommand, false, 0, useWeakReference );
  }

 /**
  * Executes the command
  */  
  protected function executeCommand( event : CairngormEvent ) : void
  {
     var commandToInitialise : Class = getCommand( event.type );
     //#### THIS IS DEPENDENCY ON ICommand INTERFACE ####
     var commandToExecute : ICommand = new commandToInitialise();

     commandToExecute.execute( event );
  }
控制器在构造函数中有init方法,如下所示

public function init():void
{
    // SaveEmployeeEvent extends CairngormEvent
    // SaveEmployeeCommand implements ICommand interface
    //### THIS IS DEPENDENCY ON SaveEmployeeEvent AND SaveEmployeeCommand ###
    addCommand(SaveEmployeeEvent.SAVE, SaveEmployeeCommand);
}
<>所以,让我们只考虑命令的依赖关系。如果我们查看代码,我们将看到FrontController依赖于ICommand,而该控制器依赖于SaveEmployeeCommand。我是否应该在UML类图上显示这两个“控制器->命令”依赖项?(第一个依赖项是FrontController->ICommand,第二个依赖项是Controller->SaveEmployeeCommand)
我的困惑在于继承部分。若我把继承关系放在FrontController和Controller之间,这意味着Controller也是FrontController,所以他对ICommand也有依赖关系(依赖关系是通过addCommand方法继承的)。我应该如何模拟这种情况?我举了一些可能的解决方案的例子。。。有什么建议吗


图表中的关系看起来是正确的,除了原型。我会将FrontController和ICommand之间的依赖关系更改为