Java beginner web-development toolkit/environment

后端 未结 6 1771
时光取名叫无心
时光取名叫无心 2021-01-31 12:23

I have been tasked to develop an interactive website using java & mysql: using servlets to retrieve & massage data, applets to do special handling of the data client-sid

6条回答
  •  执笔经年
    2021-01-31 13:04

    First paragraph edited by request of slashmais : This answer is not really aligned with others, and the rephrased question. It's more of a complement to other answers. I believe the personal preferences are really important in choosing between technologies. I see it as (dis)liking some things, and choosing the technologies that correspond. The rest of the answer gives examples:


    For example, suppose I believe the developer's actions should be checked in real-time as much as possible, to receive immediate feedback, and also completion if possible, and avoid early so many errors. This (dis)liking determines some preferences:

    • use a statically type language (like java)
    • use an IDE that compiles as you type (like Eclipse)
    • any Xml must be validated, via strict xsd. If the content have references to other information (such as java code), then it should be checked (like Spring checking for bean classes).
    • for the view technology, because it depends on my java code, I must have a verification that includes my actual java code. An idea could be to code my view in Java. (like Wicket).
    • my properties need to be in properties files for translation. But using String keys in my code (or view) is not acceptable. I would run a small tool that create java enums from each property file, and my code would reference the enums.
    • ... and so on

    Other example, suppose I strongly prefer "Convention over Configuration". That is, I agree to follow stricts rules in my project, getting much less plumbing to do manually (because default values fit):

    • Maven is the build tool of choice. It will impose many constraints, but also provide out-of-the-box many "build" features...
    • For a web application, I couldn't use Struts 1, because they are these huge configuration files in struts-config.xml, mostly with plumbing code. I would definitely switch to something like Spring MVC, that has default values for mapping urls to controllers.
    • and so on ...

    Other example, suppose I believe so much in the Model-View-Controller separation, for clarity and reuse, that I want to stretch it a bit. I could use:

    • in the view, I would cleanly separate my model (clean Html, no formatting, no script), my view (or formatting, external css only), and my controller (javascript, using the non-obstrusive javascript policy).
    • in the webapp, I could use Spring MVC to separate well those layers.
    • in the business (this example is a bit constrived :-) ), I could have a rich domain model, use extensively the command pattern ("controllers"), and expose explicitely my business services as an interface API ("view").

提交回复
热议问题