同步两个应用程序的设计模式
请不要因为我正在做的事情来评判我,因为我意识到这是一件奇怪的事情,但我的老板希望它作为一种内部工具。
我需要通过 Outlook 插件将任务与 Microsoft Project 文件和 Outlook 日历同步。该插件接受没有任何子任务的任务,并将它们放置在跨任务时间的日历中。我已设法让应用程序:
- 加载项目文件
- 在同步时从 Outlook 添加、更新和删除约会。
- 当项目与日历不同步时,进行加载工作。
- 监视项目文件并询问用户是否同步。
- 在 Outlook 中更新约会时,动态更新项目文件中的任务。
- 允许用户选择任务/约会的层次结构,例如任务 B 是任务 A 的子任务。
- 其他一些无聊的东西。
现在一切都很好,但今天我尝试逆向设计过程,我意识到设计远非完美。代码相当整洁,我觉得我已经避免了大多数代码味道,但我觉得从代码看设计并不明显,并且不容易立即理解。我刚刚开始对设计模式感兴趣,这里有人建议重构应用程序作为一种很好的学习方式。
有谁对常见设计模式有任何想法或链接,以帮助我在时间紧迫的情况下抢占先机,例如典型的现代同步模式。
非常感谢
保罗
Please don't judge me for what I'm doing because I realise it's a bizzare thing to do but my Boss wants it as an internal tool.
I needed to Sync the tasks with a Microsoft Project File with an outlook calendar via an outlook add on. The add on takes tasks that don't have any sub tasks and places them in the calendar spanning the time of the task. I have managed to get the application to :
- Load the project file
- Add, Update and Delete appointments from Outlook when syncing.
- Work out on load when the project is out of sync with the calendar.
- Monitor The Project File and ask the user whether to sync.
- Update tasks in the project file on the fly when updating appointments in outlook.
- Allow for the user to choose the hierarchy of the tasks/appointment such as Task B is a sub task of Task A.
- Some other boring stuff.
Now this all works fine but today I was trying reverse the desgin process and I realised that the design is far from perfect. The code is fairly tidy and I feel I have avoided most code smells but I feel the design is not obvious from looking at the code and is not easy to understand immediately. I've just started to get interested in design patterns and someone here suggested refactoring an application as a great way to learn.
Does anyone have any ideas or have any links for common design patterns to help me get a head start such as a typical modern sync pattern as time is in short supply.
Many Thanks
Paul
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道有什么架构模式适合专门同步两个应用程序。如果我们看到源代码,我们可以建议适合的设计模式,但我怀疑这是可能的:)。这是一个很棒的设计模式网站 http://www.dofactory.com/Patterns/Patterns。 aspx ,以及另一个很好的架构模式 http://martinfowler.com/eaaCatalog/ 。第二个链接来自 Martin Fowler 的有关企业应用程序模式的书。
请记住,只有在出现特定问题时才应使用模式。不要试图适应不存在这些问题的模式。常见错误。
I don't know of any architectural patterns that fit syncing two applications specifically. If we saw the source code we could suggest design patterns where they fit but I doubt that is possible :). Here is a great site for design patterns http://www.dofactory.com/Patterns/Patterns.aspx , and another good one for architectural patterns http://martinfowler.com/eaaCatalog/. THe second link is from Martin Fowler's book on Enterprise Application Patterns.
Remember, patterns are to be used only when specific problems arise. Don't try to fit a pattern where those problems don't exist. Common mistake.