I am a newbie programmer who is trying to learn the basics of n-layered architecture (DAL, BLL, UI). The application I program is a single-level, three-layer application written in VB.NET (.Net 3.5). Layers:
Gave
Bll
interface
COMMON - Contains DTO right now.
I am having trouble deciding what needs to go between my BLL and UI. My instinct tells me that I should only pass data to the user interface, and not the complete business object from the BLL. Consider two scenarios:
1) Transfer the BO directly from the BLL to the user interface. This provides BO methods and allows the UI to directly access the BO, which seems bad.
2) Only transfer relevant data from the BO to the user interface. For example, a customer has a name and address. This data really shows what we want to display / edit in the user interface, so we will return this data only to the user interface, not the full BO. The user interface should then call BLL to update a specific BO.
I tend to use # 2, but I don't know how best to implement it. As I programmed it now, if I only return data from the BLL, all links to my BO will be lost, and the GC will declare it. Based on this, I have a few questions:
1) Should I save business objects between BLL calls? An alternative is to re-create them every time I pass data through the BLL, which seems wrong.
2) BO ( , ?)
3) n-level? BO BLL ? " " BLL, , BO , ?
, - . , , , , .