1

I am building a Java application for a basic online, collaborative IDE. In this application, clients send commands to a server that serializes these commands and then returns the results to each client. I am trying to determine the architectural style that will maximize performance, efficiency, and simplicity of code.

Currently, I am using a sort of hybrid between a client-server model and a publish-subscribe model. Clients sends commands (i.e. requests to edit code, remote compile, etc.) to the server. For a specific client command, the files on the client-side are not actually changed until the server responds to the command. Since one of the major goals of the project is that the IDE allow real-time colloboration, client commands are sent for each keystroke that is entered. This is the client-server aspect.

However, since clients must also receive events relayed to them from other clients, it is not a pure client-server setup. I'm using the ExecutorService class to implement this publish-subscribe behavior.

My question is - is there a specific architectural style that corresponds to an application such as this? Is there another approach that I can take that accomplishes the application goals? Or, perhaps, am I already using the best architectural style?

1
  • 1
    For me they are not antagonists. Basically, "Client-Server" is more about workload distribution, while "Pub-Sub" is about message distribution implementation. Quake server is just the same :)
    – mikalai
    Oct 5, 2012 at 17:53

1 Answer 1

2

Blended styles are common in complex systems. The most important thing is to make sure that the quality attributes promoted by the styles used complement one another and do not create tension. Tension created would, obviously, need to be addressed.

There seems to be a hidden quality attribute, "files on the client-side are not actually changed until the server responds to the command" which indicates why you chose to use a call-return style in addition to publish-subscribe. I do worry about having a blocking call here for performance, but you also need to worry about data integrity issues.

Thinking about this a little, it seems like you might be able to use a pure publish-subscribe style with the right set of messages.

In terms of "the right style to use" -- focus on your quality attributes and be specific about what is promoted and inhibited by your design decisions. Based on what you've written here, I think there are some additional scenarios that need to be fleshed out to really make a strong case for one style over another right now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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