bennadel / Streamlined-Object-Modeling

I am currnently working through the book, Streamlined Object Modeling: Patterns, Rules, and Implementation. True object oriented programming (OOP) is a new world for me and it's really hard for me to wrap my head around. I'd like to get a nice set of code samples here that I can use to practice the modeling techniques outlined in the book.
25 stars 8 forks source link

Peeking in.... #1

Closed jonahx closed 10 years ago

jonahx commented 10 years ago

Hey,

I wasn't sure if you wanted to keep the discussion here or on your blog, but it probably makes more sense here. Let me know if not.

Just to get the fun rolling, what were your thoughts on that Attraction object? What behavior and responsibilities were you thinking it would have?

bennadel commented 10 years ago

@jonahx Yeah, I think it makes sense to keep the convo on GitHub.

To be honest, I hadn't really thought through any of the objects. Mostly, I was just putting pen to paper to help me think about the structure of the folders and getting RequireJS set up properly and tested.

As far as Attraction, that was intended to be the Person-to-Person (uni-direction) attraction. So, for example, if Joe had a crush on Sarah, the base definition could be something like:

Attraction

When it comes to behavior? I assume it would come into play with the collaboration validation , but that stuff is far to fuzzy in my mind right now. I need to go back through parts of the book and re-read the way they approach the interactions.

Bear with me :D

jonahx commented 10 years ago

Let me ask you this. If you hadn't just read the book, and you had to code this by tomorrow gun to your head, how would you approach it?

On Friday, October 11, 2013 10:02:07 PM, Ben Nadel wrote:

@jonahx https://github.com/jonahx Yeah, I think it makes sense to keep the convo on GitHub.

To be honest, I hadn't really thought through /any/ of the objects. Mostly, I was just putting pen to paper to help me think about the structure of the folders and getting RequireJS set up properly and tested.

As far as Attraction, that was intended to be the Person-to-Person (uni-direction) attraction. So, for example, if Joe had a crush on Sarah, the base definition could be something like:

Attraction

  • Owner ( Joe )
  • Target ( Sarah )

When it comes to behavior? I assume it would come into play with the collaboration validation , but that stuff is /far/ to fuzzy in my mind right now. I need to go back through parts of the book and re-read the way they approach the interactions.

Bear with me :D

— Reply to this email directly or view it on GitHub https://github.com/bennadel/Streamlined-Object-Modeling/issues/1#issuecomment-26167722.

bennadel commented 10 years ago

@jonahx Well, normally, I'd have some sort of "service" object that basically acts as a transaction-script and coordinates the entire events (or set of events). Like, I'd have some "FriendService" or "SocialCircleService" that would have some method like "addToSocialCircle()". Then, it would do all of the checking of various things and create all of the new records.

It's not the worst approach in the world, certainly. After all, it's gotten me through the last 10 years of web-application development :D But, I really want to try and think about things from an "object" level. My current approach doesn't use objects at all, just "service classes."

jonahx commented 10 years ago

Yeah, Especially for this problem (as posed so far), it's probably not as far off as you think. You drop the implementation-specific suffix "Service" and you already have one of the objects you need, as you sketched out. You just want to make sure it doesn't become a god object.

I find the "I am a...." rule helpful at this stage for ensuring your models stay light and intuitive. It also helps to anthropomorphize them. Like you could imagine the SocialCircle as a house where everyone gets together, a cartoon house with a face who talks. What does that little house do for all the people inside him? What does he know? And what should he not do and not know?

On Friday, October 11, 2013 11:49:38 PM, Ben Nadel wrote:

@jonahx https://github.com/jonahx Well, normally, I'd have some sort of "service" object that basically acts as a transaction-script and coordinates the entire events (or set of events). Like, I'd have some "FriendService" or "SocialCircleService" that would have some method like "addToSocialCircle()". Then, it would do all of the checking of various things and create all of the new records.

It's not the worst approach in the world, certainly. After all, it's gotten me through the last 10 years of web-application development :D But, I really want to try and think about things from an "object" level. My current approach doesn't use objects at all, just "service classes."

— Reply to this email directly or view it on GitHub https://github.com/bennadel/Streamlined-Object-Modeling/issues/1#issuecomment-26177150.

bennadel commented 10 years ago

Hopefully this will all become much more clear as I put down some code. For some reason, I have a real mental block until I can actually see it on paper.

jonahx commented 10 years ago

can you video it please?

On Saturday, October 12, 2013 3:07:08 PM, Ben Nadel wrote:

Hopefully this will all become much more clear as I put down some code. For some reason, I have a real mental block until I can actually see it on paper.

— Reply to this email directly or view it on GitHub https://github.com/bennadel/Streamlined-Object-Modeling/issues/1#issuecomment-26197142.

bennadel commented 10 years ago

Video what? The writing of the code?

Also, I'm trying to go back through parts of the book and some "philosophies" to the ReadMe. I'm just trying to prime my brain and get this stuff to stick in my head :)

jonahx commented 10 years ago

Lol, I'm sorry about that last post Ben. It's really strange Thunderbird today has now twice sent replies to this github thread when I was trying to reply to someone else (in this case, a coworker). I think the latest update must have broken the conversations extension I've been using. Anyway, that must have been ridiculously confusing...

Carry on :)

bennadel commented 10 years ago

Ha ha, no worries!