Saturday 15 May 2010

android - Mobile client, server, data integrity rules, logic duplication -



android - Mobile client, server, data integrity rules, logic duplication -

i have mobile application , server. users can register via mobile app. users come in e-mail , desired password in order register. there rules applied password, example, password length, characters allowed, etc. each password entered checked according these set of rules before user allowed proceed registration.

my assumption server totally responsible info integrity , compliance logic rules. server must check info anyway. so, user enters password, password (along e-mail) sent server, server checks both , in case of problem returns error client message describes error. app shows message: "password must contain @ to the lowest degree 1 number". user notified.

but

it take time before server's reply reaches client. user unhappy message after 5 seconds of waiting. so, think nice check password before request , notify user rapidly rules violated. simplest solution duplicate rules within client code.

here moment when the problem raises. logic duplication want avoid. i'm thinking kind of api end-point returns rules (for ex.: password rules) in json or xml format. these rules configured on server , whenever changed - applied clients. seems me solution both allows me create "fast password compliance checks" on client , avoid logic duplication. isn't complicated?

my question is: best (recommended) way implement these rules in order avoid logic duplication , create password check process not dependent on network connection quality?

your checks password integrity (length, chars, etc) should handled client-side. checks password validity should handled server. should not experience much latency, on 3g simple auth query server-side script unless code on server-side substandard.

"duplicating rules" vague either way don't see issue trying do. create class handle validation client-side or if app html5 utilize library parsleyjs.

android ios design-patterns data-integrity duplication

No comments:

Post a Comment