《重构-改善既有代码的设计》Martin Fowler 摘要: 第八章 重新组织数据
Self Encapsulate Field 自封装字段
你直接访问一个字段,但与字段之间的耦合关系逐渐变得笨拙。
为这个字段建立取值/设置函数,并且只以这些函数来访问字段。
子类用超类数据时
Replace Data Value with Object 以对象取代数据值
...
分类:
其他好文 时间:
2014-06-20 12:42:22
阅读次数:
280
跳转页面的时候 我用的是 [self presentViewController:nLogin animated:NO completion:^{
}];,有A到B再到C,我现在再C页面返回的时候我想直接跳转到A页面 应该怎么做呢?
在C中
//关掉自己
[self
dismissViewControllerAn...
分类:
其他好文 时间:
2014-06-20 12:25:46
阅读次数:
237
现在,客户端需要根据服务器发来的命令进行动作。在方法 receiveData:fromPeer:inSession:context:末尾加入代码: if ([commandReceived hasPrefix:kCommandQuestion] && !self.isServer) { NSString *answersString = [commandReceived...
分类:
移动开发 时间:
2014-06-20 10:29:29
阅读次数:
259
1、
??
Recover Binary Search Tree
Two elements of a binary search tree (BST) are swapped by mistake.
Recover the tree without changing its structure.
Note:
A solution using O(n) space is pretty...
分类:
其他好文 时间:
2014-06-20 10:13:49
阅读次数:
243
caseUNDOATTENTION: { FriendInfo *info = [dataArray
objectAtIndex:0];
[self.managerattentionList:_pageIndexoneRecord:YESotherId:-100]; ...
分类:
其他好文 时间:
2014-06-13 13:59:53
阅读次数:
201
@property (nonatomic) dispatch_semaphore_t
semaphore;self.semaphore = dispatch_semaphore_create([self.progressViews
count]);dispatch_semaphore_wait(se...
分类:
其他好文 时间:
2014-06-11 12:51:06
阅读次数:
264
往往是,一个对象释放了多次,即多次释放。多为粗心所致。还有一种过渡释放,很隐蔽。查了很久才知道!NSUserDefaults*userDefault
= [NSUserDefaultsstandardUserDefaults];self.arrCollectionData=[userDefaulto...
分类:
其他好文 时间:
2014-06-11 12:10:31
阅读次数:
193
/验证规则详细配置 public function rules() { // NOTE: you
should only define rules for those attributes that // will receive user inputs.
...
分类:
其他好文 时间:
2014-06-11 10:05:03
阅读次数:
180
这个方法并未完成,仍然还要加入代码。将下列代码加到上述代码之后: // Setup window in external screen self.mirroredWindow = [[UIWindow alloc] initWithFrame:self.mirroredScreen.bounds]; self.mirroredWindow.hidden = NO; ...
分类:
移动开发 时间:
2014-06-07 14:47:25
阅读次数:
399
python实现的链表,包括插入、查找、删除操作
#!/usr/bin/python
class linknode():
def __init__(self,k,n=None):
self.key=k;
self.next=n;
def createlist(): #创建链表
n=raw_input("enter the num of nodes");
n=int(...
分类:
编程语言 时间:
2014-06-07 12:23:46
阅读次数:
204