不推荐List<T>做API原因有如下两点:1.首先List<T> 设计之初就没有设计成可扩展的,我们不能重新其任何方法.这就意味着,我们操作List<T>的时候却不 能有任何的通知机制,而Collection<T>却提供了SetItem虚方法以供重写,以便于我们在修改成员信息或者添加成员的 时候可以自定义实现通知机制.2.其次List<T>有许多的成员在很多的使用场景下是相关联的,这就是我们所说的List<T>对外公开了过多的成员方…
最近在阅读Framework Design Guidelines,本着现学现用的原则,于是就用FxCop工具对代码进行规范性检查时,发现了很多问题,其中包括命名以及一些设计上的规范. 其中,Do not expose generic lists 这条设计规范引起了我的注意.该规范指出“不要在对象模型中对外暴露List<T>,应该考虑使用Collection<T>,ReadOnlyCollection<T>或者KeyedCollection<K,V>,List…
Background C++ is one of the main development languages used by many of Google's open-source projects. As every C++ programmer knows, the language has many powerful features, but this power brings with it complexity, which in turn can make code more…
原文:http://www.thebuzzmedia.com/designing-a-secure-rest-api-without-oauth-authentication/ Situation You want to develop a RESTful web API for developers that is secure to use, but doesn’t require the complexity of OAuth and takes a simple “pass the cr…
http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html This document describes the style guide, tag and image conventions we use in documentation comments for Java programs written at Java Software, Oracle. It does not rehash r…
档 ID 420787.1 White Paper Oracle Applications Multiple Organizations Access Control for Custom Code Checked for relevance on 12-JAN-2011 See Change Record This document discusses how to update the customization code that is affected by the access con…
一.何为策略模式 策略模式是行为型模式的一种,主要用于需要使用不同的算法来处理不同的数据对象时使用,是一种可以在运行时选择算法的设计模式.也称为政策模式. 主要解决:在有多种算法相似的情况下,使用 if...else 所带来的复杂和难以维护. 何时使用:一个系统有许多许多类,而区分它们的只是他们直接的行为. 如何解决:将这些算法封装成一个一个的类,任意地替换. 应用实例: 1.诸葛亮的锦囊妙计,每一个锦囊就是一个策略. 2.旅行的出游方式,选择骑自行车.坐汽车,每一种旅行方式都是一个策略. 3.…
Introduction Span<T> is a new type we are adding to the platform to represent contiguous regions of arbitrary memory, with performance characteristics on par with T[]. Its APIs are similar to the array, but unlike arrays, it can point to either mana…
Google C++ Style Guide   Table of Contents Header Files Self-contained Headers The #define Guard Forward Declarations Inline Functions Names and Order of Includes Scoping Namespaces Unnamed Namespaces and Static Variables Nonmember, Static Member, an…
[the original link] One of Qt’s most reputed merits is its consistent, easy-to-learn, powerfulAPI. This document tries to summarize the know-how we’ve accumulated on designing Qt-style APIs. Many of the guidelines are universal; others are more conve…