[A] face questions --20200125Java software development engineers face questions resolved

1. Talk about your understanding of the factory pattern

The factory pattern is a design pattern we often used to build an object, it uses the new factory methods alternative way to build the object.

What 2. MVC design pattern is that it has what advantages and disadvantages?

MVC design pattern is a separate Web application construction method, which we will advocate the application is divided into three layers: Model (model), View (view), Controller (Controller).

  • Model model: by its very nature he is a JavaBean (entity type, service type, etc.).
  • View view: View provides interactive user interface, which returns the corresponding content rendering view request, it substantially jsp, html.
  • Controller The controller: for processing a request, and may return the corresponding content according to the view request, which is essentially a Servlet.

advantage:

  • Their duties between various components, without disturbing each other.
  • MVC design pattern in favor of the division of labor in development.
  • Reusability of the various components of the MVC increase.

Disadvantages:

  • Complex system structure to achieve more cumbersome.
  • Code coupling between the view and the controller is relatively high, too close.
  • MVC design pattern is not particularly suitable for small and even medium-sized applications.

3. cookie usage scenarios What?

  1. Implement tracking for a specific object, such as visits from people who, last access time, access paths.
  2. It can be used to browse the records of the page.
  3. Some users may be used to store information.
  4. You can achieve some personalized custom service.

4. Please talk about the Servlet life cycle.

Servlet life cycle is divided into load, instantiate, initialize, service and destroy five stages, when the program runs Servlet will be loading up when the server receives a request, the program began to instantiate the Servlet, and call the Servlet init () method initializes, when a request arrives Servlet starts processing service, when the request is complete, decide whether the application to destroy Servlet.

5. Please tell Servlet architecture model

Java Servlet architecture consists of two packages consisting of: javax.servlet and javax.servlet.http.
Five methods defined in Servlet interface, of which there are three methods represent the Servlet life cycle: init () method is used to initialize servlet, service () method is used to start the service, destory () for the destruction of servlet.

Published 60 original articles · won praise 19 · views 10000 +

Guess you like

Origin blog.csdn.net/qq_43199016/article/details/104085443