Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public API Audit #91

Closed
JakeWharton opened this issue Nov 26, 2014 · 0 comments
Closed

Public API Audit #91

JakeWharton opened this issue Nov 26, 2014 · 0 comments

Comments

@JakeWharton
Copy link
Member

  • Every public class should be exposed for a deliberate reason. Public is an exception to the rule, not the norm.
  • Every non-final public class should be non-final for a deliberate reasons. Non-final public classes are an exception to the rule, not the norm.
  • Every public constructor on a class should be exposed for a deliberate reason. Static factory methods are always preferred. Public constructors should be an exception to the rule, not the norm.

These rules are a subset of the well-defined, proven ways to minimize the overhead in evolving the API of a library as well as preventing people from trying to do too many dumb things.

There are a lot of other things to look at as part of the public API (public methods, fields, package names, whether things are serializable, etc.) but the above three are the most critical in my opinion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant