《大话设计模式》

第3章

上一章 封面 下一章

这天大B问小A:“怎样设计可复用的面向对象软件?”

小A:“师兄你这是考我么?”

大B:“啥啊?我这是想看你在学校是不是真学到了东西。”

小A:“得得得,那我就说说吧!设计模式是一套被反复使用、多数人知晓的、经过分类编目的、代码设计经验的总结。使用设计模式是为了可重用代码、让代码更容易被他人理解、保证代码可靠性。设计模式于己于他人于系统都是多赢的,设计模式使代码编制真正工程化,设计模式是软件工程的基石,如同大厦的一块块砖石一样。”

大B:“我再考考你,用C++、Java、C#www.youxs.org。”

小A不到几分钟就给大B一个程序。

/*

*(#)/03/18

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

*901SanAntonioRoad,PaloAlto,California,94303,www.youxs.org.

*Allrightsreserved.

*ThissoftwareistheconfidentialandproprietaryinformationofSun

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

*disclosesuchConfidentialInformationandshalluseitonlyin

*accordancewiththetermsofthelicenseagreementyouenteredinto

*withSun.

*/

/**

*Classdescriptiongoeshere.

*horFirstnameLastname

*/

publicclassBlahextendsSomeClass{

/*Aclassimplementationmentcangohere.*/

*classVar2documentationmentthathappenstobe

*morethanonelinelong

*/

privatestaticObjectclassVar2;

/**instanceVar1documentationment*/

publicObjectinstanceVar1;

/**instanceVar2documentationment*/

protectedintinstanceVar2;

/**instanceVar3documentationment*/

privateObjectinstanceVar3;

/**

publicclassBlahextendsSomeClass{

/*Aclassimplementationmentcangohere.*/

*classVar2documentationmentthathappenstobe

*morethanonelinelong

*/

privatestaticObjectclassVar2;

/**instanceVar1documentationment*/

publicObjectinstanceVar1;

/**instanceVar2documentationment*/

protectedintinstanceVar2;

/**instanceVar3documentationment*/

privateObjectinstanceVar3;

/**

*……constructorBlahdocumentationment……

*/

publicBlah{

//……implementationgoeshere……

/**

*……methoddoSomethingdocumentationment……

*/

publicvoiddoSomething{

//……implementationgoeshere……

/**

*……methoddoSomethingElsedocumentationment……

*amsomeParamdescription

*/

publicvoiddoSomethingElse(ObjectsomeParam){

//……implementationgoeshere……

阅读大话设计模式最新章节 请关注热血小说网(www.oaksh.cn)

上一章 目录 下一章 存书架

其他热门小说

大话设计模式