saguziel / Kryptose

A password manager
2 stars 0 forks source link

Request class shared by both client and server? #7

Closed jnshi closed 9 years ago

jnshi commented 9 years ago

I made some edits today and ended up creating a "Request" class that both client and server can access. The idea is that it contains the logic to execute the request it represents, and it contains all the data it needs.

This way the client can create a Request object, populate it with the correct data, then send it to the Server where the Server can execute the thing.

This is a nice encapulated design. But I have slight reservations about the fact that now Server code is entangled with the client code, and it's become impossible to package a client application without also including all the server code.

I suppose I should separate the Request logic from the Request data. Make a "RequestHandler" class maybe. Alright.

saguziel commented 9 years ago

Yeah, I ended up making a handler class that using instanceof to handle dispatch. It is a bad design pattern but it keeps the server and client code separated. Then again, it may not be a big deal since it just needs datastore, which can just have a null value in the client and not call that method. But I think the way it is now (separated) is fine and there is no need to change it.