When to use the web framework?

we need to code the online log management system in Java. This is not Amazon, but more than Hello World.

Should we use a framework? If so, why? What good Java frameworks are simple there?

+4
source share
5 answers

Yes.

The web infrastructure should be used for all applications that are more complex than "Hello, World!" No need to reinvent the wheel. Web structures contain many useful tested components that you will almost certainly need on your site. They also help organize your code, often in MVC or a similar paradigm, which will make your code more convenient.

Some Java web platforms (in a specific order):

+6
source

Start developing without any frameworks, and you will certainly notice yourself if you need it or not. If more than half of your code is the infrastructure for your web components, this may be the key to choosing a structure rather than developing it yourself.

As a best example, use System.out.println() for logging, improve it with some specialized package that also provides features such as writing to a file and then adding formatting to the message log, and when you realize that you spent half a year to develop your own poor home version of log4j (or something else), someone will complain and say that you had to choose a logging system from the very beginning and spend one or two weeks to learn how to use it.

Don't get me wrong, sometimes just wrappers of System.out.println() are enough, and the framework only adds overhead. Unfortunately, this scenario is rare these days ...

EDIT: I (or used to be) the developer of the anti-framework in the kernel, so I learned all of the above “hard way”.

For web frame suggestion: Apache Wicket

+1
source

You should use the framework when you want to create something real and spend most of your time solving this problem, and not on the so-called basic technology (for example, existence, templates, infrastructure, etc.).

A good environment that provides tons of integration with other frames, Spring Framework .

0
source

A simple web structure is a gaming environment. Look at the screen on the playframework.org homepage. I am sure you will be convinced.

0
source

As @cherouvim noted, it is worth using a framework if you expect the need for “commodity technologies” such as storage, templating, routing, etc. That is, if you think that your site will require non-trivial use of a database or complex layouts and views (which are almost always present in a web application).

Abandon Grails based on the Spring framework, but it’s much easier to learn, manage and use, in my opinion. In addition, this is comparable to Ruby on Rails, which is considered another popular web application framework.

0
source

Source: https://habr.com/ru/post/1347625/


All Articles