douchan4674 2012-05-20 19:16
浏览 61
已采纳

基于Java客户端/服务器设置的后端使用的最佳架构是什么?

I'm fairly new to programming and have been focussing a great deal on Java in recent months. I would like to write an application with a Java applet front end which will capture information about my users and allow for them to be organised for sporting events. This seems to lend itself very nicely to the object orientated approach (e.g. each user is an object, each event is an object, each coach is an object, etc.).

However, my users will all need to access and make changes to the data stored as objects. A database of some sort seems to be called for but I only really have experience with RDBMS and I can't see how that maps to an object based front end. I could just use PHP driven HTTP calls but that would mean translating objects into tables and that feels like a move away from a pure OO approach - and I'm really trying hard not to slip into a procedural way of thinking, which is more my background.

I'm vaguely aware of JSON and NOSQL databases but not enough to know whether they are the solution to my problem. So, given all of this, I would really appreciate any views on the best way to keep things OO whilst at the same time having a client/server model allowing shared access to the application's data. I'm sure there's an easy solution - I'm just struggling to find it!

Any tips/thoughts?

  • 写回答

2条回答 默认 最新

  • dongren2128 2012-05-20 20:03
    关注

    First of all, you seem to be thinking that OO and RDBMS' can't be a good match. They can be a good match IF you setup your schemas correctly. There's far to little info to go on here, but often a single java-class to a single db-table can be a good start. That's the java to RDBMS part.

    Communicating from your application-server to the client has nothing to do with this part (I'm saying because you seem to be suggesting it has?)

    Having said that, NOSQL can be a good approach for having less restrictive schema's and (you're right here) often map more intuitively to objects as you would envision them in a oo-world. As for suggestions, I'm using MongoDB and it's great .. Also at this point JSON comes around the corner as the data-format to communicate with MongoDB.

    All these technologies can be rather overwhelming if you're starting out, so instead of me advising you to pick A or B, perhaps it's better to checkout some good java web-frameworks that abstract away from persistence implementations so you can swap them out later without much problems? (Say Mysql for MongoDB, etc. )

    I can highly recommend the Play Framework (http://www.playframework.org/) which gets you going pretty quickly and intuitively. Follow along the examples (they bolg a blog step by step including persistence, etc. ) and you get introduced nicely to the concepts.

    Perhaps later you can check out plugins to use MongoDb instead of 1 of the default RDBMS's that come with Pplay, to see what you prefer.

    Hth, Geert-Jan

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建