Is it a good idea to develop a website that has little access to database?
-
Most of CRUD operation will be done by calling API provided by separate internal backend system. I'm going to start developing an application in near future. This application consists of : Back-end system. This system provides API to be used by client. This system connects to data store and 3rd party API. Data Store : Can be relational or nosql data store. Client : Client will be a website and mobile applications. My reasons are below : I want to prevent duplicated SQL query and 3rd party API call in website application side. The application and website will be developed by different developers. I want that only back end system developers that can make query or call 3rd party API. All website developers should only use API provided by back-end system In my opinion, the website is also a client just like the mobile application. If the mobile apps get their data from back-end system API, why the website shouldn't be the same. I heard twitter is using similar idea (I can be wrong though). Its website is using twitter API just like their mobile application. My primary concern to this architecture is that the website performance will be lower compared than If the website can make query or 3rd party API call directly. What is your opinion, Is there any other pros and cons that I should think about ?
-
Answer:
The short answer is - yes in the general case, but it depends on your situation. What you are describing (but not necessarily exact the same) is basically multi-tier systems, which pretty much all large scale software are. The ever-popular term is basically the backend API you are describing, and I've lost count how many sites provide web services. is the term in-vogue today. For large scale systems it's really handy, because it effectively allows a large system to be decoupled into multiple subsystems, and you can organize teams to work on them separately and independently. The only thing teams rely on is the externally published API by each services. Jeff Bezos famously decreed Amazon to follow SOA religiously and that formed the basis of the most popular cloud platform of today. Besides having the effect to decouple the subsystems so they can evolve independently, SOA also comes with a potential (not automatic; must be designed right) benefit of system scalability. If the design is done right - you can scale the amount of workload the system by just adding more hardware to the appropriate services. The decoupling (and communicate via interface) will ensure that you have to validate input, which is one of the most effective way to prevent security attacks like SQL injection. This however is also not automatic and must be designed appropriately. SOA comes with a lot of benefits, and in many ways would be how a sound system will evolve into as it gains size. But it is not without drawbacks - you'll have to weigh against the benefits for your particular situation. Complexity - with all the decoupling comes with a lot of complexity, and it might not make sense to pay for all the complexity upfront in early version of the system, since you are likely to realize the benefit only when the system becomes large. Difficulty - with complexity it also adds difficulty to your teams, as your teams might not necessarily have the experience to design appropriate APIs yet. Performance - software design is all about tradeoffs, as you gain in certain dimensions you lose in others, and adding more execution steps in between point A and point B can only slow it down, but there are other tricks to improve performances again for other tradeoffs. In general, it's easiest to adapt a gradual approach - start small and simple, and gradually evolve your system toward service-orientation. But you know your goals and situations the best, and now you know the pros and cons as well for coming up with your plan.
Yinso Chen at Quora Visit the source
Other answers
It will be as slow as molasses in February and won't make it more secure. Unless there is a concrete reason for doing so, you will never get benefits from increasing your pipeline length. Every step in your pipeline length has a latency cost of approximately 1 to 10 milliseconds. This results in a huge design restriction in terms of speed and flexibility. So the key question is why? I could see something resulting from a very specific set of infrastructure requirements but outside a very narrow set of circumstances, I cannot easily see a benefit.
Siobhan Green
Over the years I have worked on a huge number of web applications with many different architectures. Fashions in software architecture come and go in cycles, just like anything else, and we all have a tendency to reach for the tools we know as the solution for any problem. My analysis of your problem, given the information you have provided, is that you want to reduce the possibility of duplicate logic while decoupling your system components. Both of these are sound architectural principles that should bear fruit with improved reliability and maintainability over the lifecycle of your application. The decision you need to make is the decoupling point. There is a practical difference between decoupling and remoting. Firstly, it is not necessary to have a remote interface in order to have a common API that decouples business logic from client applications. Secondly, the cost of remoting is latency and latency kills performance (if we are looking at performance from the point of view of the end user). Each remoted operation takes at least an order of magnitude longer to dispatch than a local operation How visible are the effects of latency introduced by multiple remote requests? Actually this can be easily demonstrated without introducing any application logic. In my framework Fakoli (http://www.fakoli.org/) we typically need to serve somewhere of the order of 100 javascript and CSS files to the browser when we first deliver a web page. Fakoli can put individual script and link tags into the HTML sent to the client, whereby the browser has to make 100 or so requests back to the server, or we can use an optimization feature that combines files of the same type together into larger files. The effect of the optimizer is significant - a non-optimized page can take around 10 seconds to load from scratch, whereas the optimized version can load from scratch in less than a second. Network latency is a cost that consistently gets underestimated. It was the Achilles heel in Enterprise Java Beans, and it is the reason that we see so many spinners as modern websites load themselves up a piece at a time via AJAX requests. I have seen many EJB applications that tried to get around the remoting performance bottleneck by building 'fat' interfaces to return all the information in one big gulp, which leads to a degenerate data model and potentially a lot of unneeded data being passed across the network. All this is not to say that remote requests are inherently bad - just that the cost of using them needs to be considered if you are concerned about performance. I believe one of the key insights here is that while your web-site is conceptuallya client of your business logic, it is of necessity going to be running on a web-server, will be accessed via HTTP/HTTPS, and serves text back to the client as a result of requests. Therefore it has all the attributes it needs to also be your API server. The approach I would usually use in this case would be to build a common API as a library or component, and then have that library expose a RESTful API for remote access to the business logic by clients other than web browsers. Other concerns I have heard include "our front end developers only know JS/CSS/HTML5 and our backend developers only work in .NET/Java/whathaveyou so we need a way for them to communicate" or even worse "our backend developers don't DO front end design. That is for the designers". While these are legitimate issues to confront in your development team, these are not architectural issues, but rather political ones.
Andrew Green
Related Q & A:
- Is it a good idea to extract two million barrels of kerogen a day from the Green River Formation in Colorado?Best solution by Yahoo! Answers
- Is it a good idea to buy a house with your partner before you get married?Best solution by Yahoo! Answers
- Is this a good idea for a non-profit organization?Best solution by Yahoo! Answers
- What is a good advertising program for a website?Best solution by Yahoo! Answers
- What is a good idea for a board game?Best solution by smosh.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.