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

Responses should follow the principle of least astonishment #14

Open
Ravenstine opened this issue Sep 4, 2014 · 0 comments
Open

Responses should follow the principle of least astonishment #14

Ravenstine opened this issue Sep 4, 2014 · 0 comments

Comments

@Ravenstine
Copy link

For example, Piwik::Referers.getKeywords will normally return an array of hashes if the site has multiple keywords.

However, if the site is new and has a single keyword, won't return a hash but instead a single hash. Instead, that same hash should be returned inside an array to reduce the extra code necessary.

If a site has no keywords, the response is a single hash: {"nb_visits" => 0}

This is not only unnecessary, but it is yet again another case that require extra code to be written.

Instead, an empty array should be the result.

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