From: Justin F. <je...@ey...> - 2001-07-14 19:54:39
|
Alex: First of all, please do not consider this something like pressure. But, this question(s) which I will pose may be relevant to others on this list that are also in a module writing frenzy. Experience that we have had and question that have arisen may be useful to expose. It seems to me, firstly, that one of the "arts" that will be acquired to exploint the huge potential of BC is the knack for isolating the functionality of a module to the just-right-level, nothing really different that the difficulty in OOP of designing a class effectively. Now we are writing/testing/learning BC by writing modules for an Intranet. There will be dozens or hundreds of different reports, and so we break down these reports to kind of three things: 0. A data fetcher // unique, db's etc ------------------ 1. A selector // general 2. A lister // general 3. A pager // general with which one can bolt together any report on any set of data quickly, as well as serve as pieces for a dynamic report generator. The goal is that these are so generally written that these will be the only three modules needed for any and all reports. Immediately, and I mean immediately, inter-module communication is necessary, as the Selector has to pass in a data structure of data to the Lister, and the Selector also has to make some kind of method call with a data structure argument that sets up the list in certain kinds of formats/look/ feel. Then the Pager has to control how many rows to display, and a kind of control data structure has to be passed around. Whew, all of this "works". But these damn data structures are "hand crafted" at this moment and easily "forgotten" and so there are a lot of nuisance errors. Jason and I keep thinking, "Waaall, this Entity Manager is going to solve our problem." It is not clear, understandably, just what the Entity Manager is going to do. The words in the documentation make sense, but specifically, 1. Will we be able to define a data structure with it like, externally in XML, and then refer to this as what we want to pass around in certain places? 2. Or, will data structures have to be defined in each program "by hand"? 3. Are "easy" declarations even going to be a part of the Entity Manager. 4. Many other questions... I just don't know what this animal is going to offer. For certain, what I feel a need for is a facility that "fixes" somehow, certain data structures, makes them easy to declare, and fill, and allow us to have a "standard" set of them, so I can tell, say, Jason, to write this or that module and make sure you use the FOOBAT data structure as the formal argument to $NewModule->some_setup_method($FOOBAT_TYPE); Lordy, I hope this is what will be possible. If not, then I might be forced in to add this kind of convenience. At the present state of things, one gets tired easily at this level of complexity. _jef PS: And when is a first cut of Entity Manager likely???? PPS: If we want anything "next", it is Entity Manager. -- Justin Farnsworth Eye Integrated Communications 321 South Evans - Suite 203 Greenville, NC 27858 | Tel: (252) 353-0722 |
From: John D. <jo...@we...> - 2001-07-15 00:15:54
|
On Sat, 14 Jul 2001, Justin Farnsworth wrote: > > It is not clear, understandably, just what the Entity > Manager is going to do. The words in the documentation > make sense, but specifically, > > 1. Will we be able to define a data structure with it > like, externally in XML, and then refer to this > as what we want to pass around in certain places? The entities are defined in XML, yes. The 'make' process "compiles" those XML structures into PHP data structures, so the run-time cost is not incurred. What do you mean "pass around"? The EntityManager manages operations having to do with entities, namely Add(), Set(), Get(), GetList(), and Delete(). If you need a populated entity object, then the Get() method will return it based on the primary key. > 2. Or, will data structures have to be defined in each > program "by hand"? I don't follow. What data structures are you talking about? > 3. Are "easy" declarations even going to be a part of > the Entity Manager. Don't follow this either. The EntityManager is a framework. Your application will probably extend it based on your needs. binarycloud will provide a base set of functionality based on the EntityManager, namely a lister, an editor, a picker. We don't currently have the notion of a pager, that I'm aware of; That's part of the lister. > 4. Many other questions... > > I just don't know what this animal is going to offer. > For certain, what I feel a need for is a facility that > "fixes" somehow, certain data structures, makes them > easy to declare, and fill, and allow us to have a "standard" > set of them, so I can tell, say, Jason, to write this > or that module and make sure you use the FOOBAT > data structure as the formal argument to > It's pretty broad in scope. In our application, the EntityManager is _the_ connection between application logic and data management, storage and retrieval. > > PS: And when is a first cut of Entity Manager likely???? This has yet to be determined. There is a significant amount of effort involved here and it is a really bad time for the three of us who wrote it to work on the binarycloud "port". Also, the EntityManager depends on the QueryManager, and some other significant components. John -- John Donagher Application Engineer Intacct Corp. - Powerful Accounting on the Web 408-395-0989 720 University Ave. Los Gatos CA 95032 www.intacct.com Public key available off http://www.keyserver.net Key fingerprint = 4024 DF50 56EE 19A3 258A D628 22DE AD56 EEBE 8DDD |
From: Alex B. <en...@tu...> - 2001-07-15 00:27:16
|
>> It is not clear, understandably, just what the Entity >> Manager is going to do. The words in the documentation >> make sense, but specifically, >> >> 1. Will we be able to define a data structure with it >> like, externally in XML, and then refer to this >> as what we want to pass around in certain places? > > The entities are defined in XML, yes. The 'make' process "compiles" those XML > structures into PHP data structures, so the run-time cost is not incurred. > > What do you mean "pass around"? The EntityManager manages operations having to > do with entities, namely Add(), Set(), Get(), GetList(), and Delete(). If you > need a populated entity object, then the Get() method will return it based on > the primary key. > >> 2. Or, will data structures have to be defined in each >> program "by hand"? > > I don't follow. What data structures are you talking about? To clarify: an entity is a hierarchical definition of a set of data, with names and rules associated with each 'field' in that hierarchy. They are byu their nature 'central' in the system, i.e. accessible to all. Entities can be stored anywhere in the sourc tree, but they will end up in binarycloud/build/{lang}/user/ent/ >> 3. Are "easy" declarations even going to be a part of >> the Entity Manager. > > Don't follow this either. The EntityManager is a framework. Your application > will probably extend it based on your needs. binarycloud will provide a base > set of functionality based on the EntityManager, namely a lister, an editor, a > picker. We don't currently have the notion of a pager, that I'm aware of; > That's part of the lister. I think xml declarations are as "easy" as we can expect given the capabilities offered by EntityManager. >> 4. Many other questions... >> >> I just don't know what this animal is going to offer. >> For certain, what I feel a need for is a facility that >> "fixes" somehow, certain data structures, makes them >> easy to declare, and fill, and allow us to have a "standard" >> set of them, so I can tell, say, Jason, to write this >> or that module and make sure you use the FOOBAT >> data structure as the formal argument to That is exactly correct. > It's pretty broad in scope. In our application, the EntityManager is _the_ > connection between application logic and data management, storage and > retrieval. yep :) >> PS: And when is a first cut of Entity Manager likely???? > > This has yet to be determined. There is a significant amount of effort > involved > here and it is a really bad time for the three of us who wrote it to work on > the binarycloud "port". Also, the EntityManager depends on the QueryManager, > and some other significant components. So, I'm working on other things, namely external package integration, and a couple minor enhancements to page. This will happen, all, but it's a buch of really complex code that we need to sort through and integrate properly - and that will take time :) _alex -- alex black, ceo en...@tu... the turing studio, inc. http://www.turingstudio.com vox+510.666.0074 fax+510.666.0093 |
From: Andreas A. <a.a...@th...> - 2001-07-15 12:55:59
|
Hi Alex, > an entity is a hierarchical definition of a set of data, with names and > rules associated with each 'field' in that hierarchy. > They are byu their nature 'central' in the system, i.e. accessible to all. > Entities can be stored anywhere in the sourc tree, but they will end up in Hmm. Like that? class TCategory { var $categoryId; var $name; var $parentId; function selfCheck() { .. } } class EtyCategory { function Add() { MetabaseStuff; } ... } Andi |
From: John P. C. <jp...@jp...> - 2001-07-15 17:11:58
|
On Sun, Jul 15, 2001 at 02:55:48PM +0200, Andreas Aderhold wrote: > Hmm. Like that? Not quite, see below. > class TCategory { > var $categoryId; > var $name; > var $parentId; > > function selfCheck() { > .. > } > } > > class EtyCategory { > function Add() { > MetabaseStuff; > } > ... > } Originally, we thought of it like that, with the classes containing the state of the entity. But it quickly became apparent that the usefulness of that really didn't exist the way our system works. The managers are more "session" based. They contain no state and only handle the operations of an entity like Add, Set, Get, GetList, Delete and other BL functions a developer might add. For example: Class TCategoryManager extends EntityManager { ... function Add(&$values) { // polish up data as desired in the derived class ... your code ... return EntityManager::Add($values); // returns true/false } } // values would be past in from a client of the Manager (UI, xml request, etc). It would look like this: $values = array ( 'CATEGORYID' => 'A', 'NAME' => 'My Name', 'PARENTID' => 'B' ); $rval = $myMgr->Add($values); So, basically you are saying to the manager, "Here is some data I have. Please Add it, as only you know how." The Editor/Lister seamlessly integrate with the Managers and calls the Add/Set/Get with the appropriate values. So, in most cases you don't have to go around building these arrays. You only have to make the initial entity definition, and everything else just works. I may be oversimplifying a little, but not too much actually. HTH, jpc |
From: Andreas A. <a.a...@th...> - 2001-07-16 11:00:41
|
Hi John, > class TCategory { > var $categoryId; > var $name; > var $parentId; > > function selfCheck() { > .. > } > } > > class EtyCategory { > function Add() { > MetabaseStuff; > } > ... > } > Originally, we thought of it like that, with the classes containing the state > of the entity. But it quickly became apparent that the usefulness of that > really didn't exist the way our system works. The managers are more "session" > based. They contain no state and only handle the operations of an entity like > Add, Set, Get, GetList, Delete and other BL functions a developer might add. Yepp. Thats more or less how I do it now. I've a class say, "IfCategoryAdmin" that handles the administration of categories (renders page (cur. smarty) and acting to form input). This class will split up to differend BC modules, later (e.h. regex filter operations, orderby are common to all my scripts). The interface class uses a manager class "MgrCategory" that handles the queries using the above TCategory "type". Actually i've splitted the validation routines to another class TCategoryValidator that extends the TCategory. This is, because I don't want to have the validation routines in the array holding the containers = each row I fetch from db. For example I get from the post an asoc array $formdata[]. I pass this to the validator that checks it back, if ok, I create an object of Tcategory and pass it to the manager, then trigger Add(), Delete() etc. That's how I currently manage the database stuff. I feel thats a bit overhead and unneccessary work caus I have to write a manager for each table and the corresponding tables and its error prone. So I'm very excited to see the entity manager. >Class TCategoryManager extends EntityManager { > ... > function Add(&$values) { > // polish up data as desired in the derived class > ... your code ... > > return EntityManager::Add($values); > // returns true/false > } >} Add(&$values) does the validation, right !? And the values I pass to EntityManager::Add($values) have the filed names + values for my tables that are defined by this entity? 'categoryId' => 1, 'name' => "Music", 'parentId' => 0 But what if the entity spans more than one table? A common construct in my db is for example: news (newsId, userId, categoryId) newsresources <- linktable (newsId,resourceId) resources (resourceId, etc) If i understand right I define this connection somewhere in the entity named "news" and then pass $values array( 'newsId' => 1, 'userId' = 22, 'categoryId = 10, 'text' => "Blah", 'resourceId' = 1,4,3 ); The manager then connects the resource id 1,4,3 with the news 1 updating the tables news and newsresources!? That IS really groovy!!!!! >$values = array ( > 'CATEGORYID' => 'A', > 'NAME' => 'My Name', > 'PARENTID' => 'B' >); > $rval = $myMgr->Add($values); currently i'm doing like this in the UI script (modified is asoc array): $values = new TCategory($Request->getVar("modified")) $rval = $myMgr->Add($values); or $list = $myMgr->GetByRegex($regex) where $list is an array of TCategory objects. > The Editor/Lister seamlessly integrate with the Managers and calls the > Add/Set/Get with the appropriate values. So, in most cases you don't have > to go around building these arrays. Ok, thats clear. Now, to make my app as portable as possible, what shall I do? I guess: - frist, sikp to work with this type objects (TCategory, TCategoryValidator) - gather the values from user and assemble array as shown above - pass this array to my current manager $myMgr->Add($values); - my manager handles this array and does the querys that I currently have to write by hand. Later I just replace the database handling with ety manager calls. Thanks Andi |
From: John P. C. <jp...@jp...> - 2001-07-16 16:28:23
|
On Mon, Jul 16, 2001 at 12:49:29PM +0200, Andreas Aderhold wrote: > > Add(&$values) does the validation, right !? Yes, the EntityManager::Add() uses information in the entity defintion to validate the input. You can, of course, override this to do any additional validation as well. > And the values I pass to EntityManager::Add($values) have the filed names + > values for my tables that are defined by this entity? > > But what if the entity spans more than one table? A common construct in my > db is for example: This is fine. The entity is a logical object (of one or more entities) that map to zero or more database tables. The relationships to other tables are defined within the entity definition, so that all the basic queries are automatically generated. > $values array( > 'newsId' => 1, > 'userId' = 22, > 'categoryId = 10, > 'text' => "Blah", > 'resourceId' = 1,4,3 > ); > > The manager then connects the resource id 1,4,3 with the news 1 updating the > tables news and newsresources!? We do things like: myobj = array ( 'FIELD1' => 'A', 'FIELD2' => 'B', 'MAILADDRESS' => array ( 'STREET' => 'Foo Ave.', 'CITY' => 'Houston', 'STATE' => 'TX', ) ); In this case there are two entities encapsulated in one. The toplevel object and the mailaddress. The joins between the two are automatically created and all the queries for selecting, inserting, deleting, etc. are created for you. > That IS really groovy!!!!! Yes it is. Gotta run to work on all this craziness. HTH. jpc |
From: Justin F. <je...@ey...> - 2001-07-15 01:41:34
|
Thank you John, for this answer. It clears up a lot of things, and I feel that it is going to be useful. What seems satisfying is that, if I understand correctly, is that if I need a data structure such as: $setup = array( 'table' => array( 'border' => "0", 'align' => "left", 'bgcolor' => "#CCCCFF", 'cellspacing' => "2", 'cellpadding' => "5", 'width' => "400", ), 'header' => array( 'bgcolor' => "#FFCCCC", ), 'row' => array( 'bgcolor' => "#CCFFCC", ), 'column' => array( 'bgcolor' => "#FCFFCC", ), 'other' => array( 'freshmeat' => true, ), ); that I, somehow, write this out in XML, and somehow, give it an identity/tag/handle/key I can somehow, declare it easily, (and it gets dragged out of ./ent ??), can fill it easily, use it arguments to other module method calls. It is appreciated that a lot of this effort will be offloaded at compile time and not run time. In any case, it sounds good. I will just have to wait, now, for the Stradivarius. _jef ----------------------- John Donagher wrote: > > On Sat, 14 Jul 2001, Justin Farnsworth wrote: > > > > > It is not clear, understandably, just what the Entity > > Manager is going to do. The words in the documentation > > make sense, but specifically, > > > > 1. Will we be able to define a data structure with it > > like, externally in XML, and then refer to this > > as what we want to pass around in certain places? > > The entities are defined in XML, yes. The 'make' process "compiles" those XML > structures into PHP data structures, so the run-time cost is not incurred. > > What do you mean "pass around"? The EntityManager manages operations having to > do with entities, namely Add(), Set(), Get(), GetList(), and Delete(). If you > need a populated entity object, then the Get() method will return it based on > the primary key. > > > 2. Or, will data structures have to be defined in each > > program "by hand"? > > I don't follow. What data structures are you talking about? > > > 3. Are "easy" declarations even going to be a part of > > the Entity Manager. > > Don't follow this either. The EntityManager is a framework. Your application > will probably extend it based on your needs. binarycloud will provide a base > set of functionality based on the EntityManager, namely a lister, an editor, a > picker. We don't currently have the notion of a pager, that I'm aware of; > That's part of the lister. > > > 4. Many other questions... > > > > I just don't know what this animal is going to offer. > > For certain, what I feel a need for is a facility that > > "fixes" somehow, certain data structures, makes them > > easy to declare, and fill, and allow us to have a "standard" > > set of them, so I can tell, say, Jason, to write this > > or that module and make sure you use the FOOBAT > > data structure as the formal argument to > > > > It's pretty broad in scope. In our application, the EntityManager is _the_ > connection between application logic and data management, storage and retrieval. > > > > > PS: And when is a first cut of Entity Manager likely???? > > This has yet to be determined. There is a significant amount of effort involved > here and it is a really bad time for the three of us who wrote it to work on > the binarycloud "port". Also, the EntityManager depends on the QueryManager, > and some other significant components. > > John > > -- > > John Donagher > Application Engineer > Intacct Corp. - Powerful Accounting on the Web > 408-395-0989 > 720 University Ave. > Los Gatos CA 95032 > www.intacct.com > > Public key available off http://www.keyserver.net > Key fingerprint = 4024 DF50 56EE 19A3 258A D628 22DE AD56 EEBE 8DDD > > _______________________________________________ > binarycloud-dev mailing list > bin...@li... > http://lists.sourceforge.net/lists/listinfo/binarycloud-dev -- Justin Farnsworth Eye Integrated Communications 321 South Evans - Suite 203 Greenville, NC 27858 | Tel: (252) 353-0722 |
From: Alex B. <en...@tu...> - 2001-07-15 01:57:15
|
> Thank you John, for this answer. It clears up a lot of things, > and I feel that it is going to be useful. > > What seems satisfying is that, if I understand correctly, is > that if I need a data structure such as: > > $setup = array( > 'table' => array( > 'border' => "0", > 'align' => "left", > 'bgcolor' => "#CCCCFF", > 'cellspacing' => "2", > 'cellpadding' => "5", > 'width' => "400", > ), > 'header' => array( > 'bgcolor' => "#FFCCCC", > ), > 'row' => array( > 'bgcolor' => "#CCFFCC", > ), > 'column' => array( > 'bgcolor' => "#FCFFCC", > ), > 'other' => array( > 'freshmeat' => true, > ), > ); > > that I, somehow, write this out in XML, and somehow, give > it an identity/tag/handle/key I can somehow, declare it easily, > (and it gets dragged out of ./ent ??), can fill it easily, > use it arguments to other module method calls. It is > appreciated that a lot of this effort will be offloaded > at compile time and not run time. hi Justin, the above example isn't correct. here's a (simplified) example: entity: user username type => text size => '20' regex => 'regex_pattern' field_label => 'User Name' required => true email_address type => email size => '40' field_label => 'Email Address' required => true so, you'll have a users table in your database - and it's good to be able to do: EntityManager->Get(); with a primary key and entity, so you can get back a set of data, or, if you are posting data, Entitymanager will enforce the rules you defined: if you're Adding a user, the username and email_address fields must not be empty - username has to match the regex provided, and the email address has to match the standard email regex that's implicitly attached to the type. Entitymanager is _only_ for data access. > In any case, it sounds good. I will just have to wait, > now, for the Stradivarius. best, _alex |
From: Justin F. <je...@ey...> - 2001-07-15 02:40:17
|
Aha. So it is for managing, er, what I might call "persistant" entities, and that means the database. This also looks good, having all that regex stuff/type_checking/ is_required stuff done for ya. Wonderful. Well, I was on a parallel universe. I was _assuming_ some kind of facility that was a framework that "facilitated" declarations of, filling of, walking of, array-based data structures. I have to let this sink in now. What I am finding is a "need" for a kind of data-structure- manipulator-class (DSM Class). I had some idea that the EntityManager was going to give me such a facility. But what I need is probably too specific for a "Manager". I find that I am slowly writing/adding to this DSM Class to do what I want, and shamefully, it ain't turning out too general. The explanation of this need is that I am writing a dynamic report generator, defined by a web form, and thereby letting the user define, not only the data sources, but the "look-and-feel" that the report will use, which will be determined by such a data structure. Then I can pass this around serialized, say, for the session. Or, if the user wishes to "keep" it, it can be written to some user preferences/profile table, maybe mapped to one or a set of reports, or all reports. And so the EntityManager will make that part easy. Man, this BC is like being given a harem for your birthday. You just don't know where to start (or end). _jef ------------------------------- Alex Black wrote: > > > Thank you John, for this answer. It clears up a lot of things, > > and I feel that it is going to be useful. > > > > What seems satisfying is that, if I understand correctly, is > > that if I need a data structure such as: > > > > $setup = array( > > 'table' => array( > > 'border' => "0", > > 'align' => "left", > > 'bgcolor' => "#CCCCFF", > > 'cellspacing' => "2", > > 'cellpadding' => "5", > > 'width' => "400", > > ), > > 'header' => array( > > 'bgcolor' => "#FFCCCC", > > ), > > 'row' => array( > > 'bgcolor' => "#CCFFCC", > > ), > > 'column' => array( > > 'bgcolor' => "#FCFFCC", > > ), > > 'other' => array( > > 'freshmeat' => true, > > ), > > ); > > > > that I, somehow, write this out in XML, and somehow, give > > it an identity/tag/handle/key I can somehow, declare it easily, > > (and it gets dragged out of ./ent ??), can fill it easily, > > use it arguments to other module method calls. It is > > appreciated that a lot of this effort will be offloaded > > at compile time and not run time. > > hi Justin, > > the above example isn't correct. > > here's a (simplified) example: > > entity: user > username > type => text > size => '20' > regex => 'regex_pattern' > field_label => 'User Name' > required => true > email_address > type => email > size => '40' > field_label => 'Email Address' > required => true > > so, you'll have a users table in your database - and it's good to be able to > do: > > EntityManager->Get(); with a primary key and entity, so you can get back a > set of data, or, if you are posting data, Entitymanager will enforce the > rules you defined: > > if you're Adding a user, the username and email_address fields must not be > empty - username has to match the regex provided, and the email address has > to match the standard email regex that's implicitly attached to the type. > > Entitymanager is _only_ for data access. > > > In any case, it sounds good. I will just have to wait, > > now, for the Stradivarius. > > best, > > _alex > > _______________________________________________ > binarycloud-dev mailing list > bin...@li... > http://lists.sourceforge.net/lists/listinfo/binarycloud-dev -- Justin Farnsworth Eye Integrated Communications 321 South Evans - Suite 203 Greenville, NC 27858 | Tel: (252) 353-0722 |