algorithm - Client and server: data filtering and sorting synchronization. -


i have java client-server crud application. in client open person table , can set filter example city,age,sex. besides can add sorting rule, example sort name,and after age. these filtering , sorting rules sent server passed sql dao , used in sql code. server returns dto client according filtering , sorting rules. it's important - server implements these rules client passes these rules server. easy , clear.

now create new person in client application. newly added person must visible in table of persons. , came across problem. how add person table according filtering , sorting rules. solution see make client refresh data server according same rules. obvious bad solution.

i sure common problem crud application. possible solutions: patterns,algorithms,libs? name of problem (if exists)

the broad category of problem layered architecture (an architectural pattern) , question deals run domain logic of system.


on client-server systems decision needs made processing should occur. there broadly 3 different options:

1) run on server

this simplest case. great advantage simple upgrade , fix because it's in limited places. downside clients need make roundtrip server simplest functionality , causes user experience suffer. maintenance point of view best option.

2) run on client

the general arguments in favor of processing on client user interface responsiveness , disconnected operation. in case server acts dumb datasource. many times if need move logic client best move there - @ least in 1 place then. however, keeping clients in sync , avoiding compatibility errors brings challenges.

3) split processing between client , server

this option may have deficiencies of both worlds. main reason there small amount of domain logic needs run on client. trick isolate common functionality own self-contained module isn't dependent on other part of system. way can run module on both client , server.


the simplest option go (1) client send new person data server , server return updated, sorted , filtered person list client. requires server round-trip , may hurt user experience.

the other option go (3) duplicate domain logic of server on client. way forward isolate person handling module can use on both ends.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -