Registriert seit: 20. Mai 2010
1.444 Beiträge
Delphi 11 Alexandria
|
AW: Eure besten Quellcode Kommentare...
5. Jul 2018, 13:38
Heute darübergestolpert (ßßß von mir ersetzt)
Delphi-Quellcode:
unit ßßß;
{******************************************************************************
PROJECT : ßßß
SUBPROJECT : ßßß
.............................................................................
DESCRIPTION:
Contains DTOs (Data Transfer Objects) for carriage manager testautomation services. All DTOs
contain are fields of data - there is no logic implemented in here. I did my best
to prevent 'mistakes' of this sort, but please please do not implement logic in the
DTOs.
---- WARNING ---- WARNING ---- WARNING ---- WARNING ---- WARNING ---- WARNING ---- WARNING ---- WARNING ----
*************************************************************************************************************
* If you want to use the Embarcadero JSON classes, there is one braindead implementation *
* detail you NEED to know about, before implementing your classes. They absolutely require *
* your fields to be in the form: *
* *
* FSomeField : String; *
* property SomeField : String read FSomeField write FSomeFields; *
* *
* The reason for this is that they hardcoded add a 'F' character to the field names coming in from *
* JSON. So if the JSON code says the field's name is 'foobar', they change that to 'Ffoobar', without *
* any checks, without any choice, without any error message if (when) that braindead hack kills inter- *
* operability. Anything not in that form (for example a member variable called m_something) will NOT *
* be reconstituted back into the object, even though the parser DOES find the field in the JSON code, *
* since THAT TOO WILL BE RENAMED to Fm_something! They do NOT check whether a field is a property before *
* messing up the name! Furthermore, subsequent calls of serialization / deserializatoin lead to field *
* names like FFFFFMyField. So please, just follow embarcadero's religion about how field names gotta *
* look. *
* *
* This is literally the worst JSON implementation I've ever seen and shows the complete lack of skill of *
* embarcadero's 'engineers'. -- ßßß *
* *
*************************************************************************************************************
If you want to see where that hack is located, it's in the unit REST.JsonReflect, the function
TJSONUnMarshal.ConvertFieldNameFromJson starting at line 2446 ff.
}
interface
|
|
Zitat
|