![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I tend to build high performance system, and when doing this stateless programming is at a premium. This often means all of the public methods on a class are defined as static. .... |
|
Anyone have any suggestions of a solid way to do contract based development and still enforce statless programming? |
#3
| |||
| |||
|
|
"Chris Mullins" <cmullins (AT) yahoo (DOT) com> wrote I tend to build high performance system, and when doing this stateless programming is at a premium. This often means all of the public methods on a class are defined as static. Anyone have any suggestions of a solid way to do contract based development and still enforce statless programming? Singletons and Factory methods. |
#4
| |||
| |||
|
|
"David Browne" <davidbaxterbrowne no potted meat (AT) hotmail (DOT) com> wrote "Chris Mullins" <cmullins (AT) yahoo (DOT) com> wrote I tend to build high performance system, and when doing this stateless programming is at a premium. This often means all of the public methods on a class are defined as static. Anyone have any suggestions of a solid way to do contract based development and still enforce statless programming? Singletons and Factory methods. While these are two common patterns, neither one really solves the underlying problem. There's no way in code to say, "Any class that implementes this interface must be a singleton". Even if you could, everything ends up looking like, "MyClass.Instance.GetData", which is hardly idea. While I love the pattern and have used it quite a bit, it's not quite what I'm looking for. Static Factory Methods miss out on the Contract portion - there's no way to enfore the contracts. If an Interface provided for static methods, but without that.... -- Chris Mullins |
#5
| |||
| |||
|
|
Seems that you want programming by contract and multiple inheritance - how about Eiffel? Regards Chris Saunders "Chris Mullins" <cmullins (AT) yahoo (DOT) com> wrote in message news:uiEijVavGHA.3936 (AT) TK2MSFTNGP04 (DOT) phx.gbl... "David Browne" <davidbaxterbrowne no potted meat (AT) hotmail (DOT) com> wrote "Chris Mullins" <cmullins (AT) yahoo (DOT) com> wrote I tend to build high performance system, and when doing this stateless programming is at a premium. This often means all of the public methods on a class are defined as static. Anyone have any suggestions of a solid way to do contract based development and still enforce statless programming? Singletons and Factory methods. While these are two common patterns, neither one really solves the underlying problem. There's no way in code to say, "Any class that implementes this interface must be a singleton". Even if you could, everything ends up looking like, "MyClass.Instance.GetData", which is hardly idea. While I love the pattern and have used it quite a bit, it's not quite what I'm looking for. Static Factory Methods miss out on the Contract portion - there's no way to enfore the contracts. If an Interface provided for static methods, but without that.... -- Chris Mullins |
#6
| |||
| |||
|
|
Anyone have any suggestions of a solid way to do contract based development and still enforce statless programming? |
#7
| |||
| |||
|
|
It's not really Multiple Inheritence that I'm looking for (although that would be nice, and I miss it from my C++ days), but the ability to have static methods in the inheritence tree. I want, specifically, a way to say, "This method is stateless", and have that enforced by a base class or an Interface. Right now the only way to enfore that it to put the static keyword on a method - but there's no good way to broadly enfore this at the architecture level. It would be nice, while I'm wishing, to have overridable static members on a base class as well. I looked into Eiffel a while ago - I lived in Santa Barbara, and the language was invented there so I ended up at several presentations put on about it. At the time, Eiffel was running atop the .Net CLR, which means it can't really have the funcationality I'm looking for, as (to the best of my knowledge) the CLR doesn't support what I'm describing. I'm happy with C#, I just wish they would complete it a bit more. I would love to see const methods (as C++ does), multiple inheritence, static interface definitions, compiler enforced exception declarations (ala, Java) and a few other small features here and there. ... oh yea, and "WithEvents" should be part of C#! - Shame on them for forcing their horrible event syntax on me when VB.Net makes it so easy! (while I'm wishing, I wish I didn't have to type the stupid class name 50 times just to declare a class, and create a constructor or two. I mean, really, why all the redundancy with naming? There's gotta be a better syntax for this out there somewhere...) I mean, how silly is: public class Foo { Foo(){} Foo(int x){Foo()} Foo(int x, int y){Foo(x)} } Whew. I feel better now. ![]() -- Chris Mullins "Chris Saunders" <evas (AT) mountaincable (DOT) net> wrote in message news:eBW4PCdvGHA.4384 (AT) TK2MSFTNGP04 (DOT) phx.gbl... Seems that you want programming by contract and multiple inheritance - how about Eiffel? Regards Chris Saunders "Chris Mullins" <cmullins (AT) yahoo (DOT) com> wrote in message news:uiEijVavGHA.3936 (AT) TK2MSFTNGP04 (DOT) phx.gbl... "David Browne" <davidbaxterbrowne no potted meat (AT) hotmail (DOT) com> wrote "Chris Mullins" <cmullins (AT) yahoo (DOT) com> wrote I tend to build high performance system, and when doing this stateless programming is at a premium. This often means all of the public methods on a class are defined as static. Anyone have any suggestions of a solid way to do contract based development and still enforce statless programming? Singletons and Factory methods. While these are two common patterns, neither one really solves the underlying problem. There's no way in code to say, "Any class that implementes this interface must be a singleton". Even if you could, everything ends up looking like, "MyClass.Instance.GetData", which is hardly idea. While I love the pattern and have used it quite a bit, it's not quite what I'm looking for. Static Factory Methods miss out on the Contract portion - there's no way to enfore the contracts. If an Interface provided for static methods, but without that.... -- Chris Mullins |
#8
| |||
| |||
|
|
Just to let you know - Eiffel has the option for using .NET but it is not required. Most Eiffel compilers compile to C code and then require another compiler to finish up. The company that produces the most popular (I believe) Eiffel compiler is located in Santa Barbara, but I don't believe Eiffel was invented there. I'm not a salesperson or otherwise a representative of Eiffel products but I would suggest you may want to have a closer look. This is a C# group so I'll say no more. Regards Chris Saunders "Chris Mullins" <cmullins (AT) yahoo (DOT) com> wrote in message news:uIeLYXdvGHA.4972 (AT) TK2MSFTNGP05 (DOT) phx.gbl... It's not really Multiple Inheritence that I'm looking for (although that would be nice, and I miss it from my C++ days), but the ability to have static methods in the inheritence tree. I want, specifically, a way to say, "This method is stateless", and have that enforced by a base class or an Interface. Right now the only way to enfore that it to put the static keyword on a method - but there's no good way to broadly enfore this at the architecture level. It would be nice, while I'm wishing, to have overridable static members on a base class as well. I looked into Eiffel a while ago - I lived in Santa Barbara, and the language was invented there so I ended up at several presentations put on about it. At the time, Eiffel was running atop the .Net CLR, which means it can't really have the funcationality I'm looking for, as (to the best of my knowledge) the CLR doesn't support what I'm describing. I'm happy with C#, I just wish they would complete it a bit more. I would love to see const methods (as C++ does), multiple inheritence, static interface definitions, compiler enforced exception declarations (ala, Java) and a few other small features here and there. ... oh yea, and "WithEvents" should be part of C#! - Shame on them for forcing their horrible event syntax on me when VB.Net makes it so easy! (while I'm wishing, I wish I didn't have to type the stupid class name 50 times just to declare a class, and create a constructor or two. I mean, really, why all the redundancy with naming? There's gotta be a better syntax for this out there somewhere...) I mean, how silly is: public class Foo { Foo(){} Foo(int x){Foo()} Foo(int x, int y){Foo(x)} } Whew. I feel better now. ![]() -- Chris Mullins "Chris Saunders" <evas (AT) mountaincable (DOT) net> wrote in message news:eBW4PCdvGHA.4384 (AT) TK2MSFTNGP04 (DOT) phx.gbl... Seems that you want programming by contract and multiple inheritance - how about Eiffel? Regards Chris Saunders "Chris Mullins" <cmullins (AT) yahoo (DOT) com> wrote in message news:uiEijVavGHA.3936 (AT) TK2MSFTNGP04 (DOT) phx.gbl... "David Browne" <davidbaxterbrowne no potted meat (AT) hotmail (DOT) com> wrote "Chris Mullins" <cmullins (AT) yahoo (DOT) com> wrote I tend to build high performance system, and when doing this stateless programming is at a premium. This often means all of the public methods on a class are defined as static. Anyone have any suggestions of a solid way to do contract based development and still enforce statless programming? Singletons and Factory methods. While these are two common patterns, neither one really solves the underlying problem. There's no way in code to say, "Any class that implementes this interface must be a singleton". Even if you could, everything ends up looking like, "MyClass.Instance.GetData", which is hardly idea. While I love the pattern and have used it quite a bit, it's not quite what I'm looking for. Static Factory Methods miss out on the Contract portion - there's no way to enfore the contracts. If an Interface provided for static methods, but without that.... -- Chris Mullins |
#9
| |||
| |||
|
|
It's not really Multiple Inheritence that I'm looking for (although that would be nice, and I miss it from my C++ days), but the ability to have static methods in the inheritence tree. I want, specifically, a way to say, "This method is stateless", and have that enforced by a base class or an Interface. Right now the only way to enfore that it to put the static keyword on a method - but there's no good way to broadly enfore this at the architecture level. It would be nice, while I'm wishing, to have overridable static members on a base class as well. I looked into Eiffel a while ago - I lived in Santa Barbara, and the language was invented there so I ended up at several presentations put on about it. At the time, Eiffel was running atop the .Net CLR, which means it can't really have the funcationality I'm looking for, as (to the best of my knowledge) the CLR doesn't support what I'm describing. I'm happy with C#, I just wish they would complete it a bit more. I would love to see const methods (as C++ does), multiple inheritence, static interface definitions, compiler enforced exception declarations (ala, Java) and a few other small features here and there. ... oh yea, and "WithEvents" should be part of C#! - Shame on them for forcing their horrible event syntax on me when VB.Net makes it so easy! (while I'm wishing, I wish I didn't have to type the stupid class name 50 times just to declare a class, and create a constructor or two. I mean, really, why all the redundancy with naming? There's gotta be a better syntax for this out there somewhere...) I mean, how silly is: public class Foo { Foo(){} Foo(int x){Foo()} Foo(int x, int y){Foo(x)} } Whew. I feel better now. ![]() -- Chris Mullins "Chris Saunders" <evas (AT) mountaincable (DOT) net> wrote in message news:eBW4PCdvGHA.4384 (AT) TK2MSFTNGP04 (DOT) phx.gbl... Seems that you want programming by contract and multiple inheritance - how about Eiffel? Regards Chris Saunders "Chris Mullins" <cmullins (AT) yahoo (DOT) com> wrote in message news:uiEijVavGHA.3936 (AT) TK2MSFTNGP04 (DOT) phx.gbl... "David Browne" <davidbaxterbrowne no potted meat (AT) hotmail (DOT) com> wrote "Chris Mullins" <cmullins (AT) yahoo (DOT) com> wrote I tend to build high performance system, and when doing this stateless programming is at a premium. This often means all of the public methods on a class are defined as static. Anyone have any suggestions of a solid way to do contract based development and still enforce statless programming? Singletons and Factory methods. While these are two common patterns, neither one really solves the underlying problem. There's no way in code to say, "Any class that implementes this interface must be a singleton". Even if you could, everything ends up looking like, "MyClass.Instance.GetData", which is hardly idea. While I love the pattern and have used it quite a bit, it's not quite what I'm looking for. Static Factory Methods miss out on the Contract portion - there's no way to enfore the contracts. If an Interface provided for static methods, but without that.... -- Chris Mullins |
#10
| |||
| |||
|
|
Chris it seems to me that you are NOT looking for the ability to put static methods in an interface but you are looking for a method to mark a method as stateless. The fact that a method is static does not make it stateless. |
|
Getting back to the stateless issue C++ has a weak form of this in const. |
|
The ability to mark that a method is stateless (and therefore thread safe) has been on the wish list of many for a long time. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |