Technology stack problem
I am trying to build a a social networking website (like Facebook pretty much), but I am very new in IT world. I want to keep the front end and the back end as two separate layers and any communication between them should be AJAX-driven. How do I do that? In other words, if keeping开发者_JAVA技巧 those 2 layers separate (front end and back end) how do I establish communication using jQuery like how the technology stack should be?
I am familliar with HTML, javascript, CSS, jQuery, Struts, Spring, Hibernate. How do I integrate these technologies to accomplish the task (think of a site like Facebook)? Or any different/better opinion from mine will be appreciated.
Your question seems to be a general query about how to get started with Web application development. The front- and backends are usually kept fairly separate by default, due to the preeminence of JavaScript in the browser and the much larger ecosystem of back-end languages. One exception is the Google Web Toolkit which translates Java to JavaScript for the client.
Your choices for the backend are incredibly varied. If you or your team have a choice of programming language, that will help narrow it down. Personally, I prefer Python for its expressiveness, "batteries included" features and the ease with which it can be read after it is written. For Web development frameworks on top of Python, Django has a very clean and powerful design and excellent documentation. Ruby (Rails), Java, .NET also provide a wide variety of Web development frameworks that you could get started with. The usual paradigm in this field is "Model/View/Controller" (or Model/View/Template) which basically means that the business logic, persistence/database implementation and presentation logic are kept separate from one another. Which ever framework you pick, work through the basic tutorials first and then take a look at more specialized Ajax examples.
On the client/browser site you mentioned JQuery, which is a good place to start and which has support for Ajax calls back to the browser in a variety of flavors. It also uses a selector notation very similar to CSS, which helps make it easier to learn to use.
You say "any communication between them should be Ajax-driven," but you will always need a normal HTTP request to load your initial content and stylesheets and to deliver whatever JavaScript will drive the subsequent Ajax calls. You will probably want to prototype things in a non-Ajax way and then add the complexity of the more interactive/asynchronous behavior once you understand your backend implementation. You can waste a lot of time making the user interface beautiful and responsive, only to throw that work away if you have to make big changes on the back end.
Have fun -- Web applications are good fun, in part because it's so easy to get feedback from users quickly. The biggest drag is that the technologies are not particularly unified, so there is a lot to learn -- though JavaScript libraries such as JQuery, as well as the backend Web development frameworks can really help in this regard.
精彩评论