Click here to Skip to main content
15,886,110 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
GeneralRe: Application efficiency? Pin
Neo1010123-Sep-12 0:44
Neo1010123-Sep-12 0:44 
GeneralRe: Application efficiency? Pin
Eddy Vluggen23-Sep-12 0:52
professionalEddy Vluggen23-Sep-12 0:52 
GeneralRe: Application efficiency? Pin
Neo1010123-Sep-12 1:00
Neo1010123-Sep-12 1:00 
GeneralRe: Application efficiency? Pin
Eddy Vluggen23-Sep-12 1:21
professionalEddy Vluggen23-Sep-12 1:21 
GeneralRe: Application efficiency? Pin
jschell23-Sep-12 7:12
jschell23-Sep-12 7:12 
GeneralRe: Application efficiency? Pin
Pete O'Hanlon23-Sep-12 8:04
mvePete O'Hanlon23-Sep-12 8:04 
GeneralRe: Application efficiency? Pin
dojohansen10-Oct-12 4:15
dojohansen10-Oct-12 4:15 
GeneralRe: Application efficiency? Pin
dojohansen10-Oct-12 4:10
dojohansen10-Oct-12 4:10 
Eddy Vluggen wrote:
What you implied is that this information (whether the database-connection is opened or closed) should only be stored in the database.


That's not really what's meant by stateless design. Smile | :)

I'd happily agree with you that any information stored anywhere IS "state" but going by this definition we'd be talking about information-free information systems, and I suspect they'd be useless.

What people actually mean when they speak of stateless is that the object instances themselves are stateless. There are no instance members. But there are method parameters and local variables, and they live on the stack. (If they are references to other objects, the objects themselves of course live on the heap. But every reference to them will be on the stack.) This leads to two properties which are sometimes desireable: You can't corrupt the heap in such a way that it affects more than one thread. A service for instance may fail under some condition, but this can't leave the server itself corrupted and subsequent requests still have a chance of succeeding. Secondly, it means the same "objects" can be shared among many threads, because they use the stack of each thread to store all the state they manipulate.

Lest you now become a fan, let me just add this: Stateless design also means throwing OOP out the window! Some will argue on this point, but here's my take. What really defines OOP is 3 things: Encapsulation. Inheritance. Polymorphism. But stateless implies you are creating "objects" that really are nothing more than a bunch of routines. And although you still have inheritance and polymorphism to play with, you can't put them to really good use, because you no longer have any objects, just mini-libraries of routines and subroutines!

Personally, I consider encapsulation the far most powerful - and least understood - aspect of object-oriented programming. It is what makes it object-oriented! You cannot model stuff as an object if you can't encapsulate. You could still do it without inheritance or polymorphism, though they are both *very* useful and powerful concepts. The most I would ever consider using stateless architecture for would be a small part of a server. This would ensure this part couldn't get corrupted. Then I'd make everything else properly object-oriented and build capability to "reset" the state into it. Hence the service could sort of "reboot" in case of trouble, and I could still program the vast majority of the system properly!
GeneralRe: Application efficiency? Pin
Eddy Vluggen10-Oct-12 8:30
professionalEddy Vluggen10-Oct-12 8:30 
GeneralRe: Application efficiency? Pin
dojohansen10-Oct-12 23:15
dojohansen10-Oct-12 23:15 
QuestionRe: Application efficiency? Pin
Eddy Vluggen10-Oct-12 23:49
professionalEddy Vluggen10-Oct-12 23:49 
AnswerRe: Application efficiency? Pin
dojohansen11-Oct-12 0:10
dojohansen11-Oct-12 0:10 
GeneralRe: Application efficiency? Pin
Eddy Vluggen11-Oct-12 0:41
professionalEddy Vluggen11-Oct-12 0:41 
GeneralRe: Application efficiency? Pin
jschell23-Sep-12 7:15
jschell23-Sep-12 7:15 
GeneralRe: Application efficiency? Pin
dojohansen10-Oct-12 3:28
dojohansen10-Oct-12 3:28 
AnswerRe: Application efficiency? Pin
jschell23-Sep-12 7:46
jschell23-Sep-12 7:46 
QuestionMultiple Versions Of Application Pin
Matt U.20-Sep-12 7:07
Matt U.20-Sep-12 7:07 
AnswerRe: Multiple Versions Of Application Pin
Pete O'Hanlon20-Sep-12 7:27
mvePete O'Hanlon20-Sep-12 7:27 
GeneralRe: Multiple Versions Of Application Pin
Matt U.21-Sep-12 8:10
Matt U.21-Sep-12 8:10 
AnswerRe: Multiple Versions Of Application Pin
jschell20-Sep-12 8:59
jschell20-Sep-12 8:59 
GeneralRe: Multiple Versions Of Application Pin
dojohansen10-Oct-12 4:59
dojohansen10-Oct-12 4:59 
AnswerRe: Multiple Versions Of Application Pin
Expert Coming20-Sep-12 14:20
Expert Coming20-Sep-12 14:20 
GeneralRe: Multiple Versions Of Application Pin
jschell21-Sep-12 10:30
jschell21-Sep-12 10:30 
GeneralRe: Multiple Versions Of Application Pin
Expert Coming24-Sep-12 8:24
Expert Coming24-Sep-12 8:24 
QuestionMake everything a tree? Pin
Leslie Sanford18-Sep-12 7:28
Leslie Sanford18-Sep-12 7:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.