473,769 Members | 8,267 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

n-Tier and separation of UI from business logic?

I understand and implement the concept (as best I can), BUT what I would
like to know -- how is it possible to completely remove the UI from business
logic? "UI references business logic, but business logic should never
reference UI."

For example, a process that cycles thru datarows in a datatable where after
each iteration the UI progress bar needs to be updated (to show a user that
something is going on)? To truely remove the business logic from the UI, I
can't reference a progress bar control as that is UI and hence invalidates
the concept.

The only way around this is to NOT provide a very accurate progress bar or
display some animation graphic or use an event timer that turns on and off
when the business logic starts/finishes -- but in all cases this is not a
very accurate representation of the duration of a particular process.
Having looked at some of Microsoft's products (Windows Defender Beta 2 for
example) they don't even attempt to portray any accuracy -- just an
animation that the process is still running.

So, I'm curious how you folks resolve this conflict of concept and retain
any accuracy in the state of progress for those long running tasks?

Rob.
Apr 13 '06 #1
7 2197
It sounds like you need your business layer to raise some events. Then
your UI can optionally hook into those events to show a very accurate
progress bar.

Apr 13 '06 #2
On Thu, 13 Apr 2006 09:56:50 -0700, Rob R. Ainscough wrote:
I understand and implement the concept (as best I can), BUT what I would
like to know -- how is it possible to completely remove the UI from business
logic? "UI references business logic, but business logic should never
reference UI."

For example, a process that cycles thru datarows in a datatable where after
each iteration the UI progress bar needs to be updated (to show a user that
something is going on)? To truely remove the business logic from the UI, I
can't reference a progress bar control as that is UI and hence invalidates
the concept.


You could have an event in your business layer raised whenever a new
datarow is being processed. The UI layer would subscribe to this event and
update its progress bar accordingly. Instead of events, you could also have
a callback function mechanism: the method in your business layer that start
processing the data could take a delegate to a function called whenever a
new datarow is being processed. Same principle as an event really but
depending of how your business layer has been designed, callbacks might fit
in better.
Apr 13 '06 #3
Sure, but that invalidates the separate at a conceptual level, no?

Do you have any links that I could read up on how this is done?

"Jared" <go****@triplet reesoftware.com > wrote in message
news:11******** *************@e 56g2000cwe.goog legroups.com...
It sounds like you need your business layer to raise some events. Then
your UI can optionally hook into those events to show a very accurate
progress bar.

Apr 13 '06 #4
In fact, events are a great way to have clean separation between layers
of a system. Your business layer is just raising the events... it
doesn't need to know anything about the code consuming those events.

I'm sorry I don't have time to scan this article for total
relativeness, but it seems like a great place to start:

http://www.ondotnet.com/pub/a/dotnet...ogCsharp3.html

Apr 13 '06 #5
Hello Rob,

On your UI get counter of how much data u can get, put this as the max value
of your progressbar, then again read data from BAL.
On BAL u can keep the number of read data for the current session.

You UI and BAL is separated, and BAL has no connection to UI

RA> I understand and implement the concept (as best I can), BUT what I
RA> would like to know -- how is it possible to completely remove the UI
RA> from business logic? "UI references business logic, but business
RA> logic should never reference UI."
RA>
RA> For example, a process that cycles thru datarows in a datatable
RA> where after each iteration the UI progress bar needs to be updated
RA> (to show a user that something is going on)? To truely remove the
RA> business logic from the UI, I can't reference a progress bar control
RA> as that is UI and hence invalidates the concept.
RA>
RA> The only way around this is to NOT provide a very accurate progress
RA> bar or display some animation graphic or use an event timer that
RA> turns on and off when the business logic starts/finishes -- but in
RA> all cases this is not a very accurate representation of the duration
RA> of a particular process. Having looked at some of Microsoft's
RA> products (Windows Defender Beta 2 for example) they don't even
RA> attempt to portray any accuracy -- just an animation that the
RA> process is still running.
RA>
RA> So, I'm curious how you folks resolve this conflict of concept and
RA> retain any accuracy in the state of progress for those long running
RA> tasks?
RA>
RA> Rob.
RA>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Apr 13 '06 #6
Thanks folks, I got the RaiseEvent and withevents working well -- my UI is
now truely separate from the BL.

"Michael Nemtsev" <ne*****@msn.co m> wrote in message
news:9c******** *************** ***@msnews.micr osoft.com...
Hello Rob,

On your UI get counter of how much data u can get, put this as the max
value of your progressbar, then again read data from BAL.
On BAL u can keep the number of read data for the current session.

You UI and BAL is separated, and BAL has no connection to UI

RA> I understand and implement the concept (as best I can), BUT what I
RA> would like to know -- how is it possible to completely remove the UI
RA> from business logic? "UI references business logic, but business
RA> logic should never reference UI."
RA> RA> For example, a process that cycles thru datarows in a datatable
RA> where after each iteration the UI progress bar needs to be updated
RA> (to show a user that something is going on)? To truely remove the
RA> business logic from the UI, I can't reference a progress bar control
RA> as that is UI and hence invalidates the concept.
RA> RA> The only way around this is to NOT provide a very accurate
progress
RA> bar or display some animation graphic or use an event timer that
RA> turns on and off when the business logic starts/finishes -- but in
RA> all cases this is not a very accurate representation of the duration
RA> of a particular process. Having looked at some of Microsoft's
RA> products (Windows Defender Beta 2 for example) they don't even
RA> attempt to portray any accuracy -- just an animation that the
RA> process is still running.
RA> RA> So, I'm curious how you folks resolve this conflict of concept and
RA> retain any accuracy in the state of progress for those long running
RA> tasks?
RA> RA> Rob.
RA> ---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche

Apr 13 '06 #7
Thus wrote Rob,
Sure, but that invalidates the separate at a conceptual level, no?
No. Conceptually, a business object is a server object, and its event listeners
are clients, be it a Windows Forms application, a CUI application, or an
xNunit test class. There's also a couple of interfaces in .NET 2.0 to support
business object events, like System.Componen tModel.INotifyP ropertyChanged.
Do you have any links that I could read up on how this is done?


http://msdn.microsoft.com/practices/.../html/scag.asp,
especially chapter 2.

Cheers,
--
Joerg Jooss
ne********@joer gjooss.de
Apr 14 '06 #8

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

Similar topics

5
2189
by: A.V.C. | last post by:
Hello, I stuck in a delimma. Where to put the business logic that involves only one update but N number of selects from N tables........with N where conditions
4
2254
by: Simon Harvey | last post by:
Hello Chaps, Me and a collegue have been talking about where the best place to put business logic is. I think that the best place is where Microsoft suggest - in a seperate business logic layer. The alternative is to have all the logic in with the business entity objects, thus eliminating the business logic layer. The reason that I prefer the seperate layer is because I think its more
16
9036
by: MS newsgroup | last post by:
I don't have clear reasons why we need business logic layer and data logic layer instead of having only data logic layer. Are there any good reasons for that?
6
3801
by: Relaxin | last post by:
I'm coming from Borland C++ and am "somewhat" new to C#, but very seasoned in C++. I'm looking for a specific feature that Borland had that I can't seem to find in C#. In Borland that feature is a DataModule. This is a place where you place all of your Database and business logic. This logic can then be "bound" to your UI by use of Borland Datasource components.
2
4061
by: Chris Zopers | last post by:
Hello, I would like to know what's the best way to implement a business logic layer between my user interface and my database. I would say I'd make a dll-project for the business logic layer and make classes that represent objects/tables. For example, if I have a table named 'tblPersons' I would make a class named 'clsPersons' and a class 'clsPerson' that represents one person/record. In class 'clsPersons' I can make some business...
4
1374
by: Mike | last post by:
I have an n-tier system as follows: Business Data Access Web Services
9
2743
by: SAL | last post by:
Hello, I have a Dataset that I have table adapters in I designed using the designer (DataLayer). I have a business logic layer that immulates the DataLayer which may/may not have additional logic in. My business classes are, of course, decorated with the: <System.ComponentModel.DataObject() attribute. So, I drop a GridView on a webform and set its datasource to an ObjectDatasource which in turn is using one of my business logic...
5
3830
by: Andy B | last post by:
I was just wondering, when you create dataContext methods, should you put business logic there to try and minimize pushing data through 2-3 layers of code? or should the business logic still go in another class somewhere making it access the dataContext methods?
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10216
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.