473,776 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Design issue( creation of objects)

H
My application consists of three layers, presentaion layer(PL), Business Logic layer(BLL) and Data Access layer(DAL)
my application is a single windows form application
now BLL consits of couple of classes, in one class of BLL, i need to access a function of PL
the function declaration is as..... public void MyFunc()....... which is not a static one
and there r lot of functions which use the above function.. s
in the middle of the application development i cant change the Function into a static one. At this situation i created a object of the PL and used in the BLL class , Can i do like this
Is my approach is a bad one
I heard that only upper layers should use the objects of the lower layers classes..

My PL class is having an object of my BLL class and my BLL class is having an object of the PL class, is this bad design
PL <----------> BL

-----need hel
---------seas

Nov 16 '05 #1
2 1672
"=?Utf-8?B?c2Vhc2g=?=" <an*******@disc ussions.microso ft.com> wrote in
news:EE******** *************** ***********@mic rosoft.com:
Hi
My application consists of three layers, presentaion layer(PL), Business
Logic layer(BLL) and Data Access layer(DAL). my application is a single
windows form application. now BLL consits of couple of classes, in one
class of BLL, i need to access a function of PL, the function
declaration is as..... public void MyFunc()....... which is not a static
one. and there r lot of functions which use the above function..
This is not right, semantically. Never call a method in tier N+1
from tier N if tier N+1 is laying on top of N. So your BL tier shouldn't
call methods from the GUI, as the BL is a black box for the GUI, it
provides a service API to the GUI. Calls are always from the GUI to BL and
from the BL to the DAL, never the other way around. You'll get cyclic
references as well, which is a signal something is wrong.

If you need to use some logic in the GUI and BL tier, place it in
some separate project, UtilityClasses or whatever, code which is not tied
to a single tier. Then use this utility code in both the GUI and the BL
tier.
so in the middle of the application development i cant change the
Function
into a static one. At this situation i created a object of the PL and
used in the BLL class , Can i do like this?
well... you probably can (however with project references it might
be a problem: gui references BL, BL references GUI), but it's not wise, as
it makes the BL tier semantically part of the GUI.
Is my approach is a bad one?
I heard that only upper layers should use the objects of the lower
layers classes...
true.
My PL class is having an object of my BLL class and my BLL class is
having an object of the PL class, is this bad design? PL <---------->
BLL


It's not that great :) I'd opt for the separate utility lib option,
so you can keep the gui and bl tiers separated.

What kind of code is located in the Method you want to call from
the BL? Perhaps it is better you'd place that call in the BL anyway.

FB

--
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP
Nov 16 '05 #2
Hi seash

Just as Frans said, it is not good practice. BL is supposed to service the PL, not the other way round

Though the actual situation is not clear, I believe delegates and events might help you out

Regards
fbhca

Nov 16 '05 #3

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

Similar topics

2
279
by: seash | last post by:
H My application consists of three layers, presentaion layer(PL), Business Logic layer(BLL) and Data Access layer(DAL) my application is a single windows form application now BLL consits of couple of classes, in one class of BLL, i need to access a function of PL the function declaration is as..... public void MyFunc().......which is not a static one and there r lot of functions which use the above function.. s in the middle of the...
2
283
by: seash | last post by:
H My application consists of three layers, presentaion layer(PL), Business Logic layer(BLL) and Data Access layer(DAL) my application is a single windows form application now BLL consits of couple of classes, in one class of BLL, i need to access a function of PL the function declaration is as..... public void MyFunc().......which is not a static one and there r lot of functions which use the above function.. s in the middle of the...
4
1266
by: Elhanan | last post by:
hi.. i'm a database kind of guy, when ever i apprached a new project i always looked at it from tables point of view, how can normlize correcly and them moved to the objects and desgined them accodging to the tables.. i see that usually ppl go the other way, design objects and then desgin the tables..
6
2140
by: JoeC | last post by:
I have a question about designing objects and programming. What is the best way to design objects? Create objects debug them and later if you need some new features just use inhereitance. Often times when I program, I will create objects for a specific purpose for a program and if I need to add to it I just add the code.
0
9628
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
10292
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
10122
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
10061
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
9923
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...
0
6722
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();...
0
5368
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2860
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.