Linguistics and design of objects

zhaozj2021-02-16  50

Originally intended to use the title of this article to face the design of the object, but the grammar analysis written here is easy to make people (especially programmers) thinking about the grammar of programming languages, not what I am here. Say the grammar in the language used in our daily lives (but for convenience, I still use syntax analysis as the name of this face-to-object design method).

Perhaps the use of syntax analysis is not a new concept, but in the process of collecting information, only some of the information on this method is discovered in the teaching website of Zhejiang University, and this is still I plan to write this small text. So at least for my beginners, this method is a way to be mentioned.

Here I don't want to write from a system development, such a result will only lead to me to deviate from the subject, so the following premise is that we have basic knowledge about the system we have to develop, and the operation of this system Learn more detailed. This way, our next step should be a use case analysis (at least I think it is like this). For an angle, the object-oriented design should be based on the use case analysis. There are also many ways to use cases, and there are many modes that have been found and used in use, while there is a variety of benefits, but our object-oriented approach uses a simple use case. Expression - Speaking of the storytelings, that is, directly using the natural language to use cases, this use case expression method has no normative defects relative to various modes, but in order not to enter explanations The misunderstanding we will use this method.

Ok, now we do an analysis expression for an example in a specific system, and use the preceding grammatical analysis method for object-oriented design based on this to use the exemption. The following use case is one of the use cases I am in the hotel management system (I also involving this system is a method of association).

Reservation Room (with example name): A customer tells the hotel service person (customer) needs to book a room. Customers tell the hotel service personnel to schedule information (standard, check-in time and day number should include check-in, the hotel service staff) from the scheduled information In the room information, there is a room that meets the scheduled information, and the hotel service person tells whether the customer is scheduled to success, if the successful store service person records the scheduled information.

If the reader looks back to read me in the hotel management system, I found that the description here is not exactly the same, but the same problem they express, it also achieves the same purpose, because one People have different levels of stories in different phases. We don't pay attention to these details and start our grammar analysis.

Before formal analysis, let's take a look at our system. Because our system is a system that does not support online booking, that is, the customer only reaches the book by the hotel service, so the first sentence "a customer tells the hotel service. When he (customer) needs to book a room "is the beginning of this problem. The second sentence" customer tells the hotel service personnel to schedule information (standard, check-in time and number of days should include check-in, etc.) "is just telling usage The source of the person is scheduled to have no relationship with our system, so the following analysis is excluded.

In this case, we will find that in the above cases, we only have one subject is also the hotel service personnel, we define this subject into a class. Next, we see that the hotel service staff only in this case, only two acts (telling this behavior related to customers, and customers do not consider, this behavior is active in the system), so we will Two ways of these two as a class of the hotel are. Then we see these two behaviors involve other things, including predetermined information (conditional, logging content), room information (in query there), "There is a room that meets the predetermined information" is a query result, We can use a Boolean type to represent. At the same time, what should be noted, if the predetermined information and the room information are simple enough, we can use the simple type in the program language, not to create a class for them, of course, if there is a room that meets the predetermined information, it is complex, Need to be defined as a class. This way we have achieved abstraction of the class to be used in the system in the use case. In this abstract process, we can also list all the nouns in the usage, and then analyze if it can be used as a method used by the object, and it will not be detailed here.

Copyright: IDILENT website reproduced please indicate the author's other reprint, please contact the author (iDilent@yahoo.com.cn).

转载请注明原文地址:https://www.9cbs.com/read-24368.html

New Post(0)