Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm developing a application based on two technologies: ASP.net (SharePoint) and JavaScript.

I use server-side code for retrieve data from database and manipulate it whereas I use client-side code for build front-end(I'm using JSON format).

I have very problem with this "architecture" because ASP.net is strong-type whereas JavaScript is less-type. My data "jumps" from front-end to back-and and vice versa.

How can I have my model class in client-side code too?

share|improve this question
    
recommended reading: Why is asking a question on “best practice” a bad thing? –  gnat May 8 '14 at 8:54

1 Answer 1

up vote 0 down vote accepted

As of today there are many (much many if that's the case) javascript frameworks that allow you to model on the client. Among all the features they offer you can validate/calculate the data is correct before sending it to the server.

However when the data gets into the server, it is your responsability to make sure everything is ok. You should never trust 100% on client side validations, because some skilled user might change that logic for you.

I would suggest to dive into KnockoutJs framework and play with it until you got the point. Later move to AngularJs which is more powerful but more complex also.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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