Nhibernate + WCF + asp.net MVC + nvelocity PetShop4.0 Refactoring (i)--Architecture design
PetShop4.0 is an example of Microsoft's introduction to. NET Enterprise systems. There are many in the industry. NET and the Java EE dispute, many data is from Microsoft's PetShop and Sun's petstore. This argument inevitably has a strong commercial color, for our developers, there is no need to pay too much attention. However PetShop with the release of the update, to now based on the PetShop4.0 of. Net 2.0, the whole design gradually matured and elegant, and there are many things to learn from. PetShop is a small project, system architecture and code are relatively simple, but also highlights a lot of valuable design and development concepts.
However, there are many controversies in PetShop4.0, I think the garden must have a lot of PetShop4.0 "fans", refactoring PetShop4.0 will cause a lot of controversy, I hope that friends in the garden in the "communication technology" mentality to look at this problem. As for "refactoring", I only explained PetShop4.0 some unreasonable places in my personal view, and "modified", and introduced some of my "one-sided" architectural design ideas.
I personally think that PetShop4.0 has the following drawbacks:
1, the entry level of the architecture, not fully suitable for middle and senior developers to learn.
PetShop4.0 is an entry-level architecture for the. NET three-tier. As far as I know, most of the company's architectural models adopt or emulate PetShop4.0. I personally think that: as. NET developers, this does not fully understand the true meaning of layering, copy PetShop4.0, but not really flexible application PetShop4.0. I think the PetShop4.0 is hard for real large projects in scalability, reusability, load balancing. is a blank for distributed applications of server clusters.
2, the wrong guide to the programmer's in-depth understanding of the architecture.
A lot. NET developers are accustomed to think: Learn to PetShop4.0 later learned the structure of most companies. I personally think this is. NE Developer's sorrow. So far, PetShop4.0 has influenced the architecture of a generation of. NET programmers, and defined the design of this generation of programmers as "dead". It is customary to think of architecture as "Dal,bll,ui". I think that will hinder the architecture design. I think PetShop4.0 is just a "special column" rather than a generic architecture.
3, portability and reusability is weak.
For Sqlserverdal and Oracledal, adding a third database in real terms requires another DAL, which increases our development costs, and I personally recommend using an ORM framework to make it more appropriate. Because this facilitates a database transplant. In the persistence layer, basically each table needs the corresponding crud, it is recommended to use repository to get the code together. PETSHOP4.0 's SQL statement is written in the class, which I am opposed to, I tend to write SQL statements in the configuration file or template file (such as: ibatis.net), so that will look more flexible.
4. Only suitable for display. NET2.0 characteristics, in the NET3.5 above the environment but lost the advantage.
PetShop4.0 has been released for several years, in an era of endless new technologies. PetShop4.0 support for Ajax,web sericve, WCF, asp.net mvc is somewhat lacking. The generalization of Orm, IoC, AOP and other programming ideas is almost blank.
In view of the above issues, I am personally prepared to restructure the PetShop4.0 to the needs of new technology development.
Figure 1 is the reconstructed schema diagram:
(Figure 1)