473,387 Members | 1,388 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Three-tier Model and Coupling: Raising Events and passing Business Objects

This is a sort of pattern question, but relating to how components are
coupled in a three-tier system.

I have a presentation layer, business layer and data access layer, the first
is the EXE, whilst the other two are implemented as DLLs. The EXE also
references a DLL that contains various user controls, one of which is based
on a grid control.

The coupling is currently like this:

Presentation.EXE -------- Controls.DLL
|
Business.DLL
|
Data.DLL

[I hope that shows up clearly enough]

When a row on a grid (in Controls.DLL) is clicked, an event is raised to
alert the presentation layer that a row has been selected, and to pass the
contents of that row; my RowClickedEventArgs object currently passes a
couple of strings.

I would like my RowClickedEventArgs to pass a Transaction (my invention)
object instead, so that if a blank row is clicked I can pass a null object
(Nothing). The problem is that the Transaction class is defined in the
Business Layer, because that is the class that is used to pass data between
the Presentation Layer and the Data Access Layer, and I don't think that the
Controls.DLL should be coupled to the Business Layer.

Can anyone offer a neat/correct solution to this? I imagine that this not an
uncommon scenario.

TIA.

Charles
Nov 14 '07 #1
8 1735

"Charles Law" <bl***@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
This is a sort of pattern question, but relating to how components are
coupled in a three-tier system.

I have a presentation layer, business layer and data access layer, the
first is the EXE, whilst the other two are implemented as DLLs. The EXE
also references a DLL that contains various user controls, one of which is
based on a grid control.

The coupling is currently like this:

Presentation.EXE -------- Controls.DLL
|
|
MVP

It looks like you need the MVP layer beteen the BL and the UI

MVP layer is coupled to the UI and the BL
|
|
Business.DLL
|
Data.DLL

[I hope that shows up clearly enough]

When a row on a grid (in Controls.DLL) is clicked, an event is raised to
alert the presentation layer that a row has been selected, and to pass the
contents of that row; my RowClickedEventArgs object currently passes a
couple of strings.

I would like my RowClickedEventArgs to pass a Transaction (my invention)
object instead, so that if a blank row is clicked I can pass a null object
(Nothing). The problem is that the Transaction class is defined in the
Business Layer, because that is the class that is used to pass data
between the Presentation Layer and the Data Access Layer, and I don't
think that the Controls.DLL should be coupled to the Business Layer.

Can anyone offer a neat/correct solution to this? I imagine that this not
an uncommon scenario.
You also may want to look at the Service Controller Layer as well.

MODEL-VIEW-PRESENTER

http://www.polymorphicpodcast.com/

click 'Shows'

click 'Design Patterns Bootcamp: Model View * Patterns*

view parts 1-5

You can use Google to get more information about this or find books.

Business objects should not be addressed at the UI. The UI should be unaware
of the business object, if at all possible.


Nov 14 '07 #2
Excellent information. I will read and digest.

Thanks.

Charles
"Mr. Arnold" <MR. Ar****@Arnold.comwrote in message
news:O1**************@TK2MSFTNGP02.phx.gbl...
>
"Charles Law" <bl***@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>This is a sort of pattern question, but relating to how components are
coupled in a three-tier system.

I have a presentation layer, business layer and data access layer, the
first is the EXE, whilst the other two are implemented as DLLs. The EXE
also references a DLL that contains various user controls, one of which
is based on a grid control.

The coupling is currently like this:

Presentation.EXE -------- Controls.DLL
|
|
MVP

It looks like you need the MVP layer beteen the BL and the UI

MVP layer is coupled to the UI and the BL
|
|
>Business.DLL
|
Data.DLL

[I hope that shows up clearly enough]

When a row on a grid (in Controls.DLL) is clicked, an event is raised to
alert the presentation layer that a row has been selected, and to pass
the contents of that row; my RowClickedEventArgs object currently passes
a couple of strings.

I would like my RowClickedEventArgs to pass a Transaction (my invention)
object instead, so that if a blank row is clicked I can pass a null
object (Nothing). The problem is that the Transaction class is defined in
the Business Layer, because that is the class that is used to pass data
between the Presentation Layer and the Data Access Layer, and I don't
think that the Controls.DLL should be coupled to the Business Layer.

Can anyone offer a neat/correct solution to this? I imagine that this not
an uncommon scenario.

You also may want to look at the Service Controller Layer as well.

MODEL-VIEW-PRESENTER

http://www.polymorphicpodcast.com/

click 'Shows'

click 'Design Patterns Bootcamp: Model View * Patterns*

view parts 1-5

You can use Google to get more information about this or find books.

Business objects should not be addressed at the UI. The UI should be
unaware of the business object, if at all possible.


Nov 15 '07 #3
CMM
Sounds like you may want to define an abstract Interface that your
transaction can implement. Create an Interface DLL that defines the members
of your custom transaction. Then both your business and presentation can
consume "ITransaction" dll. Your business layer can return the transaction
object (which will implement your custom ITransaction interface) without
your controls dll actually being dependent on business or data DLL's.

In a true three-*tier* (as oppossed to three-layer) architecture (which
nobody seems to grasp nowadays) the business/data DLL's should NOT exist in
the same machine as the presentation (many reasons for this). Using common
lightweight interfaces stubs between the tiers is essential.
"Charles Law" <bl***@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
This is a sort of pattern question, but relating to how components are
coupled in a three-tier system.

I have a presentation layer, business layer and data access layer, the
first is the EXE, whilst the other two are implemented as DLLs. The EXE
also references a DLL that contains various user controls, one of which is
based on a grid control.

The coupling is currently like this:

Presentation.EXE -------- Controls.DLL
|
Business.DLL
|
Data.DLL

[I hope that shows up clearly enough]

When a row on a grid (in Controls.DLL) is clicked, an event is raised to
alert the presentation layer that a row has been selected, and to pass the
contents of that row; my RowClickedEventArgs object currently passes a
couple of strings.

I would like my RowClickedEventArgs to pass a Transaction (my invention)
object instead, so that if a blank row is clicked I can pass a null object
(Nothing). The problem is that the Transaction class is defined in the
Business Layer, because that is the class that is used to pass data
between the Presentation Layer and the Data Access Layer, and I don't
think that the Controls.DLL should be coupled to the Business Layer.

Can anyone offer a neat/correct solution to this? I imagine that this not
an uncommon scenario.

TIA.

Charles

Nov 15 '07 #4
Charles,

I lately have moved a forms from what you call the main layer to the what
you call your control layer.

(Just use the so often by Herfried and Armin showed application run module
in a sepperated project)

It made a lot of things much easier.

Cor

Nov 15 '07 #5
Hi, thanks for the reply.

You can tell how long I've been away from this as I didn't even think of
interfaces; duh!

I'll give that a shot.

Cheers

Charles
"CMM" <cm*@nospam.comwrote in message
news:4D**********************************@microsof t.com...
Sounds like you may want to define an abstract Interface that your
transaction can implement. Create an Interface DLL that defines the
members of your custom transaction. Then both your business and
presentation can consume "ITransaction" dll. Your business layer can
return the transaction object (which will implement your custom
ITransaction interface) without your controls dll actually being dependent
on business or data DLL's.

In a true three-*tier* (as oppossed to three-layer) architecture (which
nobody seems to grasp nowadays) the business/data DLL's should NOT exist
in the same machine as the presentation (many reasons for this). Using
common lightweight interfaces stubs between the tiers is essential.
"Charles Law" <bl***@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>This is a sort of pattern question, but relating to how components are
coupled in a three-tier system.

I have a presentation layer, business layer and data access layer, the
first is the EXE, whilst the other two are implemented as DLLs. The EXE
also references a DLL that contains various user controls, one of which
is based on a grid control.

The coupling is currently like this:

Presentation.EXE -------- Controls.DLL
|
Business.DLL
|
Data.DLL

[I hope that shows up clearly enough]

When a row on a grid (in Controls.DLL) is clicked, an event is raised to
alert the presentation layer that a row has been selected, and to pass
the contents of that row; my RowClickedEventArgs object currently passes
a couple of strings.

I would like my RowClickedEventArgs to pass a Transaction (my invention)
object instead, so that if a blank row is clicked I can pass a null
object (Nothing). The problem is that the Transaction class is defined in
the Business Layer, because that is the class that is used to pass data
between the Presentation Layer and the Data Access Layer, and I don't
think that the Controls.DLL should be coupled to the Business Layer.

Can anyone offer a neat/correct solution to this? I imagine that this not
an uncommon scenario.

TIA.

Charles


Nov 15 '07 #6
Hi Cor

I see what you mean, but I was trying to keep the Controls and Forms
separate. I can move the form out of the top level, but it seems to me that
it just moves the problem elsewhere. I could put the forms and controls in
the same module, but then that would create tighter coupling.

Regards

Charles
"Cor Ligthert[MVP]" <no************@planet.nlwrote in message
news:3A**********************************@microsof t.com...
Charles,

I lately have moved a forms from what you call the main layer to the what
you call your control layer.

(Just use the so often by Herfried and Armin showed application run module
in a sepperated project)

It made a lot of things much easier.

Cor

Nov 15 '07 #7
Charles,

It makes casting very easy something you cannot do now with your exe.

You don't want to do that, however not personal meant, laws show how we have
to behave, but that does not mean that here is never smoked hashish.

:-)

Cor
Nov 15 '07 #8
CMM
Also remember that this way your business or data layer can "return" a
transaction object to the controls DLL for it to keep around (for whatever
reason) without it directly referencing the business or data layer. Simply
define a settable IMyTransaction property in your event arguments. When the
business or data layer get the event, they instantiate an object that
defines your interface (which of course is shared in a lightweight abtract
interfaces DLL that all the layers share).

"Charles Law" <bl***@nowhere.comwrote in message
news:OC**************@TK2MSFTNGP03.phx.gbl...
Hi, thanks for the reply.

You can tell how long I've been away from this as I didn't even think of
interfaces; duh!

I'll give that a shot.

Cheers

Charles
"CMM" <cm*@nospam.comwrote in message
news:4D**********************************@microsof t.com...
>Sounds like you may want to define an abstract Interface that your
transaction can implement. Create an Interface DLL that defines the
members of your custom transaction. Then both your business and
presentation can consume "ITransaction" dll. Your business layer can
return the transaction object (which will implement your custom
ITransaction interface) without your controls dll actually being
dependent on business or data DLL's.

In a true three-*tier* (as oppossed to three-layer) architecture (which
nobody seems to grasp nowadays) the business/data DLL's should NOT exist
in the same machine as the presentation (many reasons for this). Using
common lightweight interfaces stubs between the tiers is essential.
"Charles Law" <bl***@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>>This is a sort of pattern question, but relating to how components are
coupled in a three-tier system.

I have a presentation layer, business layer and data access layer, the
first is the EXE, whilst the other two are implemented as DLLs. The EXE
also references a DLL that contains various user controls, one of which
is based on a grid control.

The coupling is currently like this:

Presentation.EXE -------- Controls.DLL
|
Business.DLL
|
Data.DLL

[I hope that shows up clearly enough]

When a row on a grid (in Controls.DLL) is clicked, an event is raised to
alert the presentation layer that a row has been selected, and to pass
the contents of that row; my RowClickedEventArgs object currently passes
a couple of strings.

I would like my RowClickedEventArgs to pass a Transaction (my invention)
object instead, so that if a blank row is clicked I can pass a null
object (Nothing). The problem is that the Transaction class is defined
in the Business Layer, because that is the class that is used to pass
data between the Presentation Layer and the Data Access Layer, and I
don't think that the Controls.DLL should be coupled to the Business
Layer.

Can anyone offer a neat/correct solution to this? I imagine that this
not an uncommon scenario.

TIA.

Charles


Nov 15 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: pbay | last post by:
Hi everyone, I'm experiencing a problem with PHP that doesn't seem to have any documentation related to it. I hope it's a simple error on my part :) Basically, I'm loading a SWF (Macromedia...
28
by: Sona | last post by:
I need to find a minimum of three float values.. what would be the most efficient way of doing this? Can someone please share a #define macro or something with me for doing this? Thanks Sona
1
by: Jim Mellish | last post by:
I am trying to put together a schema with some validation on addresses. Three of the address fields are Flat, HouseName and HouseNumber. I have to ensure that at least two of the three or all...
2
by: Sugapablo | last post by:
Can anyone help me out with some code to change three table cells (<td>) when one is hovered over? I have a calendar grid where each day is made up of three table cells and I want all three to...
3
by: Bryan Parkoff | last post by:
I have C++ Primer Third Edition -- Author Stanley B. Lippman and Josee Lajoie. I have been studying it for couple months however it does not provide a valuable information which it is about...
1
by: NA | last post by:
Is it possible to have adjustable tables (not Access tables per se) but those in Ms Word or Excel based on nexted forms three deep? In other words, if I have a main form, Repair History, both the...
7
by: RLN | last post by:
Re: Access 2000 I have three history tables. Each table contains 3 years worth of data. All three tables have a date field in them (and autonum field). Each table has the potential to contain...
11
by: MP | last post by:
context: (vb6 / ado / .mdb / jet4.0 / not using access) hypothetical problem say I need to track the properties of boxes. There are three kinds, cardboard, wood, and sheet metal. Each box...
7
by: illegal.prime | last post by:
Hi all, I've got a client/server application and just wanted to ensure that this is expected behavior. I recently set the following configuration in Visual Studio: Debug->Exceptions->Break Into...
1
Death Slaught
by: Death Slaught | last post by:
I will be showing you how to make a very simple but effective three column layout. First we will begin with the HTML, or structure, of our three column layout. <!DOCTYPE html PUBLIC...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.