Steamlining RavenDB, Part II - Why RavenDB Lazy Requests are in the Advanced section?
Join the DZone community and get the full member experience.Join For Free
i really like notion of reducing the number of remote calls, so why did i stick the lazy requests feature of ravendb in the session.advanced section of the api and not put it in the center, directly off the session?
the answer is that i expect lazy requests to be a very powerful feature, but at the same time, it isn’t important enough a feature for us to justify increasing the surface area of the session. one of the main goals with ravendb is simplicity and power. the simple stuff should be simple . we actually consider this a bug if you can’t pick up ravendb and start using it in ten minutes or less.
that does not means that we don’t add powerful features, but we are careful in ensuring that those features won’t contaminate the getting started scenario.
another consideration is that as powerful as lazy requests are, the common best practice for ravendb is already reducing the number of requests drastically, so we mostly need them for occasional use, vs. common usage. one we figured that in many cases, using lazy requests is a rare thing, the decision where to put it became much simpler. in other words, it doesn’t really matter if you are making two queries vs. one. it matters a lot more if you are doing 30.
one of the more interesting aspects of designing ravendb is actually in the exposed api. we are working hard to make sure that this api is as simple and predictable as possible. i am more than willing to give users options to solve specific problems, but it is important to consider that at its core, ravendb is a database, and as such, what people mostly care about is crud. and that is why the session interface is the way it is, because you get to do crud right off the bat, and if you want more knobs to turn and handles to crank, you go to behind the session.advanced door and can get all of the features that you could imagine.
another aspect of that is the suggestions of api from users for all sort of stuff. from savechangesandwaitforindexing to deleteall, etc.
those things are useful, sure. but they can be implemented as extension methods, and they wouldn’t be useful for the general case. the thing that i am trying to avoid is the case where you have something like what happened to rhino commons repository<t> , which got so many features to handle one off use cases that it was really quite hard to use for the common case.
Published at DZone with permission of Oren Eini, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.