From the desktop to the Web - to create a domain model

       Wuhan God Bless, God Bless China. The make great sacrifices for the National People's Wuhan people are strong and play the role of.

  One side effect of this self-segregation during the epidemic was the first to enjoy this long holiday, had wanted to learn about Web technologies, but the only one computer at home is occupied, stopped only a last resort, to continue to look at the domain model open source projects.

  Mixing plant production management is based on short-term business plan for the expansion of the core, daily production scheduling staff to develop a "daily plan" created according to the needs for the site. Laboratory personnel will create a production recipe for the day program. Production is not continuous daily schedule, he will be broken down into many small batches program. The reason is because the decomposition of batch programs to deliver concrete there are many steps, first produced by mixing station, then transported to the site by the mixer, and finally to the location specified by the pouring of the concrete pump truck. According to this production process, we can easily design the original version of the model

  Then the actual production process, for some special cases, the batch program will add some additional actions, a common, everyday first batch will produce an additional mortar (used to lubricate the pump delivery tube), If this is the site for the first time opening, but also print quality books. Such programs should be increased before the batch objects a batch program reported to include these additional actions.

  If you carefully analyze the above objects, whether additional action or production planning or delivery of action, they can be executed or give up, you need to track the results of the implementation of the action essentially is a target that can be executed. And may be performed depending on the result of the action (e.g., because of the problem of vehicles, not to the site of concrete) or some compensation may initiate subsequent actions. Here again we can introduce the operating mode (Martin Fowler analysis mode).

   In action mode, we can adopt the proposed action and the difference is more convenient to perform an action tracking operation and implementation of the proposal, such as site plans to send 8 square concrete and concrete because of quality problems are returned.

  Whether the result of actions performed successfully, the easiest way is to use a standard property. This is the way of the drawbacks is that too simple, that we can only record whether the action fails, the cause of failure can not be recorded. Site to the site of a number of indicators such as concrete failure caused by return. A better approach here is to use the observation mode, you can observe and record the inspection records of concrete indicators. And be judged by whether the result of the observation of the operation was successful. This can provide a more flexible determination logic result.

   After the introduction of the mode of operation, we can use the type of program to realize the operation of the arrangement and dependence, an operation program is essentially a sequential polymerization (Martin Fowler analysis mode).

  Here we plan and daily plan batch can be used as a subtype of the plan, but need a method for increasing the allocation in the daily plan batch program type, the property while increasing production in the superclass inside the program. In the method of assigning batch programs in general need to develop the vehicle, so that you can determine the production batch according to the transport capacity of the vehicle. In some special cases, it may not specify a vehicle, which is expected to produce a minimum yield on transport capacity by convoy for all vehicles party set batch volume. In some software, similar problems will be placed in the dictionary, this is not a good way, mixed with a large number of dictionary field logical data dictionary itself is a concept difficult to understand the cause, although he can be very simple solution many problems. The minimum transport capacity should be provided by service domain model objects. However, our system contains no logical vehicle management of all vehicles assigned functions ready to acquire from the vehicle management service interface. Even so, we are prepared to use the strategy pattern, to support management areas using the built-in vehicle models.

  Another problem with the plan is resource consumption. Resources Our concern mainly the production of concrete pump truck consumption of raw materials, production of concrete mixing station, transported and pumped mixer. Where the concrete mixing plant as a resource is another priority area occupied by the model, not as a mixer and pump core object of our attention, mixer provided by other service management, resource management truck as little value for the system. So that we can use a more simplified resource allocation model.

   In the resource allocation model, the core is scheduled resource allocation for the proposed action, and the implementation of the action is the actual resources consumed, so that we can accurately count the actual consumption of materials, complete with the production operation and delivery actions case, you can not completely accurate to deliver successful production volume and consumption side accurate statistics.

  Preliminary evolution is described above concrete mixing plant production planning model, which borrows heavily from Martin Fowler analysis mode. Of course, this preliminary model of knowledge, there are many unreasonable waiting for us to reconstruct.

  After using the domain model, each process will be designed to process and execute a large number of domain objects, this will call the UI layer tremendous difficulties, and when UI layer design to a large number of domain objects, domain knowledge will inevitably bring the leak, do this, we'll add an application layer to encapsulate the call to the domain model while providing a simple interface. Now it requires human interaction software more and more, in this regard, facade objects (Facade) may be closely related by page implementation. Use storage domain model is a huge challenge for the data, but fortunately there are many proven solutions to help us achieve even technical framework objects to database mapping.

Published 132 original articles · won praise 15 · views 10000 +

Guess you like

Origin blog.csdn.net/ling_76539446/article/details/104184643