天天看点

Aha!设计模式(14)-BUILDER(5)

????

?

杩?????Builder妯″???涓昏?????锛?

1 ) 瀹?浣夸???浠ユ?瑰??涓?涓?浜у???????ㄨ〃绀恒??

?

棣?????纭?涓や釜璇???涓??????㈠凡缁????拌???璁捐?℃ā寮???涔?腑灏?representation缈昏????琛ㄧず锛?浣???璁や负搴?璇ヨ??涓鸿〃?帮?浜????充????ㄧ????瑙c??褰???浠??ㄤ??????瑰???涓ゅ骇澶фゼ?讹?瀹?浠??????ㄥ??朵???锛?浣???澶у??版???典?澶??ㄤ?浼?涓???????浠ヤ???璁や负锛???璁捐?℃ā寮???杩??ㄥ????瀹逛腑???扮???????搴?璇ユ???????????ㄦ??寤烘?ュ?e???㈢???i?ㄥ????

?

Builder瀵硅薄??渚?缁?瀵煎???ㄤ?涓?????浜у?????借薄?ュ?c??璇ユ?ュ?d娇寰??????ㄥ??浠ラ????杩?涓?浜у????琛ㄧず?????ㄧ?????瀹????朵?????浜?璇ヤ骇????濡?浣?瑁?????????涓轰骇??????杩??借薄?ュ?f??????锛?浣??ㄦ?瑰??璇ヤ骇???????ㄨ〃绀烘?舵??瑕?????????瀹?涔?涓?涓??扮???????ㄣ??

?

杩?娈佃???????涓???棰?灏辨????璋???琛ㄧ?帮????ㄧ?????濡?浣?瑁???????棰???

?

渚?濡?瀵逛?濡?涓???Work??妗c??

?

Aha!设计模式(14)-BUILDER(5)

?

??浠ュ??涔?杞??㈡???朵??煎???Builder锛?

?

Aha!设计模式(14)-BUILDER(5)

?

?

?借薄?ュ?e????瀹?涔?浜?????涓ょ???棰???姝f?????ュ?o??蜂???瀹??帮?渚?濡?濡?浣?琛ㄧ?帮???涔?瑁???绛?瀹??ㄤ氦缁??疯薄绫汇??

?

瀵逛?HtmlBuilder锛??剁????????浠跺?涓?锛??や?绾㈣?茬?浣?????瀛?浠ュ?锛?澧???浜???甯稿???淇℃??锛?渚?濡?HTML????锛???浠跺?濮?缁?????璁帮?META淇℃??绛?绛?锛?绛?绛???

?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
    <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=gb2312">
    <TITLE></TITLE>
    <META NAME="GENERATOR" CONTENT="OpenOffice 4.1.5  (Win32)">
    <META NAME="AUTHOR" CONTENT="Weiguo Xue">
    <META NAME="CREATED" CONTENT="20180719;21550277">
    <META NAME="CHANGEDBY" CONTENT="Weiguo Xue">
    <META NAME="CHANGED" CONTENT="20180719;22204665">
    <STYLE TYPE="text/css">
    <!--
        @page { margin: 2cm }
        P { margin-bottom: 0.21cm }
        A:link { so-language: zxx }
    -->
    </STYLE>
</HEAD>
<BODY LANG="ja-JP" DIR="LTR">
<P LANG="zh-CN" STYLE="margin-bottom: 0cm"><BR>
</P>
<P LANG="zh-CN" STYLE="margin-bottom: 0cm"><BR>
</P>
<P LANG="zh-CN" STYLE="margin-bottom: 0cm"><FONT FACE="Times New Roman, serif"><FONT SIZE=6 STYLE="font-size: 26pt"><SPAN LANG="en-US">Aha</SPAN></FONT></FONT><FONT SIZE=6 STYLE="font-size: 26pt">锛?</FONT><FONT FACE="Times New Roman, serif"><FONT SIZE=6 STYLE="font-size: 26pt"><SPAN LANG="en-US">DesignPattern(15)-BUILDER(5)
</SPAN></FONT></FONT>
</P>
<P LANG="zh-CN" STYLE="margin-bottom: 0cm"><BR>
</P>
<P LANG="zh-CN" STYLE="margin-bottom: 0cm"><FONT FACE="Times New Roman, serif"><FONT SIZE=6 STYLE="font-size: 26pt"><SPAN LANG="en-US"><STRONG><FONT COLOR="#000000"><SPAN STYLE="text-decoration: none"><SPAN STYLE="background: transparent">Consequences</SPAN></SPAN></FONT></STRONG></SPAN></FONT></FONT></P>
<P LANG="zh-CN" STYLE="margin-bottom: 0cm"><BR>
</P>
<P LANG="zh-CN" STYLE="margin-bottom: 0cm"><FONT FACE="Times New Roman, serif"><FONT SIZE=6 STYLE="font-size: 26pt"><SPAN LANG="en-US"><STRONG><FONT COLOR="#000000"><SPAN STYLE="text-decoration: none"><FONT SIZE=4><SPAN STYLE="background: transparent">Here
are key consequences of the Builder pattern:</SPAN></FONT></SPAN></FONT></STRONG></SPAN></FONT></FONT></P>
</BODY>
</HTML>      

?

瀵逛????风???ュ?o?MarkDownBuilder????浠ヤ?????妗o?

#

##

?

Here are key consequences of the Builder pattern:

澧?????????涓や釜琛ㄧず??棰?????璁帮?#??##??

?

浣???瑙???

?

??浣?澶у?锛???璇存??Andrew Koenig锛?璇磋?锛?Abstraction is selective ignorance. (?借薄灏辨???????╁?拌?绯?娑???) ???㈠?ヨ??璇存?借薄灏辨?????╂?у?板?涓??ㄥ??淇℃??????璧锋?ワ?瑁?浣???涓?瑙?????涓虹??涓?瑙?锛???浠ラ??浣?浜??????с???蜂???uilder妯″?锛?????浜???寤轰骇????缁???锛???浠ュ??颁?????涓???浜у?????垫椿?с??

?

娉??

?

????涓????茬?浣???瀛??藉?????璁捐?℃ā寮???涓?涔???

?

继续阅读