Giter Club home page Giter Club logo

android_design_patterns_analysis's Issues

AdapterView 与Adapter 间的模式

我觉得AdapterView与Adapter间并不是桥接模式吧?桥接模式的意图是将抽象与它的实现分开变化,AdapterView是一个View,而Adapter是一个适配器接口,AdapterView我觉得只是适配器模式的一个Client。AdapterView是泛型或模板方法,如果说他们之间是桥接模式,感觉有点牵强。

Seems useful

If possible, have someone to translate this to English, please :)

关于外观模式

外观模式第3小节电视遥控器的例子,测试代码部分貌似没写~直接把外观层copy下来了

外观模式在安卓系统中例子

这里的例子选用有问题。
Context-ContextWrapper-Activity 之间不是外观模式
原因在于:
从形式上看,外观模式的Facade一般不会继承自被外观类,以便隐藏原有的接口信息,同时简化本来复杂系统的使用。
从功能上看,Context的子类在持有Context对象的同时动态的为Context添加新的的内容或者改变其中的信息,而完成这种职责的一般是装饰者模式。
综上所述,Context-ContextWrapper-Activity/Application/Service... 这些之间的关系使用的应该是装饰者模式而不是外观模式.

单例模式--实现方式二:为何“不能完全避免并发带来的破坏”

请问double-check方式哪里会有并发带来的破坏呢?
创建的话是可以避免多次创建的:如果已经创建过,任何读得线程都可以直接返回;如果未创建,则第一个进入if分支的线程持有锁,其他线程都要等待,因为有double-check,所以其他线程也不会再次创建;
这样子读取过程也没问题吧?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.