Swinger in the object between strong type and weak type

xiaoxiao2021-03-06  22

Objects are essentially a naming technology, which is about to put together a set of data and functions. From the business level, we need to identify a large number of concepts, corresponding to the established domain model, we have different business objects. The types of these business objects are different, and it can be distinguished. From the middle space, you need to abstract commonality from a large number of business objects and processed in a unified manner. That is, in the middle space layer, all the types of business objects are weakened, in fact, their own uniqueness, that is, in the middleware layer, the type of different business objects is the same. In the middle part of the method, it is generally used to use the reflection method and combined with a small amount of global interface. In fact, objects are processed as MAP on the structural level. This is like the relationship between application science and mathematics. The relationship between mathematics on abstract levels, each particular discipline gives different interpretation of the same mathematical theorem. In theory, one concept is best adaptable to different structures in different abstractions, but is limited to the current object-oriented implementation technology, most technical routes are mostly used for establishing a unique strong type model ==> Get a weak type of structure via reflection. Because the Java Class is limited as the amount of information that the metadata can carry, the Reflection method may not fully reveal the structure of the object, so it is generally added to additional XML documentation. Because my personal work is done in the middle part, my approach is to use abstract data structures such as MAP and LIST, combined with metadata objects, and convert to strong types through object packages when needed. Type from weak type ==>. For example: Class Work {public static final string key_name = "name"; public static final string key_description = "description";

Map work;

Public string getName () {return (string) Work.get (key_name);

Public string getdescription () {return (string) Work.get (key_description);}

Public void setname (String name) {work.put (key_name, name);} ...

Public Map Tomap () {Return Work;}}

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

New Post(0)