best naming practices for (file) format reading/writing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

best naming practices for (file) format reading/writing

Peter Uhnak
Hi,

I've seen (and I use) different naming conventions when reading/writing from files/streams...

e.g.

MyReader new readFromStream: aStream. "-> aModel"
MyWriter new writeToStream: aModel. "-> aStream"

or

(MyReader new on: aStream) upToEnd. "-> aModel"
(MyWriter new on: aStream) nextPut: aModel. "-> aStream"

or

MyReader new fromString: aString. "-> aModel"
MyReader new toString: aModel. "-> aString"


etc. (optionally with class-side methods for convenience).

Do we have some best practices/recommendations/conventions regarding this?

Thanks,
Peter

Reply | Threaded
Open this post in threaded view
|

Re: best naming practices for (file) format reading/writing

Stephane Ducasse-3
Not really but it would be nice to collect them.


On Sat, Jul 22, 2017 at 1:05 PM, Peter Uhnak <[hidden email]> wrote:

> Hi,
>
> I've seen (and I use) different naming conventions when reading/writing from files/streams...
>
> e.g.
>
> MyReader new readFromStream: aStream. "-> aModel"
> MyWriter new writeToStream: aModel. "-> aStream"
>
> or
>
> (MyReader new on: aStream) upToEnd. "-> aModel"
> (MyWriter new on: aStream) nextPut: aModel. "-> aStream"
>
> or
>
> MyReader new fromString: aString. "-> aModel"
> MyReader new toString: aModel. "-> aString"
>
>
> etc. (optionally with class-side methods for convenience).
>
> Do we have some best practices/recommendations/conventions regarding this?
>
> Thanks,
> Peter
>