这是API太简单了? [英] Is this API too simple?

查看:106
本文介绍了这是API太简单了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有键值存储的大量可用。目前,你必须选择其中之一,并坚持下去。我相信,一个独立的开放式API,而不是由一个key-value存储供应商进行将使存储之间更容易切换。

There are a multitude of key-value stores available. Currently you need to choose one and stick with it. I believe an independent open API, not made by a key-value store vendor would make switching between stores much easier.

所以我建立一个数据存储抽象层(如ODBC而是专注于简单的键值店),从而使他人建立一个应用程序一次,并在必要时修改键值存储。这是API太简单了?

Therefore I'm building a datastore abstraction layer (like ODBC but focused on simpler key value stores) so that someone build an app once, and change key-value stores if necessary. Is this API too simple?

get(Key)
set(Key, Value)
exists(Key)
delete(Key)

由于所有到目前为止,我所看到的的API似乎增加这么多,我想知道很多其他方法怎么是必要的?

As all the APIs I have seen so far seem to add so much I was wondering how many additional methods were necessary?

我已经收到了一些回复说集(空)可以用来删除一个项目,如果获得返回null,这意味着一个项目不存在。这是不好的原因有两个。首先,是不是好混的返回类型和状态,其次,并不是所有语言都有空的概念。参见:

I have received some replies saying that set(null) could be used to delete an item and if get returns null then this means that an item doesn't exist. This is bad for two reasons. Firstly, is it not good to mix return types and statuses, and secondly, not all languages have the concept of null. See:

<一个href=\"http://stackoverflow.com/questions/2324337/do-all-programming-languages-have-a-clear-concept-of-nil-null-or-undefined\">http://stackoverflow.com/questions/2324337/do-all-programming-languages-have-a-clear-concept-of-nil-null-or-undefined

我也希望能够对数据进行多种类型的操作,但据我所知它什么都可以建立在一个关键值存储之上。它是否正确?我应该提供这些增值功能呢?例如:像马preduce,或索引

I do want to be able to perform many types of operation on the data, but as I understand it everything can be built up on top of a key value store. Is this correct? And should I provide these value added functions too? e.g: like mapreduce, or indexes

在内部,我们已经有这种用Erlang和Ruby一个基本的版本,它为我们节省了大量的时间,而且还使我们能够测试不同的关键值存储的特定使用案例

Internally we already have a basic version of this in Erlang and Ruby and it has saved us alot of time, and also enabled us to test performance for specific use cases of different key value stores

推荐答案

您的API缺少像hasKey和清除一些有用的功能。你可能想看看,说,Python的破解它, HTTP://docs.python .ORG /教程/ datastructures.html#词典和挑选的附加功能。

Your API lacks some useful functions like "hasKey" and "clear". You might want to look at, say, Python's hack at it, http://docs.python.org/tutorial/datastructures.html#dictionaries, and pick and choose additional functions.

每个人都在说,简单就是好,直到这是真的简单太简单了。

Everyone is saying, "simple is good" and that's true until "simple is too simple."

这篇关于这是API太简单了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆