What are the advantages and disadvantages of the Properties Pattern? -


Steve Yiges described the property pattern .

For those using a static language like C # or Java, what are the advantages and disadvantages of this approach? What type of projects of property patterns do you want to use, and when do you want to save it?

I have been digging myself very recently in this method, and I tell you It is very difficult to find information about it. Yegge is called prototype or quality, but those two are very overused, and well two others, known as different patterns, some people refer to systems like The yagge offers "strictly [type] There is another way of research and research.

This is a very clear idea, and some of which have a lot of merit in some applications, and there are so many flaws in others. The benefits you get are essentially the formation of "type" on runtime. Very flexible medium, but you are doing it to strong-type tests in many languages. The easiest way to implement it will be in the form of a dictionary; String, string & gt; Then you have to use DAST to bring back your string value as the real values. The key to handling such a design, if you can avoid it, then do not take any reference directly to the code in the code. The content of the "canonical" name of that slot will kill you as the theProtoObject ["owner"] = "prototype" . It may also be on issues such as javascript (which uses this method as under this model's object model), where you misspell the key name, then you will add a new slot.

One possibly you might possibly upgrade to the production system for a specific type of values, and use any "heavy key" for the key, so that you can add additional typing on your model and Get security information.

I have seen some applications that use it, a surprising example recently hit me while looking for open source code in my industry: insurance quote to quote any common type of insurance Is a very flexible project for. It is written in Java, but if you know C # then it should be read quite well. To its very very extent, the type is an object in which this bit of code is:

A dynamic collection of properties describing the type * / Private list & lieutenant; Properties & gt; Attribute = New Arrestist & lt; Specialty & gt; (); What is

and attribute ? It:

  * A feature is defined as "one of many aspects as a subject". Generally, there will be an (composite) collection of properties of another * type that helps in describing it.  

So basically the attribute has a unique string-id (field name) and a string value in a specific key-value pair, and one type of combined In such a way, with some regex to verify and process values, it can store many types of values, and can convert them back to zoba values, while some can provide protection.

It then goes on to create many domain specific models on top of that core. So an insurance policy object can be considered as flexible, extensible list, which has the benefit on it, which can add or remove or modify the runtime.

Its use is an example of a pattern in use, and is a decent use case for this: Insurance policies can be very flexible, which is to the underwriter until the moment of sale, hence a very flexible model Works well for this.

Downsides are too much, although the outline of the baggage is quite large. Execution can be bad, especially with a simple implementation. Type-checking and security take a hit, and it's more difficult about your objects because you do not know what to look for on them.


Comments