Read + Write = ?

This is a discussion on Read + Write = ? within the General Discussions forums, part of the Community Boards category; Hi there, long time no see ! I'm very glad this forum is up again since that /tmp/ error. Btw, ...

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

    Read + Write = ?

    Hi there, long time no see !


    I'm very glad this forum is up again since that /tmp/ error.


    Btw, as usual, I come with yet another stupid problem ..

    Currently I'm writing a serialization framework for J2ME, not intended to reinvent the wheel tough, but I found the existing frameworks just rewrite everything so they bloat.

    However, when I design the solution, I found that serializing (write) and deserializing (read) shares similar flows and components.

    Instead of naming ReaderOrWriter classes and readOrWriteObject methods.. Maybe there is more apropriate name for read and write?

    Read + Write = .
    ..

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

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,467
    Quote Originally Posted by audinue View Post
    Read + Write =
    Serialize.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    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.

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,725
    LiteracyComponent
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    Quote Originally Posted by Mario F. View Post
    Serialize.
    Doesn't Serialize just imply writing (not reading)?

    For something that is read/write, I would just prepend RW to the class name. RWObject for instance.
    bit∙hub [bit-huhb] n. A source and destination for information.

  5. #5
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,467
    Well, if I wanted to combine both notions into one single function -- as it seems to be the case -- I would just use the term "serialize" in its all-encompassing meaning.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    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.

  6. #6
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    IO (because RW sounds like rewrite).
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  7. #7
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    I would go with any kind of big name. Like ReaderOrWriter. Or IOobject. Because in the end you would have separate functions, like Write(), Read(). And the end-point matters more. The other will be mostly for programmers to see. In which case you just care about clarity, not for the marketing value of the name.

    My spontaneous answer was "Literacy", but it was kind of covered by lasersight :P

  8. #8
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008
    Location
    Indonesia
    Posts
    489
    ObjectLiterator (for both ObjectWriter and ObjectReader),
    LiteratorDispatcher (ReaderDispatcher and WriterDispatcher), Literator (Reader and Writer) and LiteratingMapper (WritingMapper and ReadingMapper) seems just right.

    Thank you laserlight!
    Just GET it OFF out my mind!!

  9. #9
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    The two operations inherently have different names and there is no single word that adequately describes both of them.

    ("Literator" was probably a joke, and sounds completely ridiculous)
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  10. #10
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008
    Location
    Indonesia
    Posts
    489
    Quote Originally Posted by brewbuck View Post
    The two operations inherently have different names and there is no single word that adequately describes both of them.

    ("Literator" was probably a joke, and sounds completely ridiculous)
    Yeah, I think combining read/write operations just make things ambiguous >.<

    But how?
    They are exactly similar objects and have similar flow...

    Doing something similar twice and more is irritating right?
    Moreover we are talking about objects and their relations.

    For instance:
    To print A, B, C, D;
    Only stupid people would do this:
    Code:
    cout << 'A' << endl;
    cout << 'B' << endl;
    cout << 'C' << endl;
    cout << 'D' << endl;
    Better,
    Code:
    char array = {'A', 'B', 'C', 'D'};
    for(int i = 0; i < 10; i++) {
      cout << array[i] << endl;
    }
    Or even smarter,
    Code:
    for(char i = 65; i < 69; i++) {
      cout << i << endl;
    }
    Just GET it OFF out my mind!!

  11. #11
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Quote Originally Posted by audinue View Post
    Better,
    Code:
    char array = {'A', 'B', 'C', 'D'};
    for(int i = 0; i < 10; i++) {
      cout << array[i] << endl;
    }
    Hmm...

  12. #12
    and the hat of copycat stevesmithx's Avatar
    Join Date
    Sep 2007
    Posts
    498
    Quote Originally Posted by audinue View Post
    Better,
    Code:
    char array = {'A', 'B', 'C', 'D'};
    for(int i = 0; i < 10; i++) {
      cout << array[i] << endl;
    }

    Or even smarter,
    Code:
    for(char i = 65; i < 69; i++) {
      cout << i << endl;
    }
    Use of magic constants is not much of a smart idea.
    For the sake of clarity,It could have been,
    Code:
    for(char i = 'A'; i < 'E'; i++) {
      cout << i << endl;
    }
    I don't get your point though. What do any of these got to do with read/write?
    Last edited by stevesmithx; 01-19-2010 at 02:58 AM.
    Not everything that can be counted counts, and not everything that counts can be counted
    - Albert Einstein.


    No programming language is perfect. There is not even a single best language; there are only languages well suited or perhaps poorly suited for particular purposes.
    - Herbert Mayer

  13. #13
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by brewbuck View Post
    The two operations inherently have different names and there is no single word that adequately describes both of them.

    ("Literator" was probably a joke, and sounds completely ridiculous)
    For what's it worth, I really like the word "literator" and the other derivations of "literate" -- true, it is not a real word, but the meaning is quite clear and appropriate enough, I think.

    It is not so far from "serialize". Good one, audinue. (Tech) people make up new words and new uses for old words all the time.
    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

  14. #14
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008
    Location
    Indonesia
    Posts
    489
    LOL, sorry, for the second code it should be
    Code:
    char array[4]
    For the i < 10, it should be 4, yeah you are pretty sharp, guys.. :P

    But, the point is printing A is just similar to printing B. In my case, reading is just similar to writing (I'm using very simple example I think).

    So, for example, again, creating printScoreRange (A-D) will be efficient instead of printA, printB, printC, ...

    Code:
    public abstract Object literate(Object object) throws Exception;
    for both read/write... feel better.
    Just GET it OFF out my mind!!

  15. #15
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    Quote Originally Posted by MK27 View Post
    (Tech) people make up new words and new uses for old words all the time.
    That's definitely true, but not everybody has the acuity to come up with something that doesn't sound completely dumb.

    No offense to Laserlight intended. I think it was a joke anyway.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Page 1 of 2 12 LastLast
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, 03: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, 05:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21