问题描述
我不希望我的PHP编码器再写Javascript。我想将javascript编码和php编码分开。我应该如何编写有关这种交互的文档?
I don't want my PHP coder to write Javascript anymore. I want to separate javascript coding and php coding. How should I write documentation about this interaction?
让我们想象一下真正简单的ajax请求。对我而言,文档应包含序列流程图。
Let's imagine really simple ajax request. As for me documentation should contain sequence flow diagram.
- 用户单击编辑按钮
- 预加载器显示给用户
- ajax请求发送到url / ajax_request / category / {category_id} /;我们期望json格式的答案
- 计时器已启动;如果在10秒内未收到答案-显示警报连接超时,请尝试刷新页面并再尝试一次。
- ajax请求已接收到var data
- 隐藏预加载器
- 检查data.success是否为false,然后显示警报出问题了。
- 放入data.html在容器中
- user is clicking "edit" button
- preloader is shown to user
- ajax request is sent to url /ajax_request/category/{category_id}/; we are expecting answer in json format
- timer has started; if answer is not recieved within 10 seconds - show alert "Connection timeout, please try to refresh page and try one more time."
- ajax request is recieved into var data
- hide preloader
- check if data.success is false then show alert "Something goes wrong."
- put data.html in container
如您所见,真的很难以文本格式解释此流程。我知道可以用UML描述这种事情,但是我没有经验。所有的UML示例都太简单了,我不明白如何构建更复杂的图。
As you see, it is really difficult to explain this flow in text format. I know there is UML for describing such things, but I have no experience. All UML samples are too simple and I can't understand how to build more complicated diagrams.
请任何人(UML专家),你能告诉我UML图将如何看看我的例子。
Please, anyone (UML expert), could you show me how UML diagram will look for my example.
我非常感谢您的帮助。谢谢!
I really appreciate any help. Thank you!
推荐答案
有更多关于您的问题的图表。问题是:您想代表什么?
There are more diagrams for your problem. The question is :"What do you want to represent?"
- 从步骤1到步骤8的流程
您应该绘制行为图。
您可以使用用例(代表用户动作的图表),活动图(代表算法或流程的寿命)或状态图(如果您想要代表特定组件在组件中的演变)流程,例如http请求)。
另外,您可以使用交互图来表示服务器和客户端之间的相互依存关系。 - 结构
通常,您应该使用Class图。以简单的方式:
- 客户端类;
- 服务器类;
- 请求的类;
- bla bla
- Flow from your step 1. to your step 8You shuold draw a Behavior diagrams.You can use an Use Case (diagram for represent the actions of user), Activity diagram (represent the life of a algorithm or process) or a State Diagram (if you want to represent the evolution of a specific component in the flow, f.e. the http request).Otherside, you can use an Interaction diagram for represent the interdipendence between server and client.
- StructureGenerally you should use a Class diagram. In simple way:
- a class for client;
- a class for server;
- a class for the request;
- bla bla
这种图对于用户的可用性/功能活动没有用。
This kind of diagram is useless for the usability/functional activity for the user.
- UML4WEB 您可以使用的图表,后者为Web 。
- UML4WEB You can use the Diagrams of Conallen, who made an extension of UML for the WEB project.
这篇关于HTML / Javascript编码器和服务器脚本语言编码器之间的交互?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!