找回密码
 加入
搜索
查看: 1998|回复: 0

[交流] 对于项目代码进行MVC功能模块划分的一点探讨

[复制链接]
发表于 2014-4-12 22:40:11 | 显示全部楼层 |阅读模式
以前一直在做Java开发,用惯了MVC三层架构思想,觉得这样管理代码很方便。
最近在接触AutoIT,用下来感觉也不错,只可惜不是面向对象的,当然不存在类技术的使用。
于是想着将代码功能模块分层设计的思想也用到AutoIT项目中,虽然感觉不是很纯净但也不错。
不知道各位有没有更好的经验在此分享。我先献丑将自己上面所述想法用简单的代码形式贴出,请各位多多赐教。
1、首先是“视图层” Views.User.au3文件
#include <GUIConstantsEx.au3>
#include <Constants.au3>
#include "Controllers.User.au3"

_main()
Func _main()
        GUICreate("Main...")
        $test = GUICtrlCreateButton("Insert", 20, 20, 90, 30)
        GUISetState()
        While 1
                Switch GUIGetMsg()
                        Case $GUI_EVENT_CLOSE
                                Exit
                        Case $test
                                $msg = _doInsert()
                                MsgBox(2262208, 0, $msg)
                EndSwitch
        WEnd
EndFunc   ;==>_main
2、其次是“控制层” Controllers.User.au3文件
#include "Model.User.au3"
Func _doInsert()
        Return _insert()
EndFunc   ;==>_doInsert
3、最后是“模型层” Model.User.au3文件
Func _insert()
        Return "Insertted successfully!"
EndFunc   ;==>_insert
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-20 05:31 , Processed in 0.070784 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表