Chris Dutrow
Chris Dutrow

Reputation: 50372

4-tier Application architecture - server side API with noSQL

I've been attempting to architect a server side API that runs using a noSQL database. I'm new to application architecture so I would like some feedback on how I have attempted to separate layers. I think a major part of whats throwing me is the use of a noSQL database which removes the constraint of having to have a defined data model beforehand while at the same time requiring denormalization routines on the data to ensure that data can be queries for quickly.

I'm using 4 layers:

I have a few questions about how I have this set up:

1) I believe that information defining denormalization (how and when copies of some ojects are made available in other objects) is part of the definiteion of the model, so I have the routines that provide this information in the model. However, the layer that actually has to do this is the Datalayer, specifically when information is being saved, so I put the routines for implementing the denormalization definitions found in the model in the data layer. Is this correct?

2) Similarly, I have the definitions for Permissions (who can access what information and under what curcumstances) in the model as well. But the business layer will be responsible for delivering this information to the REST API, so this is the layer that I have enforcing permissions. I do not have the data layer enforcing permissions because although some users may not have direct access to some data, that data may be modified indirectly through other actions that the user performs (for example, simple logging in whould update that user's "last_login_time" property although the user would never be able to modify that information at will) Is this correct?

3) Is there anything else here that I have incorrect, anything in general that I should watch out for or anything else I should know?

4) I'm using google app engine for this, either python of the Java low-level api. Is there a framework I should be using that already handles some of this, specifically the denormalization and the permissions?

Thanks!

Upvotes: 0

Views: 1152

Answers (1)

MStodd
MStodd

Reputation: 4746

Without knowing how complicated your data is, why have the data layer separate from the model? I tend to add functionality to my Google App Engine models to do whatever they need to in order to accept data from and get data to the business layer.

Also, why are you planning on using the low-level api instead of the persistence helpers which make persistence as easy as falling down?

I think you should take a couple steps back, define the problem you're trying to solve, and see what Google App Engine has built in to solve it. I'd need information about what you're trying to accomplish before telling you how to do it.

Upvotes: 4

Related Questions