simple-android-framework / android_design_patterns_analysis Goto Github PK
View Code? Open in Web Editor NEWAndroid源码设计模式分析项目
Android源码设计模式分析项目
我觉得AdapterView与Adapter间并不是桥接模式吧?桥接模式的意图是将抽象与它的实现分开变化,AdapterView是一个View,而Adapter是一个适配器接口,AdapterView我觉得只是适配器模式的一个Client。AdapterView是泛型或模板方法,如果说他们之间是桥接模式,感觉有点牵强。
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,所以其他线程也不会再次创建;
这样子读取过程也没问题吧?
可否完善其他设计模式呢,Android源码设计模式与实战的忠实读者。书写实在是太好了,精简、易懂、实用。源码解析能否补充一下,让大家共享
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.