What is the idiomatic way to store data in pharo?

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

What is the idiomatic way to store data in pharo?

Steve Quezadas
I am writing a simple "quote-of-the-day" object for pharo that stores both quotes and pictures. What is the "idiomatic" way of storing data in pharo? Do I connect to some sort mysql database or is there a better "smalltalk" way to do it?

Forgive the naive question.

- Steve
Reply | Threaded
Open this post in threaded view
|

Re: What is the idiomatic way to store data in pharo?

tbrunz
Reply | Threaded
Open this post in threaded view
|

Re: What is the idiomatic way to store data in pharo?

Steve Quezadas
is voyage the most common way to do it?

On Mon, Jan 27, 2020 at 5:32 PM tbrunz <[hidden email]> wrote:
How about Voyage?

https://github.com/pharo-nosql/voyage




--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: What is the idiomatic way to store data in pharo?

vince

Hi Steve

 

Some ways I would do it, given what you have described:

 

1.       Store in the image itself. An ordered collection can be used to store the your MOTD objects and iterate over them with the #do:, #select:, etc methods. For images I would store them on the file system and use a URI from your objects to point to it.

2.       SQLite (https://github.com/pharo-rdbms/Pharo-SQLite3).

3.       If you wish to distribute this then maybe a central server the your client can pull the MOTD objects from. Something running Teapot talking to SQLite3 or even Postgres via Sven’s excellent P3 (https://github.com/svenvc/P3).

4.       Something I was thinking of looking into more is John Aspinall’s ReStore for Pharo (https://github.com/rko281/ReStoreForPharo).

 

Vince

 

From: Pharo-users [mailto:[hidden email]] On Behalf Of Steve Quezadas
Sent: Tuesday, 28 January 2020 11:36 AM
To: Any question about pharo is welcome <[hidden email]>
Subject: Re: [Pharo-users] What is the idiomatic way to store data in pharo?

 

EXTERNAL: Do not click links or open attachments if you do not recognize the sender.

 

is voyage the most common way to do it?

 

On Mon, Jan 27, 2020 at 5:32 PM tbrunz <[hidden email]> wrote:

How about Voyage?

https://github.com/pharo-nosql/voyage




--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: What is the idiomatic way to store data in pharo?

HilaireFernandes
In reply to this post by Steve Quezadas
Steve Quezadas wrote
> Do I connect to some sort mysql database or is there a better "smalltalk"
> way to do it?


The Pharo way is Fuel, it will let you persist a tree of object. The package
is present in Pharo by default. Easy and fast. It is documented in one of
the Pharo book.

Another way is JSON but I don't know it. Sven can speak about it. Its
advantage over Fuel, the file format is portable.

Hilaire



-----
http://drgeo.eu
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: What is the idiomatic way to store data in pharo?

Offray Vladimir Luna Cárdenas-2
In reply to this post by Steve Quezadas
Steve,

You could try with NeoJSON[1] and serialize the image as bytecodes (or
urls to pictures in the web). Is pretty simple and gives you a plain and
portable representation of your Quote of the Day data. Grafoscopio, the
prototype I made, uses NeoJSON to store its notebooks. It's also a
pretty well written library that has Sven's quality mark and you can
learn a lot from it.

[1] https://github.com/svenvc/NeoJSON
[2] https://mutabit.com/grafoscopio/en.html

Cheers,

Offray

On 27/01/20 8:15 p. m., Steve Quezadas wrote:
> I am writing a simple "quote-of-the-day" object for pharo that stores
> both quotes and pictures. What is the "idiomatic" way of storing data
> in pharo? Do I connect to some sort mysql database or is there a
> better "smalltalk" way to do it?
>
> Forgive the naive question.
>
> - Steve