Thread: Read + Write = ?

  1. #16
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Angola
    Posts
    8,445
    I honestly can't see the problem with "Serialize", or "RW" or "IO".
    Why the OP is choosing "Literate" can only mean one of two things:

    1. They have no idea what they are doing and didn't get the joke
    2. It just so happens they are serializing the alphabet or dictionary terms. Which is still not a good idea.

    In any case, referring back to post #7 (and assuming I understood the requirements):
    ObjectLiterator (for both ObjectWriter and ObjectReader),
    LiteratorDispatcher (ReaderDispatcher and WriterDispatcher), Literator (Reader and Writer) and LiteratingMapper (WritingMapper and ReadingMapper) seems just right.
    Are you really, really, really sure you want to do this?
    Odds are you will want to eventually break the two actions apart. It will probably become inevitable as soon as you start adding to your serialization framework. Instead of simplifying ahead of time, I suggest you perhaps leave read and write operations separated. 1) Because they are indeed different actions even if they share code, 2) Because almost certainly they will stop sharing code sometime in the near future and 3) because users of your framework expect different calls for different actions.

    There's also such a thing as premature simplification. I suggest you do not fall for it.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  2. #17
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008
    Location
    Indonesia
    Posts
    489
    Unfortunately, they are easy to be separated into two methods or even two classes.

    Btw I didn't get the joke since in my native language dictionary "literate" means both reading and writing activity.

    Forgive me for my stupidness.

    Uhm..
    Just GET it OFF out my mind!!

  3. #18
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Angola
    Posts
    8,445
    Hehe, in about any language it should mean read and write. That's precisely the beauty of the joke.
    But for matters of human literacy, not for computer reading and saving of data.
    Last edited by Mario F.; 01-20-2010 at 04:41 AM.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  4. #19
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by Mario F. View Post
    But for matters of human literacy, not for computer reading and saving of data.
    Ixnay. You are just making up that first clause, as if there were traditionally some other possible use for the word -- ie, it certainly doesn't say in my (or ANY) dictionary: this word literate applies only to human endeavour.* Audinue's use of it is just hunky dory IMO.

    But I think I see Mario's joke. The word "literate" (lit-er-it) is a noun (or adjective) in English and refers to someone who can read or write. However, we also have a verb, transliterate, which means "to write a word in the characters of another alphabet". Serialization is not that, that would be more a data2txt activity.

    You could drop the "trans", tho, and use "literate" (lit-er-ate) as a verb to mean "copy". It's also almost "iterate" which could mean, in this sense with the "l" , to read back.

    So I totally like the word here.

    * it may say "person" but if you taught an ape to read you would call it a literate ape. So really it applies to beings or just things, in so far are that makes sense, which it does WRT a "lit-er-it" computer process that "lit-er-ates".
    Last edited by MK27; 01-20-2010 at 06:51 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  5. #20
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,398
    MK27, your mention of the word "transliterate" made me think of a term that might be appropriate: transduce. It means "to convert from one form to another form," which is perfectly apt for both serialization and deserialization.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  6. #21
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by brewbuck View Post
    MK27, your mention of the word "transliterate" made me think of a term that might be appropriate: transduce. It means "to convert from one form to another form," which is perfectly apt for both serialization and deserialization.
    But serialization does not involve any form of conversion, which is why I said the "trans" prefix in inappropriate. Serialization is a literal, one to one, exact duplication of data.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  7. #22
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008
    Location
    Indonesia
    Posts
    489

    Red face

    Quote Originally Posted by MK27 View Post
    But serialization does not involve any form of conversion, ...
    Serialization has two abstraction layers at least.

    1. Structure Definition
    2. Data Mapping

    The first layer defines the object structure.

    The second layer maps/converts memory representation of data into a specific format, for instance Binary format, XML format and URL format (they are supported in my library ).

    Serialization is yet another data conversion I think and yes, it involves conversion.
    Just GET it OFF out my mind!!

  8. #23
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by audinue View Post
    Serialization has two abstraction layers at least.
    Okay. I did not realize the term "serialization" could be applied to, eg, saving data in an XML (text) format.*

    I was under the impression that serialize meant to write a segment of memory, such as a struct, directly to a ("binary") file, so there is no kind of translation or conversion. For example, if you have a 144 byte struct, writing 3 of them to a file would create a 432 byte file. This does not involve any transformation.

    *handy function tho
    Last edited by MK27; 01-22-2010 at 10:41 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  9. #24
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    this thread really needs to be move to a more appropriate channel, like tech.

  10. #25
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Angola
    Posts
    8,445
    When speaking of the serialization process in general it never occurred to me (and I can't recall anyone else doing it either) to specify both the tasks of serializing and deserializing, unless there is a real necessity to do so. The latter is just implicit in the more general term we known as Serialization and that we use in common language.

    So, were I to have a need to merge both read and write operations for the purposes of serialization and deserialization, I wouldn't think twice calling it Serialize or some form of it. Searching for some other word seems to me confusing, not to the point and a unnecessary exercise. IO and or ReadWrite seems convenient too, especially if the merged functions referred to the strict actions of reading and writting data to a medium. But Transduce? Literate?... Exchange? Really, enough joking.

    As for mapping, MK27 is correct in my option. There's not requirement for serialization to perform any sort of data transformations. For all purposes, one can serialize an object by simply writing its current memory representation byte by byte. If there's any data mapping occurring, it will be a decision of the programmer usually to store it in a more convenient format for quick retrieval later or to be accessible by other programs. But definitely not anything deemed necessary to perform the task of serializing an object.
    Last edited by Mario F.; 01-22-2010 at 11:24 AM.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  11. #26
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008
    Location
    Indonesia
    Posts
    489
    Quote Originally Posted by Mario F. View Post
    As for mapping, MK27 is correct in my option. There's not requirement for serialization to perform any sort of data transformations. For all purposes, one can serialize an object by simply writing its current memory representation byte by byte. If there's any data mapping occurring, it will be a decision of the programmer usually to store it in a more convenient format for quick retrieval later or to be accessible by other programs. But definitely not anything deemed necessary to perform the task of serializing an object.
    Tell me how do you map trees and graphs byte by byte? Especially the circular one.
    Just GET it OFF out my mind!!

  12. #27
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Angola
    Posts
    8,445
    Quote Originally Posted by audinue View Post
    Tell me how do you map trees and graphs byte by byte? Especially the circular one.
    Tell me how you may an int.

    Do you have a problem reading, or don't you really understand the meaning of the words "It's not a requirement"?
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Read write problem
    By zephon in forum C Programming
    Replies: 3
    Last Post: 01-13-2009, 04:04 AM
  2. Read and write binary file?
    By Loic in forum C++ Programming
    Replies: 2
    Last Post: 10-29-2008, 05:31 PM
  3. using threads to write & read from files
    By kishorepalle in forum C Programming
    Replies: 4
    Last Post: 10-19-2004, 05:19 PM
  4. write(), read()
    By RedRum in forum C++ Programming
    Replies: 5
    Last Post: 06-09-2002, 11:45 AM
  5. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 06:05 PM