Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I feel like it's critical to use an event driven architecture with a lot of application types that aren't web sites. However, when coding web sites(which are stateless at the most basic level) it seems like it isn't really necessary to use an event driven architecture.

Is this true? Do most web frameworks not use events to communicate between objects?

share|improve this question
1  
You can see this alot in the difference between asp.net webforms vs asp.net mvc –  Daniel Little Oct 21 '11 at 4:24

2 Answers 2

up vote 2 down vote accepted

The stateless nature of HTTP does complicate event driven programming for the web, but not that much, as state or the perception of state is very easy to build. There are several event driven frameworks for the major web languages out there, one example for php is Prado, and every web platform with a capable application server.

That being said, it's also mostly true that web developers and our tools are not especially geared towards event driven development. My perception is that events are useful mostly on the front end (where it should be noted that javascript is event driven) and don't really add much to the back end. From a historical point of view, state wasn't always that easy to build and we've trained ourselves to be able to leave without it, to the point that when state became actually easy to build we only use it for it's truly essential purposes as we have already covered all our bases for all the stuff that events would be useful for.

On a more generic note, when moving from coding for the desktop to coding for the web or coding for mobile phones, you should be ready for a change of mentality. Several techniques that are essential to desktop apps are not so on another platform (medium, architecture) and vice versa. Every developer of every platform (m, a) likes and benefits from staying as close to the platform's (m, a) low level / core technologies and protocols. Events, although 100% possible and useful and some times completely necessary, are somewhat unnatural to back end web development.

share|improve this answer
2  
Events are very useful on the back-end. A lot of people in the node.js community use event driven architecture. –  Raynos Oct 21 '11 at 8:27
    
Check the last line of my answer, especially the sometimes completely necessary part... :) Also node.js although extremely nice, is not essential to web development, in the sense that you can live without it (I do)... –  Yannis Rizos Oct 21 '11 at 15:47
1  
a better phrased comment would be "popular efficient HTTP servers are event-driven". Event driven code is out there and theres a lot out there in the web. –  Raynos Oct 21 '11 at 15:55
    
@Raynos HTTP servers are supporting tools to web development, but essentially they are networking applications, their design is based around a completely different mindset. –  Yannis Rizos Jan 22 '12 at 18:03
    
Y U NECRO COMMENT. Also using EDA for application level architecture is brilliant, of course you never need a framework to do architecture (that's just silly). Everyone is allowed to make their own choices about web application architecture, but EDA is just as valid, if not more then any other. –  Raynos Jan 22 '12 at 18:05

This is not really true. There are significant numbers in both camps. The web is actually very well suited for event driven approaches. Several web frameworks treat every HTTP request as an event which is dispatched to handlers based on the content of the request. These applications typically have a more component based design, where the components cut vertically through the web stack from UI and JavaScript layers up through the network into particular objects on the server where state is maintained. While this has several advantages, it is not without its disadvantages.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.