Alex Rivera | Logout

Business logic in JavaScript. Fat client vs thin client

Asked 2010-11-10T15:25:10.270
12

Is it a good idea to implement business logic on the client side with JavaScript?

What kind of logic should be there? Validation Logic? Related to GUI?

What would you do if the same logic want to be used in another application (exposed) implementing it in JavaScript would mean you can't reuse that logic.

On the other hand having all logic on the server side would mean more requests to the server.

What do you think?

Edit
Report

1 Answer

2

One way of attempting to do what you're looking for is to use some type of web service/ web method acess and have your javascript make ajax calls to the methods, do the validation on the business logic and then send a return back to the front end.

Now the front end would be chatty with the server, but you would have the ablity to share that business logic validation with other appliations within the same domain easily. A second benefit of this approach is that all of the business logic and validation is on the server, and not exposed in a way where a malicous person could easily view or manipulate the code.

Good luck, and hope this helps some.

answered 2010-11-10T15:40:38.470

Your Answer