I have been pondering about such a "framework" lately, and wanted to know if something like this already exists, or开发者_StackOverflow if it is a completely terrible idea. And I knew that the fine people at Stack Overflow would obviously know the answer.
I was envisioning a "framework" or language to build GUI applications or servers, where one would create a Master, and build the entire application off of this master.
This Master would be completely event driven, it would by default contain a onSetup event to get everything loaded and in order, then t would simply sit passively waiting for any kind of event (ie a button click, an event over a socket, etc).
This Master would be a collection of rules saying what Slave to run(and how to interpret it's return data) depending on the event it catches. All these slaves (basically functions) would be forked to run on separate threads and would be completely asynchronous, and only if explicitly stated would a Slave call put the rest of the Master on hold.
In my opinion this could be an easy way to develop very performance driven GUIs or servers, and would be quite modular. Also all these different Slaves could be easily distributed and shared online, to greatly enhance coder efficiency.
Does a language or framework like this already exist, or does this kind of concept simply make no sense, please let me know what you think about it.
Thanks
It's often easier to just write the software that you need. Frameworks can be useful but hard to do well. Your suggestion sounds like it would just force you to solve problems in a particular way whether that would be suitable or not. You haven't really gone into enough detail though. How would you wait for stuff to finish for example? How do you tell slaves to stop becuase you've changed your mind (error condition) etc. I don't know - depends if your domain has a ton of problems that can be solved like this.
What you are describing, in my mind, sounds a lot like a messaging system such JMS in Java. You could pass your events to your master queue and develop a set of rules for how to subscribe to this queue/topic and take action depending on the event itself. The "framework" you're describing definitely exists - take a look at http://jboss.org/hornetq from JBoss. It will give you all the communication and asynchronous processing you need.
精彩评论