Click here to Skip to main content
14,544,882 members

Design and Architecture

 
QuestionMessage Closed Pin
29-May-20 22:50
Membervitobrep94829-May-20 22:50 
QuestionMessage Closed Pin
29-May-20 0:07
Membervirmaxrynu8929-May-20 0:07 
QuestionMessage Closed Pin
28-May-20 18:15
Memberkanavanc95928-May-20 18:15 
QuestionMessage Closed Pin
27-May-20 23:40
Memberandroscf6727-May-20 23:40 
QuestionMessage Closed Pin
27-May-20 19:38
Memberbrilliafa5927-May-20 19:38 
Questiondesigning programs Pin
404byter27-May-20 6:05
Member404byter27-May-20 6:05 
QuestionMessage Closed Pin
27-May-20 0:52
Membertotalrx45627-May-20 0:52 
QuestionMessage Closed Pin
25-May-20 20:37
Memberkanavanceu8925-May-20 20:37 
QuestionMessage Closed Pin
24-May-20 0:56
Memberandroscfr5624-May-20 0:56 
QuestionMessage Closed Pin
23-May-20 22:05
Memberbreathga5623-May-20 22:05 
QuestionMessage Closed Pin
21-May-20 17:48
Memberexplorre4521-May-20 17:48 
QuestionMessage Closed Pin
20-May-20 21:31
Membergreencrp9720-May-20 21:31 
QuestionMessage Closed Pin
20-May-20 17:07
Memberglucofra4920-May-20 17:07 
QuestionMaking data notation extending another language Pin
nedzadarek18-May-20 10:40
Membernedzadarek18-May-20 10:40 
GeneralRe: Making data notation extending another language Pin
Richard MacCutchan18-May-20 21:19
mveRichard MacCutchan18-May-20 21:19 
GeneralRe: Making data notation extending another language Pin
Member 798912218-May-20 23:06
MemberMember 798912218-May-20 23:06 
JSON and XML and YAML and ... Isn't the whole bunch of them wheel reinventions? When everybody else are creating new wheels which are better suited for the purpose than all the old ones, why shouldn't I do the same? Smile | :)

Now I have personally come to one conclusion, in particular from many years of exposure to XML: Data description languages are for computers, not for humans. This kind of stuff you, a human, do not handle better than a computer does. You make typos, you do not structure it according to the rules, in brief: You mess it up. So keep humans out of it!

The best way of doing that is to make it unreadable. Binary. I know that is a highly Politically Uncorrect statement; yet I think that what humans should not mess up, should not be made available for messing up - especially not with as simple tool as a plain text editor. You can also mess up by using a binary generator (/editor), but that takes a lot more deliberate action. The mess comes from "You asked for it, you got it" - not from "Ooooops!"

So when I need to store data for my own applications (and there are no requirements for sharing the data files with other applications), I do it as binary files. Always in a Tag-Length-Value format, evading all sorts of escape mechanisms. No need to search for the end of the field. Arbitrary binary data. Space allocation for the value can be made before it is actually read. Parsing the file is extremely fast. The space overhead is quite moderate.

Details of how you do the TLV format may vary slightly. E.g. in some applications, there will never be more than a couple hundred distinct tags, so it is stored in 15 bits; the "sign bit" is a flag indicating that the Value is in fact a sequence of TLV values. If values are small, the length is 16 bits, too. If there is any risk at all of overflow, I use the BER style of variable length handling: The length of the enclosing TLV is 0, each member carries its own length; the member sequence is terminated by and all zero TLV. (Then you cannot preallocate space for the entire structure without reading it, but usually a composite value won't be stored as a single unit anyway.)

Like all class definitions have a ToString, they have a ToTLV. And a FromTLV. The "Schema" is represented by these ToTLV funcitons. If any other application needs data in, other formats, adding ToXML, ToJSON, ToYAML, ... alongside with ToString and ToTLV is straigtforward. But for the application's private file, the binary ToTLV is used.
GeneralRe: Making data notation extending another language Pin
Greg Utas19-May-20 0:41
professionalGreg Utas19-May-20 0:41 
GeneralRe: Making data notation extending another language Pin
Member 798912219-May-20 2:32
MemberMember 798912219-May-20 2:32 
GeneralRe: Making data notation extending another language Pin
Eddy Vluggen19-May-20 2:43
professionalEddy Vluggen19-May-20 2:43 
GeneralRe: Making data notation extending another language Pin
Member 798912219-May-20 3:44
MemberMember 798912219-May-20 3:44 
GeneralRe: Making data notation extending another language Pin
Eddy Vluggen19-May-20 4:00
professionalEddy Vluggen19-May-20 4:00 
GeneralRe: Making data notation extending another language Pin
Eddy Vluggen19-May-20 2:38
professionalEddy Vluggen19-May-20 2:38 
GeneralRe: Making data notation extending another language Pin
Member 798912219-May-20 4:36
MemberMember 798912219-May-20 4:36 
GeneralRe: Making data notation extending another language Pin
Eddy Vluggen19-May-20 7:12
professionalEddy Vluggen19-May-20 7:12 
GeneralRe: Making data notation extending another language Pin
Member 798912219-May-20 8:44
MemberMember 798912219-May-20 8:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.