Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: Foxpro ORM for children

$
0
0
Re: Foxpro ORM for children
FoxPro Programming
Re: Foxpro ORM for children
03/17/2012
01:51:13 PM
3GH0TP187 Show this entire thread in new window
Gratar Image based on email address
From:
To:
Attachments:
None
Just using (aka stealing) the ideas behind wwBusiness has been enough for my purposes, and, as you say, the time for major investments into refactoring VFP is way past. In fact, the only real reason I'm refactoring at all is really to segment the business logic so I can focus on what needs to be converted to ASP.NET MVC.

That's not to say I don't get caught up in VFP code. I may need to move on, but that doesn't change my feelings for VFP. Wait, are we talking programming languages or girlfriends here...

Thanks for the clarification Rick.

~Brett

Well, wwBusiness predates collections and the original was built prior to collections available in the language.

There are lots of problems with FoxPro collections as well and I NEVER EVER use them. They're expensive (slow), the don't work like typical collections work in regards to indexers. So much so in fact that in Web Connection there now is wwCollections which creates two classes that use internal arrays to manage the collection. But you still can't iterate over them with FOREACH() because FoxPro doesn't expose any implementation mechanism for collections (which is another dead end of collections).

So long story short the one to many scenario in wwBusiness is not particularily well implemented as the implementation of is geared more towards single record based manipulation. If I had to do this over now I would do this differently, but that time is way past at this point :-)

+++ Rick ---



I couldn't resist the Subject text but what I'm asking about is creating multiple child objects for your business objects such as Rick's example from the wwBusiness docs:
oInvoice aLineItems aRow[1]

First of all, I know I'm about 7 or so years late to this discussion, but I'd really like to know, why use arrays to hold the children and not a collection? Now, if I had to guess, I'd say that it's because the "FOR EACH enumeration of VFP Collections does not provide true object references":

http://www.west-wind.com/wwthreads/ShowMsg.wwt?MsgId=0Y40USMEN

_and_ because VFP arrays are so much more feature rich than VFP Collections, like using SCATTER and such. So is that the gist of it, or is there something else?

I've just been doing a lot of ASP.NET MVC stuff lately and while reworking some circa 1999 code thought I'd make it more object driven and immediately ran into this.

Also, speaking of Business Object stuff, how do you normally deal with needing to have those children ordered? For example, suppose you've got a Business Object oCart that has an array of oCartItems that's being added to by the user. But, because of group discounting at say a Category level, you need to display those cart items grouped by Category instead of natural order. Which of course might require resorting for every add. Do you make your array more heavyweight, deal with it display side, or is there some simple solution that I'm missing (like 90% of the questions I ask here <g>). Actually, as I typed this, I realized I'd be persisting to data for every hit so I'd be loading fresh each time but I'm still curious about this. I'm sure there are situations where you need to have those children ordered differently, or no?

~Brett




Viewing all articles
Browse latest Browse all 10393

Trending Articles