大型CAx(CAD/CAE/CAM)软件研发中的职责编排

依据对SALOME、FreeCAD等开源软件的研究,同时结合大型CAx软件ACISE的研发实践,总结了CAx软件设计与开发过程中的部分研究心得。希望能对从事国产CAx软件研发的同行们有所帮助,这是编写本文的主要目的。

青,取之于蓝,而青于蓝;冰,水为之,而寒于水。--- 《荀子·劝学》

注1:限于研究水平,分析难免不当,欢迎批评指正。

注2:文章内容会不定期更新。

零、工作量预估

对SALOME、FreeCAD等大型CAX软件做代码量统计如下,

Totalkernel
SALOME152w/226w, 67%22w/37w,59%16%
FreeCAD89w/132w, 67%23w/33w,70%25%

从上述有限的统计可以看出,

  • 具有一定规模的大型CAx软件的代码量在150w~200w行左右;
  • 核心代码在35万行左右,约占20%左右
  • 代码注释在40万行左右,约占30%左右

一、代码实现

1.1 Knowledges about OOD: GoF

Ref. from Acise: A CAx Industrial Software Ecology 

Object-oriented design ecourages the distribution of behavior among objects. Such distribution can result in a object structure with many connections between objects. [Mediator]

Structuring a system into subsystems helps reduce complexity. A common design goal is to minimize the communication and dependencies between subsystems. [Facade]

A common side-effect of partitioning a system into a collection of cooperation classes is the need to maintain consistency between related objects. [Observer]

Framework use abstract classes to define and maitain relationship beween objects. [Factory Method]

1.2 常用设计模式

序号模式备注
1MediatorLayered MVP
2ObserverLayered MVP
3CommandLayered MVP
4Template Method
5Abstract Factory
6Factory Method
7Iterator
8Composite
9Prototype
10Memento
11Singleton
12Adapter
13BridgeMDF
14Chain of Responsibility
15Proxy

1.3 对象职责编排

序号组件描述典型实现
1ReflectionRTTR, Qt, MFC,FreeCAD,VTK, OCC
2MetaObject
3Type
4TypeRegistry
5LoggerBoost.Log
6MessageHandlerQtxMsgHandlerCallback
7StringUtils
8Persistence

Boost Serilization

FreeCAD: ZipWriter, XMLReader,

SALOME LightApp_Driver

Writer
Reader
9PropertyContainerFreeCAD
Property
10Object
11ObjectRegistry
12Entity
13signalBoost.signals2, Qt
14slot
15Data Object
16Data ModelRepresents a portion of data related to some Module, contains a tree of Data Objects
17DocumentLayered Architecture
19ApplicationLayered Architecture
20PreferenceHold App/Gui configuration data.

FreeCAD: ParameterManager

SALOME: QtxResourceMgr

SALOME: QtxPreferenceMgr

Boost.PropertyTree

Preference Manager
ParameterGrp
Parameter Manager
Resource Manager
21Module

Qt: QPlugin, QLibrary

Boost DLL

x3py

Module Manager
Plugin
Plugin Manager
22ArgvKeeper
23Application
24Command对应MVP的命令模型
25Request
26Command Manager
27

Transaction

28MainWindow
29Workbench
30Workbench Manager
31Action
32Action Manager
33Menu Item
34Menu Manager
35Toolbar Item
36Toolbar Manager
37DockWindow Item
38DockWindow Manager
39Presenter
40View Object
41

TreeItem

TreeModel

42

PropertyItem

PropertyEditor

PropertyModel

FreeCAD: PropertyView

QtPropertyBrowser

43PropertyBrowser
44View

Abstract Factory

FreeCAD: Gui::View3DInventorViewer

SALOME: SOCC_Viewer, VTK_Viewer

OpenCASCADE: V3d_Viewer

VTK: vtkActorCollection

OpenSceneGraph: osgViewer::Viewer

Qt: Graphics View Framework 

View GroupHold a group of view objects for views of the given type.
ViewModel
Viewer

Abstract Factory

Viewer Registry
View Manager
45

DataOwner

SelectionObject

SALOME, FreeCAD

SelectionManager

SelectionSingleton

Selector

SelectionFilter

SelectionGate

46Launcher
47Job
48Job Manager
49Job Watcher
50UserAgent
51AsyncConnection
52AsyncMessenger
53Proxy

三、架构设计

3.1 Knowledges about architecture: Roy T. Fielding

Ref. from Acise: A CAx Industrial Software Ecology 

A software architecture is an abstraction of the run-time elements of a software system during some phase of its operation. A system may be composed of many levels of abstraction and many phases of operation, each with its own software architecture.

Software architecture research investigates methods for determining how best to partition a system, how components identify and communicate with each other, how information is communicated, how elements of a system can evolve independently, and how all of the above can be described using formal and informal notations.

3.2 软件的质量属性

序号属性备注
1可维护性
2可移植性
3性能
4安全性

3.3 (架构)设计原则与惯例

序号原则、惯例备注
1Seperation of Concerns, SoC
2Single Responsibility Principle
3Interface  Segregation Principle

3.4 架构模式

序号模式备注
1Layered Architecture

1. 应用场景:业务逻辑垂直切分

2. 典型实现

Two Layers: Business, Presentation

Run Mode: Console, GUI

Singleton, Facade

2MVP

1. 释义:Model-View-Presenter

2. 应用场景:界面程序

3. 典型实现

MFC Document/View Architecture

Qt Model/View

3CQRS

1. 释义:Command Query Responsibility Segregation

2. 应用场景:业务水平切分为查询模型、命令模型

4EDA

1. 释义:Event-Driven Architecture

2. 应用场景:集成组件

5MDF

1. 释义:Modular Development Framework

2. 应用场景:业务逻辑水平切分

6Cloud Native1. 应用场景:多维度切分业务

四、原型验证:CAx软件开发框架ACISE

参考文献

Erich Gamma. Design Patterns:elements of reusable object-oriented software. Addison Wesley, 1994.

Joseph Ingeno. Software Architect's Handbook. Packt Publishing, 2018.

Roy T. Fielding. Architectural Styles and the Design of Network-based Software Architectures. 2000.

网络资料

大型CAx(CAD/CAE/CAM)工业软件开发中的关键组件icon-default.png?t=N7T8https://blog.csdn.net/qq_26221775/article/details/123193318?spm=1001.2014.3001.5501

Acise: A CAx Industrial Software Ecologyicon-default.png?t=N7T8https://blog.csdn.net/qq_26221775/article/details/133831665?spm=1001.2014.3001.5501

SALOMEicon-default.png?t=N7T8https://www.salome-platform.org/

FreeCADicon-default.png?t=N7T8https://www.freecadweb.org/

QGISicon-default.png?t=N7T8https://qgis.org/en/site/

Martin Fowler's GUI Architectureicon-default.png?t=N7T8https://martinfowler.com/eaaDev/uiArchs.html  

Qt Model/View Programmingicon-default.png?t=N7T8https://doc.qt.io/qt-6/model-view-programming.html

Document/View Architectureicon-default.png?t=N7T8https://learn.microsoft.com/en-us/cpp/mfc/document-view-architecture?view=msvc-170

  • 10
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值