HdN Architecture question?

Posts   
 
    
llblPowa
User
Posts: 41
Joined: 19-Nov-2006
# Posted on: 05-Jan-2007 01:41:29   

Hello,

Thank you for releasing HdN. It is a great example to learn the way you, experts, decided to architect you system.

btw - here are question for you:

1) by parsing the code and especially the interaction between the BL and the GUI, I saw that the BL returns (for collection) either DataTable, Dataview or EntityCollection.

Could you explain why and in which case?

IMHO - but I am far for being good - before going through your implementation, I would return only LLBL stuff (EntityCollection, TypedList, TypedView, DynamicList) or .NET stuff (datatable, dataview, dataset) but never both?

2) If I guess right, the GUI will exclusively call <Name>GUIHelper and <name>Manager are only called by <Name>GUIHelper?

Cheers,

LLBLPowa.

PS : While going througth code is good for learning, I think that you should also add a kind of technical docs describing the architecture you put in place and also the reasons behind:-)

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 05-Jan-2007 06:16:28   

As far as I know (Frans please correct me if I'm wrong): HnD was coded to show examples of how to use LLBLGen Pro framework in a web application, rather than to be a design guideline. Design decisions should be yours, where and when to use each of those objects.

My personal opinion: 1- Use EntityCollection if you need a Read / Write collection. (Rarely used in Web apps)

2- Use TypedLists, dynamicLists & TypedViews (both are dataTables by the way) for read-only collection of data. (Frequently used in web apps). Also you can use a DataTable that is a result of an EntityCollection.EntityView projection.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 05-Jan-2007 10:24:24   

llblPowa wrote:

Hello,

Thank you for releasing HdN. It is a great example to learn the way you, experts, decided to architect you system.

HnD wink . you're welcome simple_smile

btw - here are question for you:

1) by parsing the code and especially the interaction between the BL and the GUI, I saw that the BL returns (for collection) either DataTable, Dataview or EntityCollection.

Could you explain why and in which case?

In a lot of cases where data was required by the GUI or BL, we needed aggregated data or additional data from related entities. As it was often the case that the data was used in a read-only fashion (just read the data, consume it and use the result further) as a forum is mostly a one-way street, and because of the nature of the sets we needed, we decided it would be more efficient to just pull the fields from the db we needed, instead of full entities with data we didn't need for that particular call. After all, LLBLGen Pro has this feature (dyn./typed lists) especially for this purpose. simple_smile

IMHO - but I am far for being good - before going through your implementation, I would return only LLBL stuff (EntityCollection, TypedList, TypedView, DynamicList) or .NET stuff (datatable, dataview, dataset) but never both?

I second Walaa's answer, with the addition that the entity collections are also used in scenario's where entities had to be cached, where entities had to be referenced as objects (like in the case with Section entities, see the CacheManager for example). For readonly data, it's often more efficient to just pull the data you need in a flat table and consume it. That doesn't mean you shouldn't use entities in these scenario's. As entity fetch speed is on par with datatable speed these days (unless the entity has very few fields), it doesn't matter much, but it can be you for example need 3 fields from an entity with 10 fields. Then just pulling the 3 fields into memory instead of all 10, for a lot of entities in one set is more efficient. As a forum is a 'read many, write sometimes' kind of application, read-speed is essential.

2) If I guess right, the GUI will exclusively call <Name>GUIHelper and <name>Manager are only called by <Name>GUIHelper?

GUI calls GUIHelper and Manager classes, they never call directly DAL code. GUIHelper classes are for reading data, Manager classes are for manipulating data (delete, insert, update)

PS : While going througth code is good for learning, I think that you should also add a kind of technical docs describing the architecture you put in place and also the reasons behind:-)

We added a lot of comments to the code, and personally I was just too tired to write just a thick releasable (!) design document for explaining everything in detail. it already took too long to get it done, so I decided it would be best to have a developer guide doc which explains everything briefly, and leave the rest to the detailed comments.

You read the developer guide? wink As your questions are explained in there as well wink

Frans Bouma | Lead developer LLBLGen Pro
llblPowa
User
Posts: 41
Joined: 19-Nov-2006
# Posted on: 05-Jan-2007 10:57:31   

Arghhr.... Silly me ! I missed it as I was just searching this doc in the code source download package.

Yop, for sure the first place to start :-)

Thanks.