Re: [Pharo-users] Modeling HABTM

2019-06-13 Thread Christopher Fuhrman
On Thu, Jun 13, 2019, 04:35 Jeff Gray wrote: > This may not be a very object thing to say but if you have a relational > database with tables for episode, track and play like in Christopher's > diagram, you may not need a class to model play. As it is just a repository > for a set of links I su

Re: [Pharo-users] Modeling HABTM

2019-06-12 Thread sergio ruiz
Oh! i am trying to do everything in pharo/seaside.. i am not using a database at all.. i am working on getting this set up in gemstones, but i am still really confused in that area.. > On Jun 12, 2019, at 10:35 PM, Jeff Gray wrote: > > diagram, you may not need a class to model play. As it

Re: [Pharo-users] Modeling HABTM

2019-06-12 Thread Jeff Gray
This may not be a very object thing to say but if you have a relational database with tables for episode, track and play like in Christopher's diagram, you may not need a class to model play. As it is just a repository for a set of links I might just have a method on an Episode class that calls the

Re: [Pharo-users] Modeling HABTM

2019-06-10 Thread Christopher Fuhrman
Using an intermediate object "Play" (abstraction of a track being played during an episode), a UML diagram

Re: [Pharo-users] Modeling HABTM

2019-06-10 Thread sergio ruiz
these numbers are super tiny.. 25 episodes so far with about 15 tracks per episode.. > On Jun 10, 2019, at 1:36 PM, James Foster wrote: > > The disadvantage is extra time doing the lookup. But before you discount this > approach, ask yourself what performance penalty this will cost. How many

Re: [Pharo-users] Modeling HABTM

2019-06-10 Thread sergio ruiz
ah! this exactly how i ended up putting it together… and thanks, Jim for the pointers… I just wanted to make sure I wasn’t totally missing something.. > On Jun 10, 2019, at 1:53 PM, Esteban Maringolo wrote: > > But it's not that one object has two "parents" (this isn't a tree like > structu

Re: [Pharo-users] Modeling HABTM

2019-06-10 Thread Todd Blanchard via Pharo-users
--- Begin Message --- I've done a couple cheap and cheerful ORMs in various languages. I always punt on doing the relationships because finishing the app is more urgent than writing a whole framework. I just add an instance method that executes the appropriate SQL to fetch the related objects

Re: [Pharo-users] Modeling HABTM

2019-06-10 Thread Esteban Maringolo
By reference I mean an instance variable. So it's the same thing. But it's not that one object has two "parents" (this isn't a tree like structure). The object (it is, the Track) has two references to the Episodes where it appears, such reference happens because aTrack as a instance variable "hold

Re: [Pharo-users] Modeling HABTM

2019-06-10 Thread sergio ruiz
when you say references, how does this look in pharo? I don’t know that I have used such a relationship. I was thinking that an object would have an instance variable that was an ordered collection of objects.. So having one object belong to two parent objects could be tricky. > On Jun 10, 2

Re: [Pharo-users] Modeling HABTM

2019-06-10 Thread James Foster
Sergio, When you have a two-way relationship, one option is to keep duplicate information and use it to go from one object to the others. The advantage is rapid lookup, but the disadvantage is the need to update multiple places to maintain consistency (as well as the space it takes). Another

Re: [Pharo-users] Modeling HABTM

2019-06-10 Thread Esteban Maringolo
The M:N relationship is pretty straightforward in pure OO design. You have anEpisode that references a collection with instances of Track. And each Track has a collection of episodes. Of course this could be elaborated even further, and have an object like TrackPlay sitting in between of anEpisod

Re: [Pharo-users] Modeling HABTM

2019-06-10 Thread sergio ruiz
Thanks! I’ll look at this. I’d like to keep it in the OO domain.. There is no existing data. Everything would be created for this project. > On Jun 10, 2019, at 12:53 PM, Ben Coman wrote: > > If you are keeping your design purely in the object-oriented domain, > you might try Mutual Friends..

Re: [Pharo-users] Modeling HABTM

2019-06-10 Thread Ben Coman
On Mon, 10 Jun 2019 at 20:21, sergio ruiz wrote: > I am currently putting together a Seaside website for my radio show. I am > trying to figure out how to model the "has and belongs to many" > relationships. > > Each episode can have many tracks, each of these tracks can belong to > several episo