문제

I'm currently planning a new project which involves a few Proof of Concept prototypes for testing before a real application will grow from it. The application will be mainly a iOS Application which communicates with a Database on a remote server over a WebService, so pretty basic stuff here.

As it always takes me a long time to configure the SQL Database and write the Application for the Server (RESTful API) I started to read through the possibilities of NoSQL Databases and their prebuilt possibilities to communicate/sync with a remote server. Which would clearly reduce the work needed for the Server part as far as my understanding of these things goes.

Now I started to read through MongoDB in addition with Eve (Python) which expands the HTTP REST API which MongoDB offers. As their RESTful API offers everything needed for a testing prototype I came to ask myself why I should even write my own REST API if I can get everything I need from Eve's API ?

What are the downsides of using Eve and MongoDB? What are the benefits to write my own RESTful API around my MongoDB Instance?!

도움이 되었습니까?

해결책

Generally, using a prepackaged library will offer benefits early on in a development cycle where you can make rapid progress by not concentrating on the details and muck that can make building a proof of concept application challenging and time consuming.

If you're just building a PoC, then often it doesn't matter what the specifics are of the construction, unless you also need to validate architectural choices. For example, it may be that it's easy to wire up a simple document model with your iOS application, but adding a layer of security on the existing framework may be difficult (I'm saying in general). Or, that by not giving enough attention to the data model, that it later becomes difficult to model the database in a relational database, or that even when staying with the same technology that was used in the PoC, that it won't scale well under load).

By building or extending your own Restful API, you'll have complete control over the entire experience. Many web platforms today make building a restful API quite natural so that the developer can concentrate on the application logic, rather than the plumbing of the architecture. So, you may not need to take on a complete end-to-end framework solution.

Frameworks are often opinionated, often to not any official specification. Once you've moved your code beyond a PoC, you'll want to decide where the risks to a production system are. How many moving parts and widgets are there? What if something goes wrong? Will you be able to understand the interactions? Is support available for the platform? Are the libraries actively maintained and are the issues on their support list long, solvable, etc.?

The challenge of using a document oriented database like MongoDb or CouchDb will be technology transfer if you decide on an alternate database platform later. If you need to adjust, consider how intertwined your business logic and database code is with the various frameworks you've used. It's the same problem if you start RDBMS, and try switching to a Document database. Converting a data model between the two can be very complex regardless of the starting point.

For a PoC you're going to throw away, use what gets things done quickly. If it's more, then you'll need to consider how it fits.

Eve has a small issues list, is updated frequently, and has good documentation. The ultimate decision is up to you.

다른 팁

[Disclaimer: I am the project author.]

One distinct Eve advantage is that you get a lot of features that just work out of the box, which I believe makes it ideal for quick prototyping and PoCs. You can be up and running real quick, and change your API schema/behaviour in a minute by simply updating settings.py (if you run the app in debug mode it will restart at every save). You don't even have to create the database as it will be created for you if it is missing.

Actually we have a Heroku instance that does just that, and we cannibalize it all the time by adding new endpoints and document fields as needed using a free MongoHQ instance (or MongoLab, not sure at the moment) as a disposable datastore (just clean the db as needed but most of the time we don't even need to do that thanks to mongo's schemaless design.)

It goes without saying, don't run your app in debug mode or let it create the database for you if you're going to use it in production ;-)

PS: for the record, the whole reason why Eve was built in the first place, was to serve as a web service for our iOS/Android applications.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top