摘要: Effective Java: Programming Language GuideItem 1: Consider providing static factory methods instead of constructor.Advantage: have a name, no new operator everytime, return any subtype of iteself. Consider pattern: Singleton and Factory method (with many different ways to implement: Creator by inher 阅读全文
posted @ 2013-08-21 09:16 iDragon 阅读(296) 评论(0) 推荐(0)
摘要: From:http://my.safaribooksonline.com/book/programming/cplusplus/9780321545190IntroductionThe C++ in More Effective C++Conventions and TerminologyReporting Bugs, Making Suggestions, Getting Book UpdatesBasicsItem 1: Distinguish between pointers and referencesItem 2: Prefer C++-style castsItem 3: Neve 阅读全文
posted @ 2013-08-20 16:12 iDragon 阅读(190) 评论(0) 推荐(0)
摘要: From:http://my.safaribooksonline.com/book/programming/cplusplus/0321334876?bookview=overviewhttp://www.kuqin.com/effectivec2e/Chapter 1.Accustoming Yourself to C++Item 1: View C++ as a federation of languagesItem 2: Prefer consts, enums, and inlines to #definesItem 3: Use const whenever possibleItem 阅读全文
posted @ 2013-08-20 16:09 iDragon 阅读(167) 评论(0) 推荐(0)
摘要: Layering & Contract Philosophy With additional indirection 1 class CComponent 2 { 3 public: virtual void Operation() = 0; 4 public: virtual void AddComponent(Component* p)= 0; 5 public: virtual void RemoveComponent(Component* p)= 0; 6 public: virtual Component* GetChild... 阅读全文
posted @ 2013-08-19 18:48 iDragon 阅读(306) 评论(0) 推荐(0)
摘要: Layering & Contract Philosophy With additional indirection. 1 class CWindowImp 2 { 3 public: virtual void DrawLine(){}; 4 public: virtual void DrawText(){}; 5 } 6 class CWindow 7 { 8 public: virtual void DrawLine(){}; 9 virtual void DrawText(){};10 protect:... 阅读全文
posted @ 2013-08-19 18:40 iDragon 阅读(277) 评论(0) 推荐(0)
摘要: Layering & Contract Philosophy With additional indirectionAdaptee object just is as a member. Adaptee object just relies on Adapter object.class CAdaptee{ public: void theExistingAndIncompatibleMethod(){ … } ;}class CTarget{ public: virtual void theNewMethod() = 0;}class CAdapter: public CT... 阅读全文
posted @ 2013-08-19 18:33 iDragon 阅读(197) 评论(0) 推荐(0)
摘要: Layering & Contract Philosophy With additional indirectionclass CSingleton{ Protect: CSingleton(); Protect: CSingleton(const CSingleton&); Protect: CSingleton& operator=(const CSingleton& rhs); Private: ~CSingleton(); Private: static CSingleton *pInstance; Public: static CSin... 阅读全文
posted @ 2013-08-19 18:26 iDragon 阅读(195) 评论(0) 推荐(0)
摘要: Hyperpolyglot.orgFrom Hyperpolyglot.orgC++ Style Languages: C++, Objective-C, Java, C#a side-by-side reference sheetgrammar and invocation | variables and expressions | arithmetic and logic | strings | regexes | dates and timearrays | dictionaries | user-defined types | functions | execution control 阅读全文
posted @ 2013-08-16 17:39 iDragon 阅读(651) 评论(0) 推荐(0)
摘要: FunctionFunction is composed of name, parameter (operand, type of operand), return value, body with another adornment like: inline, virtual, static, const, throw().我们必须在调用函数之前,就声明该函数否则会引起编译错误.函数声明由函数返回类型,函数名和参数表构成. 这三个元素被称为函数声明function declaration 或函数原型function prototype, 一个函数可在一个文件中被声明多次. 函数生命不需要指定 阅读全文
posted @ 2013-08-16 14:29 iDragon 阅读(327) 评论(0) 推荐(0)
摘要: Many thanks to the people who devote themselft to the common libs. STL four components Global Constructor and Destructor STL Allocator STL Vector STL 阅读全文
posted @ 2013-08-15 15:35 iDragon 阅读(642) 评论(0) 推荐(0)