Design Pattern

  • View
    1.404

  • Download
    1

Embed Size (px)

DESCRIPTION

 

Transcript

  • 1. Design Pattern Martin Chen

2.

  • Facade Pattern
  • Factory/Strategy Pattern
  • Adapter Pattern

3. 3-tier Application

  • Presentation Tier
  • Business Logical Tier
  • Data Access Tier

Presentation BusinessLogical Data Access 4.

  • , , .
  • (Design Pattern).
  • .

5.

  • 'WRITTEN BY I20587
  • DIM TABLE_TYPE,KEY_YEAR,KEY_MONTH,KEY_WEEK,SQL_YEAR
  • DIM PERIOD,MSG,FROM_YEAR,FROM_MONTH,FROM_DAY,TO_YEAR,TO_MONTH,TO_DAY
  • ..
    • DIM RS,CN,SQL
  • SET CN=SERVER.CREATEOBJECT("ADODB.CONNECTION")
  • SET RS=SERVER.CREATEOBJECT("ADODB.RECORDSET")
  • Const UDBDSN = "DSN=DBCSC;uid=NTUSER;pwd=WINNER;"
  • CN.OPEN UDBDSN
  • TABLE_TYPE=Request.Form("TABLE_TYPE")
  • P_REPORT=Request.Form("P_REPORT")
  • KEY_YEAR=trim(Request.Form("KEY_YEAR"))
  • ..
  • '1.
  • 'RESPONSE.WRITE "HERE"
  • SQL="SELECT * FROM UP.TBUPWK order by YEAR_UPWK DESC,MONTH_UPWK desc,WEEK_UPWK desc"
  • 'RESPONSE.WRITE SQL
  • rs.open sql,cn
  • do while not rs.eof
  • SQL="SELECT DATE_W13 FROM UP.TBUPW13 WHERE DATE_W13 BETWEEN '" & RS("FROM_YEAR_UPWK") &_
  • RS("FROM_MONTH_UPWK") & RS("FROM_DAY_UPWK") & "' AND '" & RS("TO_YEAR_UPWK") &RS("TO_MONTH_UPWK") & RS("TO_DAY_UPWK") &"'"
  • rs2.open sql,cn
  • if not rs2.eof then
  • .

6. Facade ( ) Pattern

  • (Communication) .

7. 8. 9.

  • ExecuteCommand Connection Command DataAccessObject
  • Facade
  • Data Access Layer Facade Pattern

10. 11. Factory Pattern , Strategy Pattern

  • Factory Method Pattern , .
  • Strategy Pattern , (Policy) . , ; , , .

12.

  • Data Access Layer
    • SQL Server Access Data Access Layer
    • SQL Access Data Access

13. 14. 15.

  • DataSet DataReader Scalar
  • Oracle ?
    • Oracle Oracle

16. Pattern

  • Icommand SQL
  • SOLCommand SQL Access OleDBCommand Icommand

17. 18.

  • Icommand

19. 20. 21.

  • CommandFactory Icommand
  • Factory CommandFactory Strategy

22. Adapter( ) Pattern

  • ?
  • ?
  • ?

23. 24.

    • Dim Graphic as ChartOperation = new PieChartOperation()
    • Dim Graphic as ChartOperation = new Adapter()
    • Adapter.DrawPieChart() call NewPieChartOpertion.Draw_A_PieChart()
    • Graphic.DrawPieChart() ==NewPieChartOpertion.Draw_A_PieChart()

25.

  • Adapter Pattern

26.