plantUML教程(使用实战)

写在前面

经过一段时间设计模式的学习,发现自己非常想写点东西并且把自己之前写过的代码整理出uml图,但是考虑本人实在不愿意搞一些图框拼来拼去(主要还是懒),在加上长期使用markdown进行写作,所以希望有一款类似于markdown的工具帮助我们完成uml图.


plantUML

这个工具是网上推荐量比较大的一个工具吧,抱着试一试的态度去学习使用,学习的方式是通过阅读官网的文档(文档真的很良心,而且学习难度不是很高)

工作方式

其实只要自己尝试的安装一次就知道大概明白他的工作原理和为什么画粗来的图比较丑(吐槽下java的GUI组件)

Created with Raphaël 2.2.0 开始 编写脚本 java编译 语法正确? 结束 yes no

plantUML的优势以及与其他画图工具的对比

学习过程

这里先把学习的过程放出来吧,仅供大家参考

整个过程耗时大约2h

成果展示

直接把生成的图片贴上来吧

这里是使用到的源代码

@startuml

namespace controller #DDDDDD {
	class TestController {
		- QuestionServicen questionService;
		+ Question getQuestion(@DBExchange,int questionId);
	}
	TestController <--> spring.aop.DBExchangeHandler : Spring AOP
}

namespace service #DDDDDD {
	interface QuestionService {
		+ {abstract} Question getMessage(int questionId);
	}
	class DbImpl {
		+ Question getMessage(int questionId);
	}
	class RedisImpl {
		+ Question getMessage(int questionId);
	}
	DbImpl .up.|> QuestionService
	RedisImpl .up.|> QuestionService
}


namespace spring.bean #DDDDDD {
	class StateControl {
		- QuestionService questionService;
		- RedisImpl redisImpl;
		- DbImpl dbImpl;

		+ StateControl(QuestionService questionService);
		+ Question getMessage(int questionId);
	}
	StateControl --> service.QuestionService
	StateControl --> service.RedisImpl
	StateControl --> service.DbImpl
}

namespace spring.aop #DDDDDD {
	class DBExchangeHandler {
		- StateControl stateControl;
		- void before(JoinePoint joinePoint,@DBExchange dBExchange);
	}
	DBExchangeHandler -down-> spring.bean.StateControl : get really status for QuestionService
}

annotation DBExchange

DBExchange ... controller.TestController : label annotation
controller.TestController *--> service.QuestionService

@enduml
  • 5
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值