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 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 matlab有关常微分方程的问题求解决
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法