Ray's playground

 
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 56 下一页

2011年2月14日

Item 23: Understand How Interface Methods Differ from Virtual Methods(Effective C#)

摘要: codeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--1usingSystem;2usingSystem.Collections.Generic;3usingSystem.Linq;4usingSystem.Text;56namespaceEffectiveCSharpItem237{8interfaceIMsg9{10voidMessage();11}1213publicclassMyClass:IMsg14{15publicvoidMessa 阅读全文

posted @ 2011-02-14 20:30 Ray Z 阅读(157) 评论(0) 推荐(0) 编辑

NSArrayController(Chapter 8 of Cocoa Programming for Mac OS X)

摘要: PersonCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->1#import"Person.h"234@implementationPerson56-(id)init7{8[superinit];9expectedRaise=5.0;10personName=@"NewPerson";11returnself;12}1314-(void)dealloc15{16[personNamerelease];1 阅读全文

posted @ 2011-02-14 17:48 Ray Z 阅读(423) 评论(0) 推荐(0) 编辑

2011年2月12日

Item 22: Prefer Defining and Implementing Interfaces to Inheritance(Effective C#)

摘要: Base classes describe and implement common behaviors across relatedconcrete types. Interfaces describe atomic pieces of functionality that unrelatedconcrete types can implement. Both have their place. Classes definethe types you create. Interfaces describe the behavior of those types aspieces of fun 阅读全文

posted @ 2011-02-12 22:33 Ray Z 阅读(156) 评论(0) 推荐(0) 编辑

2011年2月11日

Getting Started(Chapter 1 of Python 2.6 Text Processing)

摘要: codeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->1importsys2importstring34CHAR_MAP=dict(zip(string.ascii_lowercase,string.ascii_lowercase[13:26]+5string.ascii_lowercase[0:13]))67defrotate13_letter(letter):8"""9Returnthe13-charrot 阅读全文

posted @ 2011-02-11 23:26 Ray Z 阅读(180) 评论(0) 推荐(0) 编辑

Item 21: Limit Visibility of Your Types(Effective C#)

摘要: Those classes and interfaces that you expose publicly to the outside worldare your contract: You must live up to them. The more cluttered that interfaceis, the more constrained your future direction is. The fewer publictypes you expose, the more options you have to extend and modify anyimplementatio 阅读全文

posted @ 2011-02-11 21:08 Ray Z 阅读(189) 评论(0) 推荐(0) 编辑

2011年2月10日

Item 20: Prefer Immutable Atomic Value Types(Effective C#)

摘要: Immutable types are simpler to code and easier to maintain. Don’t blindly create get and set accessors for every property in your type. Your first choice for types that store data should be immutable, atomic value types. You easily can build more complicated structures from these entities. 阅读全文

posted @ 2011-02-10 21:24 Ray Z 阅读(132) 评论(0) 推荐(0) 编辑

Branching and Control Elements(Chapter 5 of XSLT 2nd Edition)

摘要: To invoke a template by name, two things have to happen: • The template you want to invoke has to have a name. • You use the <xsl:call-template> element to invoke the named template. The XSLT <xsl:template> element has a mode attribute that lets you pr 阅读全文

posted @ 2011-02-10 20:47 Ray Z 阅读(173) 评论(0) 推荐(0) 编辑

Key-Value Coding, Key-Value observing(Chapter 7 of Cocoa Programming for Mac OS X)

摘要: [代码]AppController.mCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->1#import"AppController.h"23@implementationAppController45-(id)init6{7[superinit];8[selfsetValue:[NSNumbernumberWithInt:5]forKey:@"fido"];9NSNumber*n=[selfvalueF 阅读全文

posted @ 2011-02-10 10:33 Ray Z 阅读(181) 评论(0) 推荐(0) 编辑

2011年2月9日

Item 19: Ensure That 0 Is a Valid State for Value Types(Effective C#)

摘要: The system initializes all instances of value types to 0. There is no way toprevent users from creating instances of value types that are all 0s. If possible,make the all 0 case the natural default. As a special case, enums usedas flags should ensure that 0 is the absence of all flags. 阅读全文

posted @ 2011-02-09 21:22 Ray Z 阅读(125) 评论(0) 推荐(0) 编辑

Item 16: Avoid Creating Unnecessary Objects(Effective C#)

摘要: The Garbage Collector does an efficient job of managing the memory thatyour application uses. But remember that creating and destroying heapobjects still takes time. Avoid creating excessive objects; don’t create whatyou don’t need. Also avoid creating multiple objects of referen 阅读全文

posted @ 2011-02-09 21:05 Ray Z 阅读(133) 评论(0) 推荐(0) 编辑

上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 56 下一页

导航