|
|
|
|
|
by jallmann
5438 days ago
|
|
It sounds like you're making a lot of assumptions about its use case, without actually using it in production. This whole thing sounds drastically over-designed. And that initialization code is symptomatic of everything that is wrong with the statically-typed OO world. If you really need all that XML, what's wrong with this? var cluster = new RiakCluster("riakConfig");
var client = cluster.CreateClient();
var value = client.Get("my_bucket", "my_key");
...and I suspect you could probably omit the parameter to RiakCluster, since it appears to be fixed. If lib users need more control over configuration, then they can write extra code towards that. Don't require it for the basic, default case. |
|
You're right, we are making a few assumptions, which to me is natural given that this is v0.1.0. It hasn't been used it production because it never existed before now.
I fail to see how enabling clustering and connection pooling via configuration is over-design. Perhaps you could share some more detail on that?
The first line of your code sample is making assumptions itself. No, you can not omit the parameter to RiakCluster, the section name in the configuration is not fixed and is configurable by the user. This means you can have multiple clusters if you want to and configure them both in your config and specify them by name in your code.
The last two lines are exactly the same as what we have.
So really the only difference I see in your suggestion is the way that the configuration is wired in. Here's where your assumption comes in: you have assumed that the configuration is always in the same spot (ie. an app.config or web.config). There are no guarantees that this is the case.
Yes, we could probably change the interface so that it does search common configurations by default, and that is a suggestion that we're more than open to. As I said, this is v0.1.0 and it's just been unveiled. After using it, I'd be interested to see if you consider the configuration/wiring (which is still quite small, and a one-off task) painful.
We seem to be quibbling over one extra line of code, which ironically is substantially shorter than the comment that either of us has posted.
Having said that, we are always looking for ways to improve this kind of stuff, as I too hate unnecessarily verbose configuration. In our case, for version 0.1.0, we wanted to make sure the ability to configure and wire up in many different ways was available. In future revisions we'll no doubt look at home we can make this simpler.
With all this in mind, along with what I said in previous comments, how would you go about enabling this level of flexibility in the library without, as you put it, making it "drastically over-designed"?