How to package design

  Abstract: How to package design 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width = "100%" border = "0" cellspacing = "0" cellpadding = " 0 "> <tr> <td width="271" height="86" align="center" valign="top"> </ td> <td width="429" valign="top"> 

  We in the design of small application procedures, designed their own category does not require much concern about the issue of subcontracting, but when the design of the application must be when a subcontractor. 

  However, between classes and types rely on some of the time, this reliance on relations across packet may even extend to other packages, packages and package is also dependent on relations between the two.    How kind of package management? 

  The following issues need to consider: 
  1) to the package in the category of time should be allocated in accordance with the principles? 

  2) what should be used to manage the design principles of the relationship between the packet? 

  3) a design principles should be in the first category (top-down)?    Or the design of the first packet?    (Bottom-up) 

  4) show how the actual package?    In C + + how?    Java in how performance? 

  5) package to create good, they will be used for what purpose? 

  </ Td> </ tr> <tr> <td height="20" colspan="2"> 

  Bottom-up package design principles: 
  Packet cohesive principles: 
  ( 
  1) reuse of common principles. 
  For users, dependent on a roll when the time is dependent on a roll in all the categories, not just one category.    In other words, should be included in the category are inseparable.    Otherwise, the package will directly affect users of the unnecessary re-release, the compiler.    (This principle is too isolated to avoid packet rough.) 

  2) the principle of the common closed 
  Included in the category for the same type of changes in the nature of the closure should be common.    If a change if the impact of a packet, then he is included in the category have an impact, and other packages do not have an impact.    (This principle can be avoided share too small packages!) 
  ) 

  Packet-dependent principles: 
  ( 
  1) No ring rely on the principle.    The dependence graph of the package does not allow the existence in the ring. 
  "This work experience? Work a full day has finally completed a function after returning home early to work the next day found that the function does not work, what are the reasons? Because someone走得比you later, and changes you rely on those things 。"— morning after SARS. 

  2) reliance on the principle of stability. 
  In the direction toward stability depend on. 
  Stability? 
  If things need to change a lot of time and energy, which is difficult to change, then it is stable. 
  The stability of a class method is to let a lot of dependence on it, so that it has refused to change the n reason is stable.    On the contrary, if a class without any dependence on ourselves, but rely on other categories, then that is unstable. 

  3) The stability of abstract principles. 
  An abstract class is usually very flexible and able to adapt to the needs of OCP.    Packet level of abstraction got stability should be consistent. 
  Namely: the more stable package, which should be the class is the most abstract. 
  ) 

  </ Td> </ tr> </ table> </ td> </ tr> <tr> 

  ↑ Back 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • DotNetKicks
  • DZone
  • Netvouz
  • Propeller

Tags: , ,

Releated Java Articles

Comments

Leave a Reply