Java programming to develop the most error-prone five errors

Preliminary more and more people use Java, but most of them did not do well prepared to meet the thinking (do not bear a sound system related practice), making it impossible to well controlling the Java project, and even lead after the Java system function and even often developing slowly when the machine. Many people think this is a messy result in Java, in fact, because the foundation: our original master software is the lack of common sense is not too inappropriate, there is understanding and misunderstanding on the way.
  Software life of
  software is a living, this may be the same old song, but because it is related to the reason layered architecture, focusing not repeat too far.
  A life of software is necessary to have a primary active scalable architecture foundation, followed by the non-functioning missing.
  Now many people thinking the software is still the focus falls on the latter: non-functioning missing, a software utility that no more missing the better, in fact, the key is still active architecture, the former is good, foundation structure, function and add just time job the amount of the issue, but assuming that architecture is not good, the function is no longer missing, nor perhaps including the future of all functions, the software is a living, growing in the future, more needs to participate in the function, but can not because the foundation architecture does not facilitate the active participation of a dead end .
  Because the average person there is short-sighted misunderstanding of the software, to seek higher function foundation architecture ( orLysoft ), eat the loss of many old software programmer from this profession, take away precious experience of losing new blind young programmers still the use of old thinking to go forward. In fact, many foreign structures such as the free open source ofbiz compiere and slide fraud also exists in this area, the shape of a perfect fit with appetite, in fact, similar to those of a few hundred dollars of domestic pirated software, scalability and sustained development of a serious shortage.
  So now pick some of the prevailing structures such as Hibernate, Spring / Jdonframework indicate whether you lay the foundation architecture of it? In fact, is not always the case, the key still depends on how you use these structures to establish your transaction system.
  SQL stored procedures and messy scam sentence
  The primary use of the process to talk about memory errors, the use of the storage process architecture can handle the function of people think that, in fact, it is precisely one of the leading culprits giant evil function problems, make example: Suppose a person on the verge of death, can be shot allowed to extend for six months, but it hit the pin, all other health plans will all fail, I ask you to use this short-sighted plan?
  Why do you say that? assume the stored procedure encapsulates the transaction process, then the work load will fit in the database end, to the center of J2EE application servers do? accounting and distributed to the central server of the cluster was transferred to do? only back to an earlier era would fit the database host. Now software is Internet-facing, not as early as constraints in a small local area network, multi-user concurrent call volume are unable to identify and measure, relying on a database host is obviously not able to withstand this harsh environment of a user visit. (Of course, engage in a database cluster is only fifty paces and paces the difference).
  From the hierarchical point of view, now three-tier architecture: presentation layer, transaction layer and a durable layer, cut three levels should be obvious, clear responsibility: the responsibility of durable resistant layer preservation transaction model policy, call transaction layer of durable layer only and help us to activate the early years entrusted its custody policy, therefore, is not as durable layer custodians, we will go to the center of its coiled its programming, in addition to asking them to repay the model policy, but also asking them to do it to do messy affairs portfolio. Make a example: You will be fruits and dishes at two policy entrusted custody custody at the station, when two days to take, you will also require depository fruit peeled and cut into pieces on a platter, made fruit dish for you, reasonable?
  above are talking about a phenomenon too far relying on durable layer, there is a contrary phenomenon, durable layer announced that it initially diverted transaction layer, corrosion transaction layer, the entire transaction layer everywhere to see is a data table shadow (including field data table), rather than policy matters. OO programmers should see this classic PoEAA. PoEAA that in addition to durable layer should not see the data table or field names in other local table.
  Of course, the amount of use of the storage process, the use of interest database is allowed. According to Evans DDD theory, SQL and stored procedure can sentence Specification as part of the rules.
  Hibernate ORM and other issues
  Now a lot of people use Hibernate, but they found Hibernate function is slow, so seek treatment plan, in fact, Hibernate function is not slow, but the way we use the fault occurred:
  "The recent positive themselves to engage in a project, the project we used the struts1. 2 + hibernate3, because the contact between the contact messy tables and table many, many local lazy are set to false, resulting in a data loading is slow, and a data query is very slow. "
  Hibernate is a model based on policy durability of skills, therefore, the key is we demand planning policy model of high quality, in accordance with the scope of DDD modeling guidelines, reducing reduce the associated processing related by way of useful fire layer. Assuming coiled datasheet planning program, plus the contact between the messy table (there is no scientific way to deal with, investigation or reduce these contact), will lead to slow system operation, in fact, the same problem also applies to preliminary Entity Bean to EJB CMP's complaint on the entity Bean is the Domain Model of durable, do not assume the primary planning Domain Model, but the planning data sheet, and durability of the policy planning things go their separate ways, can not see the problem? N on this issue for many years it argued in Jdon .
  Here the same extends one other question: database programming, database whether demand in the initial planning of the project?
  Assumed we were planning database, then a series of problems occurred: When we use Hibernate ended durable preservation, it is necessary to consider the pre-planned database table structure and how their affairs liaison and policy mapping end, this practice is very difficult to end, which is why many people find it difficult to handle a foundation structure using ORM address the cause.
  Of course, there are appropriate mental prosperous people can end, but the end of this coiled database mapping results must misunderstanding affairs policy, which is similar to the two plates (data tables and transaction policy) collided must earthquake, earthquake effect is to crash and burn , soft-party lose, transaction policy is the code appropriate to the data table structure, attributed the soft side, what causes a transaction to become policy data transmission policy DTO, DTO everywhere, function and maintenance problems have cropped up.
  Modeling category dealt with many of these uncoordinated issues, particularly the use of ORM painful questions about ORM / Hibernate still use the old saying goes: Suppose you do not grasp the scope of the modeling approach, then do not use Hibernate, on this level you: perhaps No ORM is a simple way: No ORM: Simplest Solution at the
  Spring issue layered hostile
  Spring is a challenge EJB face presents itself with a robust custom components function is interest, but the real problems exist, as the Spring affairs layer structure, does not support the transaction layer function Session.
  Detailed examples: when we like the end of the cart affairs function, save the shopping occasion to demand the Session ( prassLLp ), because the transaction layer is not convenient Session support, we had to save the shopping cart HttpSession, but only through HttpSession HttpRequest was adjusted to obtain, and then because the transaction layer in the Spring container is not HttpRequest visit to this policy, so, what we can only "save cart to HttpSession" function on the presentation layer in the end, and this function should be obvious attributable to the transaction layer function, which leads to our Java project-level disturbances, poor maintenance. Violation of the initial purpose use Spring and layered architecture.
  DDD drive category planning
  now let's talk about the focus back up, layered architecture foundation is one of the reasons we use the Java domain modeling expert Eric Evans in his "Domain Model Design" book begins with a primary focus is divided layer architecture, the whole theory and practice DDD is to inform you how we use the model policy oo skills and layered architecture to plan the end of a Java project.
  We now know that many people simply Java project has three layers: the presentation layer and transaction layer resistant layer, when we talk about how stubborn in the selection of the layers of the structure, we practice on real life project development industry has not yet preliminary, that we selected certain combinations of structures (such as Struts + Spring + Hibernate or Struts + EJB or Struts + JdonFramework), we are not aware of the transaction layer operations also needs a lot of work, DDD supply a new level of thinking again the difference in the transaction layer, such as Category layer and the service layer, and the layer is subdivided into operation before adjusting layer, strategic level and so on. Messy loosely coupled software accessible via the level of refinement approach. DDD supply a breakdown of how tier approach.
  When we will focus on the skill level of infrastructure spending and talk about research, we might forget to pick these architectures based on what skills? What are the selection criteria? Drive category planning DDD answer the question, DDD will tell you assume a structure you can not help end a layered architecture, then throw it away, together, DDD also pointed out that the purpose of considering the selection of the structure, so that you will not echoed, fall into the messy details of skill in the fog, lost its foundation in the direction of architecture selected.
  Now some people mistakenly believe that DDD is a new theory, in fact, the same DDD and planning forms, is not a new theory, but a summary of actual combat experience, it will use the previous model-oriented planning approach derives from experience, for newcomers to learn, in order to quickly find the foundation of our software controlling the project road. In many ways it can be seen in practically the entire Java software industry advanced thinking is always one step ahead, not much to say here.

Guess you like

Origin www.cnblogs.com/monkey7788/p/12093688.html