天天看小說

第3章

這天大B問小A:“怎樣設計可複用的面向對象軟件?”

小A:“師兄你這是考我麼?”

大B:“啥?。课疫@是想看你在學校是不是真學到了東西?!?

小A:“得得得,那我就說說吧!設計模式是一套被反覆使用、多數人知曉的、經過分類編目的、代碼設計經驗的總結。使用設計模式是爲了可重用代碼、讓代碼更容易被他人理解、保證代碼可靠性。設計模式於己於他人於系統都是多贏的,設計模式使代碼編制真正工程化,設計模式是軟件工程的基石,如同大廈的一塊塊磚石一樣。”

大B:“我再考考你,用C++、Java、C#或VB.NET任意一種面嚮對象語言實現一個簡單程序?!?

小A不到幾分鐘就給大B一個程序。

/*

*@(#)Blah.java1.8299/03/18

*Copyright(c)1994-1999SunMicrosystems,Inc.

*901SanAntonioRoad,PaloAlto,California,94303,U.S.A.

*Allrightsreserved.

*ThissoftwareistheconfidentialandproprietaryinformationofSun

*Microsystems,Inc.(“ConfidentialInformation”).Youshallnot

*disclosesuchConfidentialInformationandshalluseitonlyin

*accordancewiththetermsofthelicenseagreementyouenteredinto

*withSun.

*/

packagejava.blah;

importjava.blah.blahdy.BlahBlah;

/**

*Classdescriptiongoeshere.

*

*@version1.82

*@authorFirstnameLastname

*/

publicclassBlahextendsSomeClass{

/*Aclassimplementationmentcangohere.*/

*

*classVar2documentationmentthathappenstobe

*morethanonelinelong

*/

privatestaticObjectclassVar2;

/**instanceVar1documentationment*/

publicObjectinstanceVar1;

/**instanceVar2documentationment*/

protectedintinstanceVar2;

/**instanceVar3documentationment*/

privateObject[]instanceVar3;

/**

publicclassBlahextendsSomeClass{

/*Aclassimplementationmentcangohere.*/

*

*classVar2documentationmentthathappenstobe

*morethanonelinelong

*/

privatestaticObjectclassVar2;

/**instanceVar1documentationment*/

publicObjectinstanceVar1;

/**instanceVar2documentationment*/

protectedintinstanceVar2;

/**instanceVar3documentationment*/

privateObject[]instanceVar3;

/**

*……constructorBlahdocumentationment……

*/

publicBlah(){

//……implementationgoeshere……

}

/**

*……methoddoSomethingdocumentationment……

*/

publicvoiddoSomething(){

//……implementationgoeshere……

}

/**

*……methoddoSomethingElsedocumentationment……

*@paramsomeParamdescription

*/

publicvoiddoSomethingElse(ObjectsomeParam){

//……implementationgoeshere……

}

}

第144章第87章第119章第214章第155章第168章第126章第25章第98章第144章第183章第155章第30章第30章第138章第69章第67章第54章第86章第126章第42章第200章第53章第57章第19章第186章第146章第161章第131章第227章第128章第141章第105章第61章第149章第73章第147章第183章第201章第93章第18章第216章第62章第62章第79章第213章第164章第222章第175章第140章第80章第71章第35章第70章第5章第214章第218章第67章第192章第93章第111章第35章第130章第180章第133章第173章第105章第197章第207章第15章第32章第81章第135章第200章第84章第33章第48章第34章第93章第211章第34章第120章第62章第70章第203章第111章第92章第126章第58章第80章第151章第16章第108章第9章第79章第71章第52章第197章第82章第140章
第144章第87章第119章第214章第155章第168章第126章第25章第98章第144章第183章第155章第30章第30章第138章第69章第67章第54章第86章第126章第42章第200章第53章第57章第19章第186章第146章第161章第131章第227章第128章第141章第105章第61章第149章第73章第147章第183章第201章第93章第18章第216章第62章第62章第79章第213章第164章第222章第175章第140章第80章第71章第35章第70章第5章第214章第218章第67章第192章第93章第111章第35章第130章第180章第133章第173章第105章第197章第207章第15章第32章第81章第135章第200章第84章第33章第48章第34章第93章第211章第34章第120章第62章第70章第203章第111章第92章第126章第58章第80章第151章第16章第108章第9章第79章第71章第52章第197章第82章第140章
主站蜘蛛池模板: 北辰区| 尚义县| 五河县| 象山县| 郯城县| 郁南县| 丰顺县| 南昌市| 平潭县| 封丘县| 北碚区| 军事| 涟水县| 朝阳市| 珠海市| 项城市| 田林县| 红桥区| 南皮县| 三门县| 监利县| 汝州市| 盱眙县| 封开县| 和田市| 南川市| 平利县| 京山县| 清徐县| 新邵县| 农安县| 都兰县| 云浮市| 夏河县| 忻州市| 师宗县| 大连市| 旌德县| 开原市| 姜堰市| 洪洞县|