Reviewing RavenBurgerCo: What could be improved?
There are two things that I would change in the RavenBurgerCo sample app.
The first would be session management, I dislike code like this:
I would much rather do that in a base controller and avoid manual session management. But that is most a design choice, and it ain’t really that important.
But what is important is the number of indexes that the application uses. We have:
And I am not really sure that we need all three. In fact, I am pretty sure that we don’t. What we can do is merge them all into a single index. I am pretty sure that the reason that there were three of them was because there there was a bug in RavenDB that made it error if you gave it a null WKT (vs. just recognize this an a valid opt out). I fixed that bug, but even with that issue in place, we can get things working:
And from then, it is just a matter of updating the queries, which now looks like the following:
Getting the restaurants near my location (for Eat In page):
Getting the restaurants that deliver to my location (Delivery page):
Getting the restaurants inside a particular rectangle (Map page):
Note that we use DefaultSpatialFieldName, instead of indexing the location twice.
And finally, getting the restaurants that are applicable for drive through for my route (Drive Thru page):
And that is that.
Really great project, and quite amazing, both client & server code. It is simple, it is elegant and it is effective. Well done Simon!