代码改变世界

最近架构随想

2014-07-28 08:19 by 圣殿骑士, 6108 阅读, 62 评论, 收藏, 编辑

今天新加坡放假,闲来无事就发一篇博客:一则总结归纳项目构架经验,审视并逐步提高自己;再者分享最近学习所得,希望各位能讨论并给些建议。六月三十日从原来公司离职,七月一日入职新公司,不知不觉已经快一个月了。最近忙于学习新的行业知识以及项目的重构设计,没有时间发博客,也没有时间回复邮件及博文评论,忘各位见谅!

今天发几张项目重构设计草图,如果大家对项目分层与文件夹结构比较感兴趣,可以参考几年前弦哥.Net项目分层与文件夹结构大全(最佳架子奖,吐槽奖,阴沟翻船奖揭晓),这次的架构方案基本是之前架构经验第一次在保险行业的使用,希望各位能积极探讨并给些意见!

整体方案:

根据个人经验,架构决定项目的成败以及高度,所以在编码之前一定要设计好项目的整体规划和架构。好的架构或者考虑比较全面到位的架构会极大的帮助团队,对项目起到灵魂的作用;糟糕的设计往往会把整个项目组带入泥潭或者恶性循环,对项目直接致命打击!

回归正题:

  • 整个架构分为Online(Web Application)和Offline(WPF Application)两部分。
  • Online(Web Application)需要支持不同的设备及浏览器,所以采用Bootstrap和ASP.NET MVC with Razor作为View,KnockoutJs作为MVVM框架。UI Designer设计好UI,然后由前端工程师绑定相应的UI Model到UI,后端工程师则负责相应的OOAD以及业务处理。
  • Offline(WPF  Application)需要在没有网络的情况下能正常工作,所以采用WPF  XALM作为View,MVVM Light作为MVVM框架。UI和后端的处理以及任务分配和Online(Web Application)基本一致。
  • Services :设置了Switch功能,可以配置是否使用WCF或者Web API或者直接调用Dll。
  • Domain Model:始终是应用程序的核心,必须投入大量精力,按照面向对象的分析和设计 (OOAD) 进行设计同时按照OOP进行开发。
  • Infrastructure:主要包括数据访问组件、通用权限框架、异常和日志处理组件、IOC/AOP功能、缓存机制,邮件,配置等基础或常用功能。
  • 行业知识:由于项目牵涉到具体的行业(保险业),所以在业务流程中创建了Insurance Engine,专门处理保险相关的基础功能。
  • 权限系统:由于整个项目比较庞大,再加上其他系统也需要用到同样的权限判断,所以创建了一个新的权限数据库,用来存储及处理权限相关的所有数据及规则,所有用户则来源于三个数据源(SQL Server, DB2和Active Directory)。
  • Unit Test:每一层都有单独的单元测试,方便项目功能自测,维护,重构,升级以及管理。28-7-2014 12-31-12 AM

组件之间的详细关系如下:

28-7-2014 12-27-11 AM

各层之间的执行顺序如下:

28-7-2014 12-34-29 AM

权限系统:

  • 用户来源于三个数据源(SQL Server, DB2和Active Directory)。
  • 现实世界和系统通过角色进行关联,现实世界的用户及组的变化尽量不要影响到系统。
  • 一个用户可以有多个角色,一个角色也分配给多个用户。
  • 权限分为功能权限和数据权限。
  • 权限系统要提供给几套系统使用,全部的接口通过Service的形式提供出来。

security

由于时间有限,设计可能存在诸多不足之处,如果大家有不同的意见或者建议,不妨在评论中指出,以便互相学习且共同提高!


作者:圣殿骑士
出处:http://www.cnblogs.com/KnightsWarrior/
关于作者:专注于微软平台项目架构、管理和企业解决方案。自认在面向对象及面向服务领域有一定的造诣,熟悉设计模式、TDD、极限编程、领域驱动、架构设计、敏捷开发和项目管理。现主要从事WinForm、ASP.NET、WPF、WCF、WF、Silverlight 、Biztalk、Windows Azure等云计算方面的项目开发、架构、管理和企业培训工作。如有问题或建议,请多多赐教!
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。如有问题,可以邮件:KnightsWarrior(at)msn(dot)com  微博:圣殿骑士微博  联系我,非常感谢。

40
0
(请您对文章做出评价)
? 上一篇:关于新加坡IT薪酬
Add your comment

  1. #51楼[楼主] 圣殿骑士   2014-07-28 21:36
    @dotnet技术网
    引用我也有类似的想法,但真正开发起来,就非常麻烦,梦想很美好,现实很骨干。

    是的,很多时候实施起来比架构设计还难,不过类似项目经历多了就更容易一些了!
  2. #52楼[楼主] 圣殿骑士   2014-07-28 21:38
    @Da ge
    引用必须推荐,最好能有个demo让小伙伴们学习下

    DEMO还处在实施阶段!
  3. #53楼[楼主] 圣殿骑士   2014-07-28 21:40
    @春色园
    引用架构应该适应业务!!

    是的,这个架构就是适应业务和需求而画的,具体模块之间的划分还有几个图——用例图,类图,部署图等,由于与项目有关,没有公布出来。
  4. #54楼 jlzhou   2014-07-29 07:21
    期待代码示例 感谢
  5. #55楼 stoneniqiu   2014-07-29 08:14
    这样的项目 好想加入~~
  6. #56楼   2014-07-29 13:43
    请问一下你们单元测试用的什么框架
  7. #57楼 owlbcc   2014-07-29 14:32
    wpf的和mvc的两个viewmodel能不能合到一起?两个系统之间是不是差异还挺大的?
  8. #58楼 muki   2014-07-29 17:08
    架构太过于复杂了.
  9. #59楼 flyfish1986   2014-07-30 13:34
    来了!
  10. #60楼 HelloNet   2014-08-04 13:52
    看上去很牛逼的样子
  11. #61楼 Pansen   2014-08-05 08:58
    mark
  12. #62楼 高僧   2014-08-11 15:01
    楼主,上面这几图是用什么工具画的?

PHP wamp 环境配置

Before you can fix anything you need to know which service has not started, Apache or MySQL.

As the TEST PORT 80 utility is saying Apache is running its probably the MySQL service that has not started. Unless you have another Apache running!

So which service has not started???

If the wampmanager icon is not GREEN then one of the services ( Apache/MySQL ) has not started properly.

How to tell which service is not running if the wampmanager icon is orange.

Left click the wampmanager icon to reveal the menu-> Apache -> Service If the Start/Resume service menu is Green then Apache IS NOT running.

Left click the wampmanager icon to reveal the menu-> MySQL -> Service If the Start/Resume service menu is Green then MySQL IS NOT running.

If Apache is the service that is not running it is normally, but not always, because something else has captured port 80.

Now do, Left click the wampmanager icon to reveal the menu-> Apache -> Service -> Test port 80 This will launch a command window and display some information about what, if anything is using port 80.

Whatever it is should be re-configured to not use port 80 or uninstalled if you are not using it.

If port 80 is not the problem look for errors in the appropriate error log ( use the wamp manager menus to view the error logs )

If these do not exists or show no errors then also check the Windows Event Viewer Start -> Administrative Tools -> Event Viewer And look in the 'Windows Logs' -> Application' section accessed from the menu on the left of the dialog for error messages from Apache and or MySQL.

How to Configure SKYPE so it does not require port 80 or 443

Run SKYPE then using the menus do this: Tools -> Options -> Advanced -> Connection Un-Check the checkbox next to 'Use port 80 and 443 as alternatives for incomming connections' Now restart SKYPE for these changes to take effect.

If you are running Windows 8 SKYPE comes as an app and this cannot ( as yet ) be configured in this way. However if you uninstall the SKYPE app and install SKYPE in the old way, you can reconfigure it, and it works just as well.

posted @ 2016-03-23 09:27  hudasm  阅读(174)  评论(0编辑  收藏  举报