- 博客(23)
- 资源 (22)
- 收藏
- 关注
原创 六大设计原则之里氏替换原则
里氏替换原则定义里氏替换原则(Liskov Substitution Principle,LSP): 第一种定义:如果对每一个类型为S的对象o1,都有类型为T的对象o2,使得以T定义的所有程序P在所有的对象o1都代换为o2,程序P的行为没有发生变化,那么类型S是类型T的子类型。第二种定义: Functions that use pointers or references to base cla
2016-08-28 11:27:48 20642 6
原创 六大设计原则之开闭原则
开闭原则的定义开闭原则是java世界里最基础的设计原则,它指导我们如何建立一个稳定,灵活的系统。开闭原则定义如下:Software entities like classes,modules and functions should be open for extension but closed for modifications.一个软件实体如类,模块和函数应该对扩展开放,对修改关闭。什么是开闭
2016-08-28 10:32:38 42086 29
原创 六大设计原则之迪米特原则
迪米特原则的定义迪米特原则(Law of Demeter,LoD),也叫最少知识原则(Low knowledge Principle,LKP):一个对象应该对其他对象有最少的了解。通俗的讲:一个类对自己需要耦合或调用的类知道的最少,你(被耦合或调用的类)的内部是如何复杂和我没有关系,我就知道你提供的public方法,我只调用这些方法,其它的我不关心。迪米特原则的具体要求迪米特原则对类的低耦合提出了明
2016-08-27 16:05:36 4045
原创 六大设计原则之接口隔离原则
接口隔离原则定义接口隔离有两种定义:Clients should not be forced to depend upon interfaces that they don’t use. 客户端不应该依赖它不需要的接口 那依赖什么呢?依赖它需要的接口,客户端需要什么接口就提供什么接口,把不需要的接口剔除,那就需要对接口进行细化,保证其纯洁性。The dependency of one cl
2016-08-24 21:20:55 11199 6
原创 六大设计原则之依赖倒置原则
依赖倒置原则定义依赖倒置原则(Dependence Inversion Principle ,DIP)定义如下:High level modules should not depend upon low level modules,Both should depend upon abstractions.Abstractions should not depend upon details.Deta
2016-08-23 11:42:52 12205 7
原创 六大设计原则之单一职责原则
单一职责原则单一职责原则(Single Responsibility Principle)–SRP:There should never be more than one reason for a class to change.应该有且仅有一个原因引起类的变更。单一职责原则好处降低类的复杂性每个类实现单一职责,并且单一职责都有清楚明确的定义,复杂性当然降低。提高可读性 类的复杂性降低了,当然
2016-08-17 20:20:28 7675
原创 设计模式之解释器模式--- Pattern Interpreter
模式的定义解释器模式(Pattern Interpreter)是一种按照规定语法进行解析的方案,在现在项目中使用较少。其定义如下:Given a language,define a representation for its grammar along with an interpreter that uses the representation to interpret sentences i
2016-08-16 17:32:04 823
原创 设计模式之桥梁模式--- Pattern Bridge
模式的定义桥梁模式是一个比较简单的模式,其定义如下:Decouple an abstraction from ist implementation so that the two can vary independently.将抽象和实现解耦,使两者可以独立的变化。类型结构类模式的使用场景不希望或不适用使用继承的场景例如继承层次过滤,无法更细化设计颗粒等场景,需要考虑使用桥梁模式接口或抽象类不稳
2016-08-15 18:51:35 894
原创 设计模式之享元模式--- Pattern Flyweight
模式的定义享元模式(Flyweight Pattern)是沲技术的重要实现方式,其定义如下:Use sharing to support large numbers of fine-grained objects efficiently.使用共享对象可有效地支持大量的细粒度的对象.享元模式的定义提出了二个要求:细粒度的对象和共享对象。分配太多的对象将有损程序的性能,同时还容易造成内存溢出。避免这种情
2016-08-15 17:28:12 1102
原创 设计模式之访问者模式--- Pattern Visitor
模式的定义访问者模式的定义如下:Represent an operation to be performed on the elements of an object structure.Visitor lets you define a new operation without changing the classed of the elements on which it operates.封
2016-08-14 17:04:54 1128
原创 设计模式之备忘录模式--- Pattern Memento
模式的定义备忘录模式定义如下:Without violating encapsulation,capture and externalize an object’s internal state so that the object can be restored to this state later.在不破坏封装性的前提下,捕获一个对象的内部状态,并在该对象之外保存这个状态。这样以后就可以将此对
2016-08-13 19:20:57 685
原创 设计模式之迭代器模式--- Pattern Iterator
模式的定义迭代器模式定义:Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.提供一种方法访问一个容器对象中各个元素,而又不需要暴露对象的内部细节。类型行为类模式的使用场景方便遍历访问容器内的元素优点面向对象设计原
2016-08-13 17:44:12 1018
原创 设计模式之适配器模式--- Pattern Adapter
模式的定义适配器模式(Adapter Pattern)定义如下:Convert the interface of a class into another interface clients expect.Adapter lets classes work together that couldn’t otherwise because of incompatible interface.将一个类的
2016-08-13 11:01:09 785
原创 设计模式之装饰模式--- Pattern Decorator
模式的定义装饰模式的定义:Attach additional responsibilities to an object dynamically keeping the same interface.Decorators provide a flexible alternative to subclassing for extending functionality.动态给一个对象添加一些额外的职责
2016-08-12 20:47:11 785
原创 设计模式之责任链模式--- Pattern chain-of-responsibility
模式的定义责任链模式定义如下:Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request.Chain the receiving objects and pass the request along the chain unti
2016-08-12 13:57:58 1334
原创 遗失的美好时光
今天查看邮件,无意中发现自己当年第一次离职时写的封邮件。伤感的我一读再读!感谢天,感谢地,感谢命运,让你我相遇! 自从有了你,生命里都是奇迹,多少痛苦,多少欢笑,交织成一片灿烂的记忆!这一首经典歌曲应该是向我那一段关于轰轰烈烈的青春的最好赞歌!致所有同事的离职信到最后,终于还是要离开Dear all:因为个人的原因,我要离开咱们的研发中心了,在这要和大家道别了。 关于康佳,关于研发中心的那一段和
2016-08-11 17:26:46 983
原创 设计模式之中介者模式---Mediator Pattern
模式的定义中介者模式定义如下:Define an object that encapsulates how a set of objects interact.Mediator promotes loose coupling by keeping objects from referring to each other explicitly,and it lets you vary their in
2016-08-09 09:22:17 5169 3
原创 设计模式之代理模式---Proxy Pattern
模式的定义代理模式(Proxy Pattern)也叫做委托模式,定义如下:Provide a surrogate or placeholder for another object to control access to is.为其他对象提供一种代理以控制对这个对象的访问。类型结构类模式的使用场景想想现实世界中,打官司为什么要找个律师?因为你不想参与中间过程的是是非非,只要完成自己的工作就可以,其
2016-08-08 17:11:10 847
原创 设计模式之门面模式---Facade Pattern
模式的定义门面模式(Facade Pattern)也叫做外观模式,定义如下:Provide a unified interface to a set of interfaces in a subsystem. Facade defines a highet-level interface that makes the subsystem easier to use.要求一个子系统的外部与其内部的通
2016-08-08 11:37:30 1375
原创 设计模式之命令模式---Command Pattern
模式的定义命令模式是一个高内聚的模式,定义如下:Encapsulate a request as an object,thereby letting you parameterize clients with different requests,queue or log requests,and support undoable operations将一个请求封装成一个对象,从而让你使用不同的请求
2016-08-06 10:37:34 5212
原创 设计模式之状态模式---State Pattern
模式的定义状态模式定义如下:Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.当一个对象内在状态改变时允许其改变行为,这个对象看起来像改变了其类模式的使用场景行为随状态改变而改变的场景这就是状态模式的根本出发点,例如权限
2016-08-05 15:29:06 877
原创 设计模式之组合模式---Composite Pattern
模式的定义组合模式(Composite Pattern)定义如下: Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly。将对象组合成树
2016-08-05 14:04:21 1049
原创 设计模式之UML类图
UML简介Unified Modeling Language (UML)又称统一建模语言或标准建模语言。类:从上到下分为三部分,分别是类名、属性和操作,其中类名是必须要有的。 类如果有属性,则每一个属性都必须有一个名字,另外还可以有其它的描述信息,如可见性、数据类型、缺省值等。 类如果有操作,则每一个操作也都有一个名字,其它可选的信息包括可见性、参数的名字、参数类型、参数缺省值和操作的返回值的类
2016-08-04 20:21:09 1174
ReflectDemo
2015-10-12
AIDL_RemoteService
2015-08-13
customViewActionbar
2015-02-03
ShowPercentView
2015-02-01
CustomViewPagerIndicator
2015-01-27
自定义圆形进度条
2014-11-27
Android_Animation
2014-09-10
ViewPagerDemo
2014-08-24
TestCaptureScreen.
2014-08-24
TestSharedPreferenceDemo
2014-08-24
testcontentprovider02
2014-08-24
TestContentProvider01
2014-08-24
android不同机型的适配的解决方案之按比例伸缩篇
2014-06-17
firstScreen
2013-06-04
一个简单的射击游戏
2013-05-31
flyshootMyself
2013-05-31
捕鱼达人的界面实现
2013-05-30
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人