473,439 Members | 1,731 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,439 software developers and data experts.

DAL Standard or Best Practices

Just wondering if it's standard practice to make DAL classes STATIC (in a
Windows Forms). Doing so would make sense to me because DAL methods are
typically called quite frequently - certainly the case for DAL "Helper"
classes - plus DAL objects/classes generally maintain no state. Seems like a
good case for STATIC classes to me.

It has been recommended to me to put the entire DAL, into a separate .DLL.
Is that standard practice too?

Thoughts? Opinions? Perspective?

Thanks!
Feb 27 '06 #1
3 8919
i usually (75%), make my DAL classes static, unless I have some reason
to make it instance.

For instance, I recently created a DAL that handles SQL and Visual
FoxPro database calls. The SQL class is static, but the foxpro class I
made an instance because once I open the foxpro file, i usually run
quite a few sql statements before closing the connection. In this case
it is more effecient to keep the connection to the foxpro file while I
am running a batch of queries, rather than being a
connect-query-disconnect model.

I think it really depends on your needs. For something like my foxpro
class, i opted for a class instance instead of static methods.

Just my 2 cents

Feb 27 '06 #2
Jeff S wrote:
Just wondering if it's standard practice to make DAL classes STATIC (in a
Windows Forms). Doing so would make sense to me because DAL methods are
typically called quite frequently - certainly the case for DAL "Helper"
classes - plus DAL objects/classes generally maintain no state. Seems like a
good case for STATIC classes to me.
That breaks any idea of using interfaces, however. I tend to use
dependency injection along with interfaces, such that the DAL classes
implement an interfaces and the BOL classes are provided with an
instance of the interface to use. In the production system, those
instances will be instances of the DAL classes. In unit testing,
however, I can provide mock implementations so that I can test my BOL
without needing a full DAL.
It has been recommended to me to put the entire DAL, into a separate .DLL.
Is that standard practice too?


It depends on the scenario, but it can be useful.

Jon

Feb 27 '06 #3
Thanks for providing your perspective.

Now, for a followup question - and please please PLEASE understand that I'm
NOT flaming or trying to be in any way pessimistic. I have been doing a lot
of research on patterns and best practices - from Microsoft, GoF, Martin
Fowler and others. I want to see the value in doing some of the advanced
techniques- but I'm having a hard time seeing the specific advantages and/or
value.
So here goes; RE:
<< In unit testing, however, I can provide mock implementations so that I
can test my BOL without needing a full DAL>>

I understand *what* you are saying - but what is the *advantage* of doing
this? How is it "worth it" for you to go through all the gyrations required
to do dependency injection and forego the use of STATIC DAL etc just so you
can test a business object without having a full DAL.

You have been doing this longer than I, so I'm hoping I can learn this
particular angle from your perspective.

-Jeff
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:11**********************@p10g2000cwp.googlegr oups.com...
Jeff S wrote:
Just wondering if it's standard practice to make DAL classes STATIC (in a
Windows Forms). Doing so would make sense to me because DAL methods are
typically called quite frequently - certainly the case for DAL "Helper"
classes - plus DAL objects/classes generally maintain no state. Seems
like a
good case for STATIC classes to me.


That breaks any idea of using interfaces, however. I tend to use
dependency injection along with interfaces, such that the DAL classes
implement an interfaces and the BOL classes are provided with an
instance of the interface to use. In the production system, those
instances will be instances of the DAL classes. In unit testing,
however, I can provide mock implementations so that I can test my BOL
without needing a full DAL.
It has been recommended to me to put the entire DAL, into a separate
.DLL.
Is that standard practice too?


It depends on the scenario, but it can be useful.

Jon

Feb 27 '06 #4

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

Similar topics

6
by: John Bentley | last post by:
John Bentley writes at this level: If we think about our savings accounts then division never comes in (as far as I can see). We deposit and withdraw exact amounts most of the time. Occasionaly...
76
by: DaKoadMunky | last post by:
After having fancied myself a C++ programmer for the last nine years I figured it was about time that I actually obtain a copy of the standard rather than relying on other sources that claim to...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
13
by: john doe | last post by:
A quick question, about so-called 'best practices', I'm interested in which of A/B of the two examples people would choose, and why. public enum MyEnum { Option1 = 0, Option2 = 1, Option3 =...
2
by: Amelyan | last post by:
Could anyone recommend a book (or a web site) that defines best practices in ASP.NET application development? E.g. 1) Precede your control id's with type of control btnSubmit, txtName, etc. 2)...
10
by: jojobar | last post by:
Hello, I am trying to use vs.net 2005 to migrate a project originally in vs.net 2003. I started with creation of a "web site", and then created folders for each component of the site. I read...
21
by: Kannan | last post by:
Its been a while I have done pure C programming (I was coding in C++). Is the following function valid according to standard C? int main(int argc, char *argv) { int x; x = 9; printf("Value...
7
by: Robert Seacord | last post by:
The CERT/CC has just deployed a new web site dedicated to developing secure coding standards for the C programming language, C++, and eventually other programming language. We have already...
3
by: John Dalberg | last post by:
I am looking for an ASP.NET application on CodePlex which exemplifies best practices for the following: - Use of interfaces - Seperation of the UI, business and data tiers - Data Tier that uses...
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
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...
1
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...
0
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.