Search:
Namespaces
Discussions
.NET v1.1
Feedback
stateless data access layer
Messages
Related Types
This message was discovered on
ASPFriends.com 'aspngarchitecture' list
.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
hemant mehta
Hi All.
If my data access layer is completely stateless (in the sense each class is
nothing but a group of methods where in each method just takes some input
paramters and returns the required values via o/p parameters....there are no
member fields),
does it make sense to mark all the methods as static so that the client
doesn't need to create instance for accesssing the methods???
or is it that even though the class is just a function library , the client
should be calling the methods thru an insatnce???
Don't know what r the pros and cons ???
any inputs would be highly appreciated...
Thanx,
Hemant
----- Original Message -----
From: "Billy Porter" <
Click here to reveal e-mail address
>
To: "aspngarchitecture" <
Click here to reveal e-mail address
>
Sent: Thursday, August 08, 2002 1:42 AM
Subject: [aspngarchitecture] Passing datareaders from one dll to another
> -- Moved from [aspngibuyspy] to [aspngarchitecture] by Yannick Smits
<
Click here to reveal e-mail address
> --
[Original message clipped]
Reply to this message...
James Shaw (VIP)
Definitely make all methods static. Creating instances of those classes is
pointless and wasteful.
James Shaw
http://CoverYourASP.com/
Download it. Run it. Learn it.
http://ASPRSS.com/
Publish ASP with RSS XML
-----Original Message-----
From: hemant mehta [mailto:
Click here to reveal e-mail address
]
Sent: Wednesday, August 14, 2002 7:47 AM
To: aspngarchitecture
Subject: [aspngarchitecture] stateless data access layer
Hi All.
If my data access layer is completely stateless (in the sense each class is
nothing but a group of methods where in each method just takes some input
paramters and returns the required values via o/p parameters....there are no
member fields),
does it make sense to mark all the methods as static so that the client
doesn't need to create instance for accesssing the methods???
or is it that even though the class is just a function library , the client
should be calling the methods thru an insatnce???
Don't know what r the pros and cons ???
any inputs would be highly appreciated...
Thanx,
Hemant
----- Original Message -----
From: "Billy Porter" <
Click here to reveal e-mail address
>
To: "aspngarchitecture" <
Click here to reveal e-mail address
>
Sent: Thursday, August 08, 2002 1:42 AM
Subject: [aspngarchitecture] Passing datareaders from one dll to another
> -- Moved from [aspngibuyspy] to [aspngarchitecture] by Yannick Smits
<
Click here to reveal e-mail address
> --
[Original message clipped]
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
Reply to this message...
Russ McClelland
RGVmaW5pdGVseSBkbyBOT1QgbWFrZSB0aG9zZSBtZXRob2RzIHN0YXRpYy4gIFdoYXQgd291bGQg
aXQgYnV5IHlvdT8gIEENCmNvdXBsZSBvZiBtaWNyby1zZWNvbmRzIHRvIGNyZWF0ZSBhbiBpbnN0
YW5jZSBvZiBhIGNsYXNzIHdpdGggbm8gZGF0YQ0KZWxlbWVudHMgdG8gaW5pdGlhbGl6ZT8gIE1h
eWJlLiAgDQogDQpXaGF0J3MgdGhlIHRyYWRlLW9mZj8gIElmIHlvdSBtYWtlIGFsbCB5b3VyIG1l
dGhvZHMgc3RhdGljLCB5b3UgaGF2ZSB0bw0KZW5zdXJlIHRoYXQgdGhleSBhcmUgdGhyZWFkIHNh
ZmUuICBBZGRpdGlvbmFsbHksIGlmIHlvdSBkbyBtYWtlIHRoZW0NCnRocmVhZCBzYWZlLCB5b3Ug
bm93IGxpbWl0IHNjYWxhYmlsaXR5IGJlY2F1c2UgeW91IGhhdmUgY3JlYXRlZCBhDQoic2luZ2Vs
dG9uIiB0eXBlIHJlc291cmNlIHRvIGFjY2VzcyBkYXRhIGFuZCBvbmx5IG9uZSBjbGllbnQgY2Fu
IHVzZSB0aGUNCm1ldGhvZHMgYXQgYSB0aW1lLg0KIA0KU3RhdGljIG1ldGhvZHMgY2Fubm90IGJl
IHZpcnR1YWwgZWl0aGVyLCBzbyBpZiB5b3Ugd2FudCB0byBmYWN0b3IgY29tbW9uDQpkYXRhIGFj
Y2VzcyBjb2RlIChtb3N0IG9mIHVzIGhhdmUgaW4gb25lIGZvcm0gb3IgYW5vdGhlciBJJ20gc3Vy
ZSkNCnN0YXRpYyBt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2hpdmVzDQoJDQoJDQoJ
fCBbYXNwbmdhcmNoaXRlY3R1cmVdIG1lbWJlciBydXNzLm1jY2xlbGxhbmRAc21hcnRvYmp4LmNv
bSA9DQpZT1VSIElEDQoJfCBodHRwOi8vd3d3LmFzcGxpc3RzLmNvbS9hc3BsaXN0cy9hc3BuZ2Fy
Y2hpdGVjdHVyZS5hc3AgPQ0KSk9JTi9RVUlUDQoJfCBodHRwOi8vd3d3LmFzcGxpc3RzLmNvbS9z
ZWFyY2ggPSBTRUFSQ0ggQXJjaGl2ZXMNCgkNCgkNCg0K
Reply to this message...
James Shaw (VIP)
This is a multi-part message in MIME format.
------=_NextPart_000_0362_01C2437B.F10525C0
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_0363_01C2437B.F10525C0"
------=_NextPart_001_0363_01C2437B.F10525C0
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Isn=E2=80=99t thread safety usually only an issue when an object has =
state? Without state, how can an object be in an invalid state, and =
hence need to worry about thread safety?=20
=20
I admit that I only thought about this issue quickly at the beginning of =
my project, and happily created a few static stateless classes with =
barely a thought to thread safety. I=E2=80=99m very interested to hear =
more about this, because I instinctively thought that methods that (for =
example) simply called a stored procedure to do some work would not be a =
problem.=20
=20
I created static methods not to save the time taken to create an =
instance, but the memory needed. I thought until now that it would be =
MORE scaleable, not less.
=20
Russ, please give an example of how threads can cause problems in =
stateless classes=E2=80=A6
=20
James Shaw
http://CoverYourASP.com/
=20" target="_blank">
http://CoverYourASP.com/
=20
=C2=A0Download it. Run it. Learn it.
http://ASPRSS.com/
=20
=C2=A0Publish ASP with RSS XML
=20
-----Original Message-----
From: Russ McClelland [mailto:
Click here to reveal e-mail address
]
Sent: Wednesday, August 14, 2002 9:44 AM
To: aspngarchitecture
Subject: RE: [aspngarchitecture] RE: stateless data access layer
=20
Definitely do NOT make those methods static. What would it buy you? A =
couple of micro-seconds to create an instance of a class with no data =
elements to initialize? Maybe. =20
=20
What's the trade-off? If you make all your methods static, you have to =
ensure that they are thread safe. Additionally, if you do make them =
thread safe, you now limit scalability because you have created a =
"singelton" type resource to access data and only one client can use the =
methods at a time.
=20
Static methods cannot be virtual either, so if you want to factor common =
data access code (most of us have in one form or another I'm sure) =
static methods will limit the amount and strategies you use to factor =
code.
-----Original Message-----=20
From: James Shaw=20
Sent: Wed 8/14/2002 7:11 AM=20
To: aspngarchitecture=20
Cc:=20
Subject: [aspngarchitecture] RE: stateless data access layer
Definitely make all methods static. Creating instances of those classes =
is
pointless and wasteful.
James Shaw
http://CoverYourASP.com/
Download it. Run it. Learn it.
http://ASPRSS.com/
Publish ASP with RSS XML
-----Original Message-----
From: hemant mehta [ mailto:
Click here to reveal e-mail address
]
Sent: Wednesday, August 14, 2002 7:47 AM
To: aspngarchitecture
Subject: [aspngarchitecture] stateless data access layer
Hi All.
If my data access layer is completely stateless (in the sense each class =
is
nothing but a group of methods where in each method just takes some =
input
paramters and returns the required values via o/p parameters....there =
are no
member fields),
does it make sense to mark all the methods as static so that the client
doesn't need to create instance for accesssing the methods???
or is it that even though the class is just a function library , the =
client
should be calling the methods thru an insatnce???
Don't know what r the pros and cons ???
any inputs would be highly appreciated...
Thanx,
Hemant
----- Original Message -----
From: "Billy Porter" <
Click here to reveal e-mail address
>
To: "aspngarchitecture" <
Click here to reveal e-mail address
>
Sent: Thursday, August 08, 2002 1:42 AM
Subject: [aspngarchitecture] Passing datareaders from one dll to another
> -- Moved from [aspngibuyspy] to [aspngarchitecture] by Yannick Smits
<
Click here to reveal e-mail address
> --
[Original message clipped]
the
> same app-domain. But I would like to know how much the fact that I'm =
using
[Original message clipped]
| [aspngarchitecture] member
Click here to reveal e-mail address
=3D YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
=3D JOIN/QUIT
|
http://www.asplists.com/search
=3D SEARCH Archives
| [aspngarchitecture] member
Click here to reveal e-mail address
=3D YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
=3D JOIN/QUIT
|
http://www.asplists.com/search
=3D SEARCH Archives
------=_NextPart_001_0363_01C2437B.F10525C0
Content-Type: text/html;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"
http://www.w3.org/TR/REC-html40"
;>
<head>
<meta http-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8">
<meta name=3DProgId content=3DWord.Document>
<meta name=3DGenerator content=3D"Microsoft Word 9">
<meta name=3DOriginator content=3D"Microsoft Word 9">
<link rel=3DFile-List href=3D"cid:filelist.xml@01C2437B.F0BB4B80">
<title>[aspngarchitecture] RE: stateless data access layer</title>
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:DoNotRelyOnCSS/>
</o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:Zoom>0</w:Zoom>
<w:DocumentKind>DocumentEmail</w:DocumentKind>
<w:EnvelopeVis/>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:553679495 -2147483648 8 0 66047 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;
text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
{color:blue;
text-decoration:underline;
text-underline:single;}
p.MsoAutoSig, li.MsoAutoSig, div.MsoAutoSig
{margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
p
{margin-right:0in;
mso-margin-top-alt:auto;
mso-margin-bottom-alt:auto;
margin-left:0in;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
span.EmailStyle18
{mso-style-type:personal-reply;
mso-ansi-font-size:10.0pt;
mso-ascii-font-family:Arial;
mso-hansi-font-family:Arial;
mso-bidi-font-family:Arial;
color:navy;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=3DEN-US link=3Dblue vlink=3Dblue style=3D'tab-interval:.5in'>
<div class=3DSection1>
<p class=3DMsoNormal><span class=3DEmailStyle18><font size=3D2 =
color=3Dnavy face=3DArial><span
style=3D'font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'>Is=
n=E2=80=99t
thread safety usually only an issue when an object has state? Without =
state,
how can an object be in an invalid state, and hence need to worry about =
thread
safety? <o:p></o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle18><font size=3D2 =
color=3Dnavy face=3DArial><span
style=3D'font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'><!=
[if =
!supportEmptyParas]> <![endif]><o:p></o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle18><font size=3D2 =
color=3Dnavy face=3DArial><span
style=3D'font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'>I =
admit
that I only thought about this issue quickly at the beginning of my =
project,
and happily created a few static stateless classes with barely a thought =
to
thread safety. I=E2=80=99m very interested to hear more about this, =
because I
instinctively thought that methods that (for example) simply called a =
stored
procedure to do some work would not be a problem. =
<o:p></o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle18><font size=3D2 =
color=3Dnavy face=3DArial><span
style=3D'font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'><!=
[if =
!supportEmptyParas]> <![endif]><o:p></o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle18><font size=3D2 =
color=3Dnavy face=3DArial><span
style=3D'font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'>I =
created
static methods not to save the time taken to create an instance, but the =
memory
needed. I thought until now that it would be MORE scaleable, not =
less.<o:p></o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle18><font size=3D2 =
color=3Dnavy face=3DArial><span
style=3D'font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'><!=
[if =
!supportEmptyParas]> <![endif]><o:p></o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle18><font size=3D2 =
color=3Dnavy face=3DArial><span
style=3D'font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'>Ru=
ss,
please give an example of how threads can cause problems in stateless =
classes=E2=80=A6<o:p></o:p></span></font></span></p>
<p class=3DMsoNormal><span class=3DEmailStyle18><font size=3D2 =
color=3Dnavy face=3DArial><span
style=3D'font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'><!=
[if =
!supportEmptyParas]> <![endif]><o:p></o:p></span></font></span></p>
<p class=3DMsoNormal =
style=3D'mso-layout-grid-align:none;text-autospace:none'><!--[if =
supportFields]><span=20
class=3DEmailStyle18><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'><span =
style=3D'mso-element:
field-begin'></span><span style=3D"mso-spacerun: =
yes">=C2=A0</span>AUTOTEXTLIST \s=20
"E-mail Signature" <span =
style=3D'mso-element:field-separator'></span></span></font></span><![endi=
f]--><font
size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial;
color:navy'>James Shaw</span></font><font size=3D2 color=3Dnavy =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial;color:navy;mso-color-alt:wind=
owtext'><o:p></o:p></span></font></p>
<p class=3DMsoNormal =
style=3D'mso-layout-grid-align:none;text-autospace:none'><font
size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial;
color:navy'><a =
href=3D"
http://coveryourasp.com/"
;>
http://CoverYourASP.com/
</a> =
</span></font><font
size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial;
color:navy;mso-color-alt:windowtext'><o:p></o:p></span></font></p>
<p class=3DMsoNormal =
style=3D'mso-layout-grid-align:none;text-autospace:none'><font
size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial;
color:navy'><span style=3D"mso-spacerun: yes">=C2=A0</span>Download it. =
Run it. Learn
it.</span></font><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy;mso-color-alt:windowtext'><o:p></o:p>=
</span></font></p>
<p class=3DMsoNormal =
style=3D'mso-layout-grid-align:none;text-autospace:none'><font
size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial;
color:navy'><a href=3D"
http://asprss.com/"
;>
http://ASPRSS.com/
</a> =
</span></font><font
size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial;
color:navy;mso-color-alt:windowtext'><o:p></o:p></span></font></p>
<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><span style=3D"mso-spacerun: =
yes">=C2=A0</span>Publish
ASP with RSS XML</span></font><font color=3Dnavy><span =
style=3D'color:navy;
mso-color-alt:windowtext'><o:p></o:p></span></font></p>
<p class=3DMsoNormal><!--[if supportFields]><span =
class=3DEmailStyle18><font=20
size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:Arial'><span =
style=3D'mso-element:field-end'></span></span></font></span><![endif]--><=
span
class=3DEmailStyle18><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;mso-bidi-font-size:12.0pt;font-family:Arial'><![if =
!supportEmptyParas]> <![endif]><o:p></o:p></span></font></span></p>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
color=3Dblack
face=3DTahoma><span =
style=3D'font-size:10.0pt;font-family:Tahoma;color:black'>-----Original
Message-----<br>
<b><span style=3D'font-weight:bold'>From:</span></b> Russ McClelland
[mailto:
Click here to reveal e-mail address
]<br>
<b><span style=3D'font-weight:bold'>Sent:</span></b> Wednesday, August =
14, 2002
9:44 AM<br>
<b><span style=3D'font-weight:bold'>To:</span></b> aspngarchitecture<br>
<b><span style=3D'font-weight:bold'>Subject:</span></b> RE: =
[aspngarchitecture]
RE: stateless data access layer</span></font></p>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'><![if =
!supportEmptyParas]> <![endif]><o:p></o:p></span></font></p>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
color=3Dblack
face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt;color:black'>Definitely do
NOT make those methods static. What would it buy you? A =
couple of
micro-seconds to create an instance of a class with no data elements to
initialize? Maybe. </span></font><font color=3Dblack><span
style=3D'color:black;mso-color-alt:windowtext'><o:p></o:p></span></font><=
/p>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
color=3Dblack
face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt;color:black'> </span></font><font
color=3Dblack><span =
style=3D'color:black;mso-color-alt:windowtext'><o:p></o:p></span></font><=
/p>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
color=3Dblack
face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt;color:black'>What's the
trade-off? If you make all your methods static, you have to ensure =
that
they are thread safe. Additionally, if you do make them thread =
safe, you
now limit scalability because you have created a "singelton"
type resource to access data and only one client can use the =
methods at a
time.</span></font><font color=3Dblack><span =
style=3D'color:black;mso-color-alt:
windowtext'><o:p></o:p></span></font></p>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
color=3Dblack
face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt;color:black'> </span></font><font
color=3Dblack><span =
style=3D'color:black;mso-color-alt:windowtext'><o:p></o:p></span></font><=
/p>
<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
color=3Dblack
face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt;color:black'>Static
methods cannot be virtual either, so if you want to factor common data =
access
code (most of us have in one form or another I'm sure) static methods =
will
limit the amount and strategies you use to factor =
code.</span></font><font
color=3Dblack><span =
style=3D'color:black;mso-color-alt:windowtext'><o:p></o:p></span></font><=
/p>
<p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;margin-bottom:12.0pt;
margin-left:1.0in'><font size=3D2 color=3Dblack face=3D"Times New =
Roman"><span
style=3D'font-size:10.0pt;color:black'>-----Original Message----- <br>
<b><span style=3D'font-weight:bold'>From:</span></b> James Shaw <br>
<b><span style=3D'font-weight:bold'>Sent:</span></b> Wed 8/14/2002 7:11 =
AM <br>
<b><span style=3D'font-weight:bold'>To:</span></b> aspngarchitecture =
<br>
<b><span style=3D'font-weight:bold'>Cc:</span></b> <br>
<b><span style=3D'font-weight:bold'>Subject:</span></b> =
[aspngarchitecture] RE:
stateless data access layer</span></font><font color=3Dblack><span
style=3D'color:black;mso-color-alt:windowtext'><o:p></o:p></span></font><=
/p>
<p style=3D'margin-bottom:12.0pt;margin-left:1.0in'><font size=3D2 =
color=3Dblack
face=3D"Times New Roman"><span =
style=3D'font-size:10.0pt;color:black'>Definitely
make all methods static. Creating instances of those classes is<br>
pointless and wasteful.<br>
<br>
James Shaw<br>
<a href=3D"
http://CoverYourASP.com/
"" target="_blank">
http://CoverYourASP.com/
">
http://CoverYourASP.com/
</a><br>
Download it. Run it. Learn it.<br>
<a href=3D"
http://ASPRSS.com/
">
http://ASPRSS.com/
</a><br>
Publish ASP with RSS XML<br>
<br>
-----Original Message-----<br>
From: hemant mehta [<a =
href=3D"mailto:
Click here to reveal e-mail address
">mailto:
Click here to reveal e-mail address
</a>]<br>
Sent: Wednesday, August 14, 2002 7:47 AM<br>
To: aspngarchitecture<br>
Subject: [aspngarchitecture] stateless data access layer<br>
<br>
Hi All.<br>
<br>
If my data access layer is completely stateless (in the sense each class =
is<br>
nothing but a group of methods where in each method just takes some =
input<br>
paramters and returns the required values via o/p parameters....there =
are no<br>
member fields),<br>
does it make sense to mark all the methods as static so that the =
client<br>
doesn't need to create instance for accesssing the methods???<br>
or is it that even though the class is just a function library , the =
client<br>
should be calling the methods thru an insatnce???<br>
Don't know what r the pros and cons ???<br>
<br>
any inputs would be highly appreciated...<br>
<br>
Thanx,<br>
Hemant<br>
----- Original Message -----<br>
From: "Billy Porter" <
Click here to reveal e-mail address
><br>
To: "aspngarchitecture" =
<
Click here to reveal e-mail address
><br>
Sent: Thursday, August 08, 2002 1:42 AM<br>
Subject: [aspngarchitecture] Passing datareaders from one dll to =
another<br>
<br>
<br>
> -- Moved from [aspngibuyspy] to [aspngarchitecture] by Yannick =
Smits<br>
<
Click here to reveal e-mail address
> --<br>
><br>
> Greetings,<br>
><br>
> BACKGROUND:<br>
> In my VS.NET solution, I got a ASP.NET Web Application (lets call =
it<br>
WebApp)<br>
> and a Class Library (ClassLib). In the WebApp, I have added a =
reference to<br>
> the ClassLib. My idea with the ClassLib was that it would be nice =
to have<br>
> the core logic separated from the WebApp as I might need to access =
this<br>
> logic from a Windows Form project later on.<br>
> As I compile my solution, both the WebApp dll and the ClassLib dll =
is<br>
placed<br>
> in the \bin directory of the WebApp. So they will definitely run =
within<br>
the<br>
> same app-domain. But I would like to know how much the fact that =
I'm using<br>
> two dlls changes things.<br>
><br>
> NOTE:<br>
> There are many methods inside my ClassLib classes that returns<br>
> SqlDataReaders (this logic is copied from IBuySpy).<br>
><br>
> QUESTION:<br>
> Will I loose the performance gain of my methods returning data =
readers<br>
since<br>
> I'm not passing them within the same dll?<br>
><br>
> --<br>
><br>
> Thanks<br>
><br>
> /Billy<br>
> | [aspngarchitecture] member
Click here to reveal e-mail address
=3D YOUR ID<br>
> | <a =
href=3D"
http://www.asplists.com/asplists/aspngarchitecture.asp
"" target="_blank">
http://www.asplists.com/asplists/aspngarchitecture.asp
">
http://ww=
w.asplists.com/asplists/aspngarchitecture.asp</a>
=3D JOIN/QUIT<br>
> | <a =
href=3D"
http://www.asplists.com/search
"" target="_blank">
http://www.asplists.com/search
">
http://www.asplists.com/search
</a=
>
=3D SEARCH Archives<br>
><br>
><br>
<br>
<br>
<br>
| [aspngarchitecture] member
Click here to reveal e-mail address
=3D YOUR ID<br>
| <a =
href=3D"
http://www.asplists.com/asplists/aspngarchitecture.asp
"" target="_blank">
http://www.asplists.com/asplists/aspngarchitecture.asp
">
http://ww=
w.asplists.com/asplists/aspngarchitecture.asp</a>
=3D JOIN/QUIT<br>
| <a =
href=3D"
http://www.asplists.com/search
"" target="_blank">
http://www.asplists.com/search
">
http://www.asplists.com/search
</a=
> =3D
SEARCH Archives<br>
<br>
<br>
| [aspngarchitecture] member
Click here to reveal e-mail address
=3D YOUR =
ID<br>
| <a =
href=3D"
http://www.asplists.com/asplists/aspngarchitecture.asp
"" target="_blank">
http://www.asplists.com/asplists/aspngarchitecture.asp
">
http://ww=
w.asplists.com/asplists/aspngarchitecture.asp</a>
=3D JOIN/QUIT<br>
| <a =
href=3D"
http://www.asplists.com/search
"" target="_blank">
http://www.asplists.com/search
">
http://www.asplists.com/search
</a=
> =3D
SEARCH Archives</span></font><font color=3Dblack><span =
style=3D'color:black;
mso-color-alt:windowtext'><o:p></o:p></span></font></p>
</div>
</body>
</html>
------=_NextPart_001_0363_01C2437B.F10525C0--
------=_NextPart_000_0362_01C2437B.F10525C0
Content-Type: application/ms-tnef;
name="winmail.dat"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="winmail.dat"
eJ8+IiAOAQaQCAAEAAAAAAABAA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AAACAfgPAQAAABAAAAATa9vsHVDxTaa/lKFkYM33AgH6DwEAAAAQ
AAAAE2vb7B1Q8U2mv5ShZGDN9wIB+w8BAAAATgAAAAAAAAA4obsQBeUQGqG7CAArKlbCAABQU1RQ
UlguRExMAAAAAAAAAABOSVRB+b+4AQCqADfZbgAAAEU6XEVtYWlsXG91dGxvb2sucHN0AAAAAwD+
DwUAAAADAA00/TcAAAIBfwABAAAANAAAADxQQkVOS0dMUElITUtMUElNTkFLSEFFRklHSkFBLmou
c2hhd0BzaGF3dGhpbmcuY29tPgBIrA==
------=_NextPart_000_0362_01C2437B.F10525C0--
Reply to this message...
Brian Espey
I agree that if you need to subclass in the future,
then you obviously can't use static methods if you
want polymorphic behavior, but absent that, I would
argue these methods should be static. He stated that
his objects are stateless, which suggests that his
methods are going to be inherently thread safe (it
sounds like everything he needs is passed in as a
parameter to his methods). Even if there is some
shared lookup table or something, that could be stored
as a private static member variable, that you either
initialize in the static constructor or wait until it
is needed to load, and just lock it with a mutex at
that point.
the value in making methods static isn't that it saves
you a few nanoseconds; instead it's that it
communicates more clearly the intended purpose. it
sounds like he's really just exposing some data access
services. why do you need an object instance to use
this service? requiring an instance suggests that the
instance has a unique "identity" and is somehow
different from other instances of the class, which
doesn't seem to be the case here.
Brian
--- Russ McClelland <
Click here to reveal e-mail address
>
wrote:
[Original message clipped]
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
Reply to this message...
jimmy.nilsson@jnsk.se (Jimmy Nilsson)
[aspngarchitecture] RE: stateless data access layerI'm a fan of using static methods, in situations when you don't have any instance state. I like to see it semantically. If it's natural with instance state, use instance state and ordinary methods. If not, use static methods.
If you don't have static state that is affected by the static methods, you don't have created a thread problem for you. And the "singleton" Russ mentioned won't automatically create blocking so I don't see the scalability problem there.
On the other hand, I agree with Russ about the problem that you can't override static methods. Another problem is that a static method can't be an endpoint for remoting.
Best Regards,
Jimmy
###
----- Original Message -----
From: James Shaw
To: aspngarchitecture
Sent: Wednesday, August 14, 2002 4:18 PM
Subject: [aspngarchitecture] RE: stateless data access layer
Isnât thread safety usually only an issue when an object has state? Without state, how can an object be in an invalid state, and hence need to worry about thread safety?
I admit that I only thought about this issue quickly at the beginning of my project, and happily created a few static stateless classes with barely a thought to thread safety. Iâm very interested to hear more about this, because I instinctively thought that methods that (for example) simply called a stored procedure to do some work would not be a problem.
I created static methods not to save the time taken to create an instance, but the memory needed. I thought until now that it would be MORE scaleable, not less.
Russ, please give an example of how threads can cause problems in stateless classesâ¦
James Shaw
http://CoverYourASP.com/
Download it. Run it. Learn it.
http://ASPRSS.com/
Publish ASP with RSS XML
-----Original Message-----
From: Russ McClelland [mailto:
Click here to reveal e-mail address
]
Sent: Wednesday, August 14, 2002 9:44 AM
To: aspngarchitecture
Subject: RE: [aspngarchitecture] RE: stateless data access layer
Definitely do NOT make those methods static. What would it buy you? A couple of micro-seconds to create an instance of a class with no data elements to initialize? Maybe.
What's the trade-off? If you make all your methods static, you have to ensure that they are thread safe. Additionally, if you do make them thread safe, you now limit scalability because you have created a "singelton" type resource to access data and only one client can use the methods at a time.
Static methods cannot be virtual either, so if you want to factor common data access code (most of us have in one form or another I'm sure) static methods will limit the amount and strategies you use to factor code.
-----Original Message-----
From: James Shaw
Sent: Wed 8/14/2002 7:11 AM
To: aspngarchitecture
Cc:
Subject: [aspngarchitecture] RE: stateless data access layer
Definitely make all methods static. Creating instances of those classes is
pointless and wasteful.
James Shaw
http://CoverYourASP.com/
Download it. Run it. Learn it.
http://ASPRSS.com/
Publish ASP with RSS XML
-----Original Message-----
From: hemant mehta [mailto:
Click here to reveal e-mail address
]
Sent: Wednesday, August 14, 2002 7:47 AM
To: aspngarchitecture
Subject: [aspngarchitecture] stateless data access layer
Hi All.
If my data access layer is completely stateless (in the sense each class is
nothing but a group of methods where in each method just takes some input
paramters and returns the required values via o/p parameters....there are no
member fields),
does it make sense to mark all the methods as static so that the client
doesn't need to create instance for accesssing the methods???
or is it that even though the class is just a function library , the client
should be calling the methods thru an insatnce???
Don't know what r the pros and cons ???
any inputs would be highly appreciated...
Thanx,
Hemant
----- Original Message -----
From: "Billy Porter" <
Click here to reveal e-mail address
>
To: "aspngarchitecture" <
Click here to reveal e-mail address
>
Sent: Thursday, August 08, 2002 1:42 AM
Subject: [aspngarchitecture] Passing datareaders from one dll to another
> -- Moved from [aspngibuyspy] to [aspngarchitecture] by Yannick Smits
<
Click here to reveal e-mail address
> --
[Original message clipped]
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
------------------------------------------------------------------------------
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
Reply to this message...
RRamirez@belcorporation.com
Microsoft uses static methods in his Data Access Application Block for =
.net
http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/dnbd=
a/html/daab-rm.asp
Rolando
Click here to reveal e-mail address
Click here to reveal e-mail address
BELCORP Peru
http://www.ebelinternational.com
Life after Napster =3D>
http://www.winmx.com
,
http://www.trippymx.co.u=
k
=
=20
jimmy.nilsson =
=20
@jnsk.se Para: "aspngarchitecture" <a=
Click here to reveal e-mail address
> =20
(Jimmy cc: =
=20
Nilsson) Asunto: [aspngarchitectur=
e] RE: stateless data access layer =20
=
=20
14/08/2002 =
=20
09:33 =
=20
Por favor, =
=20
responda a =
=20
"aspngarchite =
=20
cture" =
=20
=
=20
=
=20
I'm a fan of using static methods, in situations when you don't have an=
y
instance state. I like to see it semantically. If it's natural with
instance state, use instance state and ordinary methods. If not, use st=
atic
methods.
If you don't have static state that is affected by the static methods, =
you
don't have created a thread problem for you. And the "singleton" Russ
mentioned won't automatically create blocking so I don't see the
scalability problem there.
On the other hand, I agree with Russ about the problem that you can't
override static methods. Another problem is that a static method can't =
be
an endpoint for remoting.
Best Regards,
Jimmy
###
----- Original Message -----
From: James Shaw
To: aspngarchitecture
Sent: Wednesday, August 14, 2002 4:18 PM
Subject: [aspngarchitecture] RE: stateless data access layer
Isn't thread safety usually only an issue when an object has state?
Without state, how can an object be in an invalid state, and hence nee=
d to
worry about thread safety?
I admit that I only thought about this issue quickly at the beginning =
of
my project, and happily created a few static stateless classes with ba=
rely
a thought to thread safety. I'm very interested to hear more about thi=
s,
because I instinctively thought that methods that (for example) simply=
called a stored procedure to do some work would not be a problem.
I created static methods not to save the time taken to create an insta=
nce,
but the memory needed. I thought until now that it would be MORE
scaleable, not less.
Russ, please give an example of how threads can cause problems in
stateless classes?
James Shaw
http://CoverYourASP.com/
Download it. Run it. Learn it.
http://ASPRSS.com/
Publish ASP with RSS XML
-----Original Message-----
From: Russ McClelland [mailto:
Click here to reveal e-mail address
]
Sent: Wednesday, August 14, 2002 9:44 AM
To: aspngarchitecture
Subject: RE: [aspngarchitecture] RE: stateless data access layer
Definitely do NOT make those methods static. What would it buy y=
ou?
A couple of micro-seconds to create an instance of a class with n=
o
data elements to initialize? Maybe.
What's the trade-off? If you make all your methods static, you h=
ave
to ensure that they are thread safe. Additionally, if you do mak=
e
them thread safe, you now limit scalability because you have crea=
ted
a "singelton" type resource to access data and only one client ca=
n
use the methods at a time.
Static methods cannot be virtual either, so if you want to factor=
common data access code (most of us have in one form or another I=
'm
sure) static methods will limit the amount and strategies you use=
to
factor code.
-----Original Message-----
From: James Shaw
Sent: Wed 8/14/2002 7:11 AM
To: aspngarchitecture
Cc:
Subject: [aspngarchitecture] RE: stateless data access layer=
Definitely make all methods static. Creating instances of th=
ose
classes is
pointless and wasteful.
James Shaw
http://CoverYourASP.com/
Download it. Run it. Learn it.
http://ASPRSS.com/
Publish ASP with RSS XML
-----Original Message-----
From: hemant mehta [mailto:
Click here to reveal e-mail address
]
Sent: Wednesday, August 14, 2002 7:47 AM
To: aspngarchitecture
Subject: [aspngarchitecture] stateless data access layer
Hi All.
If my data access layer is completely stateless (in the sens=
e
each class is
nothing but a group of methods where in each method just tak=
es
some input
paramters and returns the required values via o/p
parameters....there are no
member fields),
does it make sense to mark all the methods as static so that=
the
client
doesn't need to create instance for accesssing the methods??=
?
or is it that even though the class is just a function libra=
ry ,
the client
should be calling the methods thru an insatnce???
Don't know what r the pros and cons ???
any inputs would be highly appreciated...
Thanx,
Hemant
----- Original Message -----
From: "Billy Porter" <
Click here to reveal e-mail address
>
To: "aspngarchitecture" <
Click here to reveal e-mail address
>
Sent: Thursday, August 08, 2002 1:42 AM
Subject: [aspngarchitecture] Passing datareaders from one dl=
l to
another
> -- Moved from [aspngibuyspy] to [aspngarchitecture] by Yan=
nick
Smits
<
Click here to reveal e-mail address
> --
[Original message clipped]
call it
WebApp)
> and a Class Library (ClassLib). In the WebApp, I have adde=
d a
reference to
> the ClassLib. My idea with the ClassLib was that it would =
be
nice to have
> the core logic separated from the WebApp as I might need t=
o
access this
[Original message clipped]
dll is
placed
> in the \bin directory of the WebApp. So they will definite=
ly
run within
the
> same app-domain. But I would like to know how much the fac=
t
that I'm using
[Original message clipped]
readers
since
[Original message clipped]
JOIN/QUIT
[Original message clipped]
| [aspngarchitecture] member
Click here to reveal e-mail address
=3D YOUR I=
D
|
http://www.asplists.com/asplists/aspngarchitecture.asp
=3D=
JOIN/QUIT
|
http://www.asplists.com/search
=3D SEARCH Archives
| [aspngarchitecture] member
Click here to reveal e-mail address
=3D=
YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
=3D=
JOIN/QUIT
|
http://www.asplists.com/search
=3D SEARCH Archives
| [aspngarchitecture] member
Click here to reveal e-mail address
=3D YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
=3D JOIN/QUIT=
|
http://www.asplists.com/search
=3D SEARCH Archives
| [aspngarchitecture] member
Click here to reveal e-mail address
=3D YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
=3D JOIN/QUIT
|
http://www.asplists.com/search
=3D SEARCH Archives
=
Reply to this message...
Martin Garins
I would like to add on to this question.
Would one choice change if you were to put this assembly into COM+?
I don't want to get into the pros and cons of using COM+. Just how using
COM+ would change ones decision to mark the methods as STATIC or not.
Thanks,
Martin Garins
-----Original Message-----
From: Brian Espey [mailto:
Click here to reveal e-mail address
]=20
Sent: Wednesday, August 14, 2002 9:23 AM
To: aspngarchitecture
Subject: [aspngarchitecture] RE: stateless data access layer
I agree that if you need to subclass in the future,
then you obviously can't use static methods if you
want polymorphic behavior, but absent that, I would
argue these methods should be static. He stated that
his objects are stateless, which suggests that his
methods are going to be inherently thread safe (it
sounds like everything he needs is passed in as a
parameter to his methods). Even if there is some
shared lookup table or something, that could be stored
as a private static member variable, that you either
initialize in the static constructor or wait until it
is needed to load, and just lock it with a mutex at
that point. =20
the value in making methods static isn't that it saves
you a few nanoseconds; instead it's that it
communicates more clearly the intended purpose. it
sounds like he's really just exposing some data access services. why do
you need an object instance to use this service? requiring an instance
suggests that the instance has a unique "identity" and is somehow
different from other instances of the class, which doesn't seem to be
the case here.
Brian
=20
--- Russ McClelland <
Click here to reveal e-mail address
>
wrote:
[Original message clipped]
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
| [aspngarchitecture] member
Click here to reveal e-mail address
=3D YOUR ID=20
|
http://www.asplists.com/asplists/aspngarchitecture.asp
=3D JOIN/QUIT=20
|
http://www.asplists.com/search
=3D SEARCH Archives
Reply to this message...
dave wanta (VIP)
[aspngarchitecture] RE: stateless data access layerI'm having a hard time wrapping my mind around this concept. Although I can accept that a static method (without the need for state ) will be faster. But let's take this data access method. With a static method, only 1 instance of it exists. So if only 1 instance exists, then aren't all calls made to that instance serializing? What am i missing here..?
If I have a static method called GetDataTable(string sqlQuery ) and lets say it take 5min to process that query, is that thread blocked for 5min until that query is done executing? surely not?!? Then how do static methods really work, if there is only 1 instance of them?
Thanks,
Dave
----- Original Message -----
From: James Shaw
To: aspngarchitecture
Sent: Wednesday, August 14, 2002 9:18 AM
Subject: [aspngarchitecture] RE: stateless data access layer
Isnât thread safety usually only an issue when an object has state? Without state, how can an object be in an invalid state, and hence need to worry about thread safety?
I admit that I only thought about this issue quickly at the beginning of my project, and happily created a few static stateless classes with barely a thought to thread safety. Iâm very interested to hear more about this, because I instinctively thought that methods that (for example) simply called a stored procedure to do some work would not be a problem.
I created static methods not to save the time taken to create an instance, but the memory needed. I thought until now that it would be MORE scaleable, not less.
Russ, please give an example of how threads can cause problems in stateless classesâ¦
James Shaw
http://CoverYourASP.com/
Download it. Run it. Learn it.
http://ASPRSS.com/
Publish ASP with RSS XML
-----Original Message-----
From: Russ McClelland [mailto:
Click here to reveal e-mail address
]
Sent: Wednesday, August 14, 2002 9:44 AM
To: aspngarchitecture
Subject: RE: [aspngarchitecture] RE: stateless data access layer
Definitely do NOT make those methods static. What would it buy you? A couple of micro-seconds to create an instance of a class with no data elements to initialize? Maybe.
What's the trade-off? If you make all your methods static, you have to ensure that they are thread safe. Additionally, if you do make them thread safe, you now limit scalability because you have created a "singelton" type resource to access data and only one client can use the methods at a time.
Static methods cannot be virtual either, so if you want to factor common data access code (most of us have in one form or another I'm sure) static methods will limit the amount and strategies you use to factor code.
-----Original Message-----
From: James Shaw
Sent: Wed 8/14/2002 7:11 AM
To: aspngarchitecture
Cc:
Subject: [aspngarchitecture] RE: stateless data access layer
Definitely make all methods static. Creating instances of those classes is
pointless and wasteful.
James Shaw
http://CoverYourASP.com/
Download it. Run it. Learn it.
http://ASPRSS.com/
Publish ASP with RSS XML
-----Original Message-----
From: hemant mehta [mailto:
Click here to reveal e-mail address
]
Sent: Wednesday, August 14, 2002 7:47 AM
To: aspngarchitecture
Subject: [aspngarchitecture] stateless data access layer
Hi All.
If my data access layer is completely stateless (in the sense each class is
nothing but a group of methods where in each method just takes some input
paramters and returns the required values via o/p parameters....there are no
member fields),
does it make sense to mark all the methods as static so that the client
doesn't need to create instance for accesssing the methods???
or is it that even though the class is just a function library , the client
should be calling the methods thru an insatnce???
Don't know what r the pros and cons ???
any inputs would be highly appreciated...
Thanx,
Hemant
----- Original Message -----
From: "Billy Porter" <
Click here to reveal e-mail address
>
To: "aspngarchitecture" <
Click here to reveal e-mail address
>
Sent: Thursday, August 08, 2002 1:42 AM
Subject: [aspngarchitecture] Passing datareaders from one dll to another
> -- Moved from [aspngibuyspy] to [aspngarchitecture] by Yannick Smits
<
Click here to reveal e-mail address
> --
[Original message clipped]
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
------------------------------------------------------------------------------
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
Reply to this message...
Steven A Smith (VIP)
[aspngarchitecture] RE: stateless data access layerNo, they are not serialized. I have a simple command line example that Mac Kloberg and I came up with about a year ago that demonstrates this if you'd like to see for yourself. Basically, the method is just a series of instructions in memory somewhere, and the parameters are on the stack. There's no reason why several threads can't be going through the same series of instructions in the same memory block each with their own values on the stack.
Steve
----- Original Message -----
From: dave wanta
To: aspngarchitecture
Sent: Saturday, August 17, 2002 10:49 PM
Subject: [aspngarchitecture] RE: stateless data access layer
I'm having a hard time wrapping my mind around this concept. Although I can accept that a static method (without the need for state ) will be faster. But let's take this data access method. With a static method, only 1 instance of it exists. So if only 1 instance exists, then aren't all calls made to that instance serializing? What am i missing here..?
If I have a static method called GetDataTable(string sqlQuery ) and lets say it take 5min to process that query, is that thread blocked for 5min until that query is done executing? surely not?!? Then how do static methods really work, if there is only 1 instance of them?
Thanks,
Dave
----- Original Message -----
From: James Shaw
To: aspngarchitecture
Sent: Wednesday, August 14, 2002 9:18 AM
Subject: [aspngarchitecture] RE: stateless data access layer
Isnât thread safety usually only an issue when an object has state? Without state, how can an object be in an invalid state, and hence need to worry about thread safety?
I admit that I only thought about this issue quickly at the beginning of my project, and happily created a few static stateless classes with barely a thought to thread safety. Iâm very interested to hear more about this, because I instinctively thought that methods that (for example) simply called a stored procedure to do some work would not be a problem.
I created static methods not to save the time taken to create an instance, but the memory needed. I thought until now that it would be MORE scaleable, not less.
Russ, please give an example of how threads can cause problems in stateless classesâ¦
James Shaw
http://CoverYourASP.com/
Download it. Run it. Learn it.
http://ASPRSS.com/
Publish ASP with RSS XML
-----Original Message-----
From: Russ McClelland [mailto:
Click here to reveal e-mail address
]
Sent: Wednesday, August 14, 2002 9:44 AM
To: aspngarchitecture
Subject: RE: [aspngarchitecture] RE: stateless data access layer
Definitely do NOT make those methods static. What would it buy you? A couple of micro-seconds to create an instance of a class with no data elements to initialize? Maybe.
What's the trade-off? If you make all your methods static, you have to ensure that they are thread safe. Additionally, if you do make them thread safe, you now limit scalability because you have created a "singelton" type resource to access data and only one client can use the methods at a time.
Static methods cannot be virtual either, so if you want to factor common data access code (most of us have in one form or another I'm sure) static methods will limit the amount and strategies you use to factor code.
-----Original Message-----
From: James Shaw
Sent: Wed 8/14/2002 7:11 AM
To: aspngarchitecture
Cc:
Subject: [aspngarchitecture] RE: stateless data access layer
Definitely make all methods static. Creating instances of those classes is
pointless and wasteful.
James Shaw
http://CoverYourASP.com/
Download it. Run it. Learn it.
http://ASPRSS.com/
Publish ASP with RSS XML
-----Original Message-----
From: hemant mehta [mailto:
Click here to reveal e-mail address
]
Sent: Wednesday, August 14, 2002 7:47 AM
To: aspngarchitecture
Subject: [aspngarchitecture] stateless data access layer
Hi All.
If my data access layer is completely stateless (in the sense each class is
nothing but a group of methods where in each method just takes some input
paramters and returns the required values via o/p parameters....there are no
member fields),
does it make sense to mark all the methods as static so that the client
doesn't need to create instance for accesssing the methods???
or is it that even though the class is just a function library , the client
should be calling the methods thru an insatnce???
Don't know what r the pros and cons ???
any inputs would be highly appreciated...
Thanx,
Hemant
----- Original Message -----
From: "Billy Porter" <
Click here to reveal e-mail address
>
To: "aspngarchitecture" <
Click here to reveal e-mail address
>
Sent: Thursday, August 08, 2002 1:42 AM
Subject: [aspngarchitecture] Passing datareaders from one dll to another
> -- Moved from [aspngibuyspy] to [aspngarchitecture] by Yannick Smits
<
Click here to reveal e-mail address
> --
[Original message clipped]
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
----------------------------------------------------------------------------
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
Reply to this message...
Steven A Smith (VIP)
[aspngarchitecture] RE: stateless data access layerActually, it was Mitch Denny who wrote the code, and I put it online at
http://www.aspalliance.com/stevesmith/articles/staticthreads.asp
:)
Forgot about that.
Steve
----- Original Message -----
From: Steven A Smith
To: aspngarchitecture
Sent: Sunday, August 18, 2002 12:36 PM
Subject: [aspngarchitecture] RE: stateless data access layer
No, they are not serialized. I have a simple command line example that Mac Kloberg and I came up with about a year ago that demonstrates this if you'd like to see for yourself. Basically, the method is just a series of instructions in memory somewhere, and the parameters are on the stack. There's no reason why several threads can't be going through the same series of instructions in the same memory block each with their own values on the stack.
Steve
----- Original Message -----
From: dave wanta
To: aspngarchitecture
Sent: Saturday, August 17, 2002 10:49 PM
Subject: [aspngarchitecture] RE: stateless data access layer
I'm having a hard time wrapping my mind around this concept. Although I can accept that a static method (without the need for state ) will be faster. But let's take this data access method. With a static method, only 1 instance of it exists. So if only 1 instance exists, then aren't all calls made to that instance serializing? What am i missing here..?
If I have a static method called GetDataTable(string sqlQuery ) and lets say it take 5min to process that query, is that thread blocked for 5min until that query is done executing? surely not?!? Then how do static methods really work, if there is only 1 instance of them?
Thanks,
Dave
----- Original Message -----
From: James Shaw
To: aspngarchitecture
Sent: Wednesday, August 14, 2002 9:18 AM
Subject: [aspngarchitecture] RE: stateless data access layer
Isnât thread safety usually only an issue when an object has state? Without state, how can an object be in an invalid state, and hence need to worry about thread safety?
I admit that I only thought about this issue quickly at the beginning of my project, and happily created a few static stateless classes with barely a thought to thread safety. Iâm very interested to hear more about this, because I instinctively thought that methods that (for example) simply called a stored procedure to do some work would not be a problem.
I created static methods not to save the time taken to create an instance, but the memory needed. I thought until now that it would be MORE scaleable, not less.
Russ, please give an example of how threads can cause problems in stateless classesâ¦
James Shaw
http://CoverYourASP.com/
Download it. Run it. Learn it.
http://ASPRSS.com/
Publish ASP with RSS XML
-----Original Message-----
From: Russ McClelland [mailto:
Click here to reveal e-mail address
]
Sent: Wednesday, August 14, 2002 9:44 AM
To: aspngarchitecture
Subject: RE: [aspngarchitecture] RE: stateless data access layer
Definitely do NOT make those methods static. What would it buy you? A couple of micro-seconds to create an instance of a class with no data elements to initialize? Maybe.
What's the trade-off? If you make all your methods static, you have to ensure that they are thread safe. Additionally, if you do make them thread safe, you now limit scalability because you have created a "singelton" type resource to access data and only one client can use the methods at a time.
Static methods cannot be virtual either, so if you want to factor common data access code (most of us have in one form or another I'm sure) static methods will limit the amount and strategies you use to factor code.
-----Original Message-----
From: James Shaw
Sent: Wed 8/14/2002 7:11 AM
To: aspngarchitecture
Cc:
Subject: [aspngarchitecture] RE: stateless data access layer
Definitely make all methods static. Creating instances of those classes is
pointless and wasteful.
James Shaw
http://CoverYourASP.com/
Download it. Run it. Learn it.
http://ASPRSS.com/
Publish ASP with RSS XML
-----Original Message-----
From: hemant mehta [mailto:
Click here to reveal e-mail address
]
Sent: Wednesday, August 14, 2002 7:47 AM
To: aspngarchitecture
Subject: [aspngarchitecture] stateless data access layer
Hi All.
If my data access layer is completely stateless (in the sense each class is
nothing but a group of methods where in each method just takes some input
paramters and returns the required values via o/p parameters....there are no
member fields),
does it make sense to mark all the methods as static so that the client
doesn't need to create instance for accesssing the methods???
or is it that even though the class is just a function library , the client
should be calling the methods thru an insatnce???
Don't know what r the pros and cons ???
any inputs would be highly appreciated...
Thanx,
Hemant
----- Original Message -----
From: "Billy Porter" <
Click here to reveal e-mail address
>
To: "aspngarchitecture" <
Click here to reveal e-mail address
>
Sent: Thursday, August 08, 2002 1:42 AM
Subject: [aspngarchitecture] Passing datareaders from one dll to another
> -- Moved from [aspngibuyspy] to [aspngarchitecture] by Yannick Smits
<
Click here to reveal e-mail address
> --
[Original message clipped]
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
--------------------------------------------------------------------------
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
Reply to this message...
Bryan Costanich
Remember, the only difference between a static and an instance method is
that with an instance method there is a hidden parameter that passes a
reference to the object. Calls are not serialized either way.
-----Original Message-----
From: Steven A Smith [mailto:
Click here to reveal e-mail address
]
Sent: Sunday, August 18, 2002 12:37 PM
To: aspngarchitecture
Subject: [aspngarchitecture] RE: stateless data access layer
Actually, it was Mitch Denny who wrote the code, and I put it online at
http://www.aspalliance.com/stevesmith/articles/staticthreads.asp
<
http://www.aspalliance.com/stevesmith/articles/staticthreads.asp
>
:)
Forgot about that.
Steve
----- Original Message -----
From: Steven A <mailto:
Click here to reveal e-mail address
> Smith
To: aspngarchitecture <mailto:
Click here to reveal e-mail address
>
Sent: Sunday, August 18, 2002 12:36 PM
Subject: [aspngarchitecture] RE: stateless data access layer
No, they are not serialized. I have a simple command line example that Mac
Kloberg and I came up with about a year ago that demonstrates this if you'd
like to see for yourself. Basically, the method is just a series of
instructions in memory somewhere, and the parameters are on the stack.
There's no reason why several threads can't be going through the same series
of instructions in the same memory block each with their own values on the
stack.
Steve
----- Original Message -----
From: dave wanta <mailto:
Click here to reveal e-mail address
>
To: aspngarchitecture <mailto:
Click here to reveal e-mail address
>
Sent: Saturday, August 17, 2002 10:49 PM
Subject: [aspngarchitecture] RE: stateless data access layer
I'm having a hard time wrapping my mind around this concept. Although I can
accept that a static method (without the need for state ) will be faster.
But let's take this data access method. With a static method, only 1
instance of it exists. So if only 1 instance exists, then aren't all calls
made to that instance serializing? What am i missing here..?
If I have a static method called GetDataTable(string sqlQuery ) and lets
say it take 5min to process that query, is that thread blocked for 5min
until that query is done executing? surely not?!? Then how do static
methods really work, if there is only 1 instance of them?
Thanks,
Dave
----- Original Message -----
From: James Shaw <mailto:
Click here to reveal e-mail address
>
To: aspngarchitecture <mailto:
Click here to reveal e-mail address
>
Sent: Wednesday, August 14, 2002 9:18 AM
Subject: [aspngarchitecture] RE: stateless data access layer
Isn't thread safety usually only an issue when an object has state? Without
state, how can an object be in an invalid state, and hence need to worry
about thread safety?
I admit that I only thought about this issue quickly at the beginning of my
project, and happily created a few static stateless classes with barely a
thought to thread safety. I'm very interested to hear more about this,
because I instinctively thought that methods that (for example) simply
called a stored procedure to do some work would not be a problem.
I created static methods not to save the time taken to create an instance,
but the memory needed. I thought until now that it would be MORE scaleable,
not less.
Russ, please give an example of how threads can cause problems in stateless
classes...
James Shaw
http://CoverYourASP.com/
<
http://coveryourasp.com/
>
Download it. Run it. Learn it.
http://ASPRSS.com/
<
http://asprss.com/
>
Publish ASP with RSS XML
-----Original Message-----
From: Russ McClelland [mailto:
Click here to reveal e-mail address
]
Sent: Wednesday, August 14, 2002 9:44 AM
To: aspngarchitecture
Subject: RE: [aspngarchitecture] RE: stateless data access layer
Definitely do NOT make those methods static. What would it buy you? A
couple of micro-seconds to create an instance of a class with no data
elements to initialize? Maybe.
What's the trade-off? If you make all your methods static, you have to
ensure that they are thread safe. Additionally, if you do make them thread
safe, you now limit scalability because you have created a "singelton" type
resource to access data and only one client can use the methods at a time.
Static methods cannot be virtual either, so if you want to factor common
data access code (most of us have in one form or another I'm sure) static
methods will limit the amount and strategies you use to factor code.
-----Original Message-----
From: James Shaw
Sent: Wed 8/14/2002 7:11 AM
To: aspngarchitecture
Cc:
Subject: [aspngarchitecture] RE: stateless data access layer
Definitely make all methods static. Creating instances of those classes is
pointless and wasteful.
James Shaw
http://CoverYourASP.com/
<
http://CoverYourASP.com/
>
Download it. Run it. Learn it.
http://ASPRSS.com/
<
http://ASPRSS.com/
>
Publish ASP with RSS XML
-----Original Message-----
From: hemant mehta [mailto:
Click here to reveal e-mail address
<mailto:
Click here to reveal e-mail address
> ]
Sent: Wednesday, August 14, 2002 7:47 AM
To: aspngarchitecture
Subject: [aspngarchitecture] stateless data access layer
Hi All.
If my data access layer is completely stateless (in the sense each class is
nothing but a group of methods where in each method just takes some input
paramters and returns the required values via o/p parameters....there are no
member fields),
does it make sense to mark all the methods as static so that the client
doesn't need to create instance for accesssing the methods???
or is it that even though the class is just a function library , the client
should be calling the methods thru an insatnce???
Don't know what r the pros and cons ???
any inputs would be highly appreciated...
Thanx,
Hemant
----- Original Message -----
From: "Billy Porter" <
Click here to reveal e-mail address
>
To: "aspngarchitecture" <
Click here to reveal e-mail address
>
Sent: Thursday, August 08, 2002 1:42 AM
Subject: [aspngarchitecture] Passing datareaders from one dll to another
> -- Moved from [aspngibuyspy] to [aspngarchitecture] by Yannick Smits
<
Click here to reveal e-mail address
> --
[Original message clipped]
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
<
http://www.asplists.com/asplists/aspngarchitecture.asp
> = JOIN/QUIT
|
http://www.asplists.com/search
<
http://www.asplists.com/search
> = SEARCH
Archives
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
<
http://www.asplists.com/asplists/aspngarchitecture.asp
> = JOIN/QUIT
|
http://www.asplists.com/search
<
http://www.asplists.com/search
> = SEARCH
Archives
_____
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
| [aspngarchitecture] member
Click here to reveal e-mail address
= YOUR ID
|
http://www.asplists.com/asplists/aspngarchitecture.asp
= JOIN/QUIT
|
http://www.asplists.com/search
= SEARCH Archives
Reply to this message...
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com