Why use client side object model in sharepoint 2013
when to use client side object model and also how to use client side object model.
CSOM is used to access SharePoint from outside of the server. This is the only way to program for SharePoint online and if you do not have access to the on premise server. The main disadvantages of CSOM is that it still does not provide many functionalities available in SSOM (server side code).
Some advantages of CSOM:
Basically CSOM is the future of SharePoint development.
How to use it is entirely different story. You have to do a lot of research yourself and ask some concrete questions.
Here are some useful links:
https://msdn.microsoft.com/EN-US/library/office/fp142381.aspx
https://msdn.microsoft.com/en-us/library/office/fp179912.aspx
The client side object model is used for the App way of developing SharePoint solutions. Where as server side code was typicaly used for older models since it requires an on premise installation of sharepoint where that you could deploy apps to cloud based installations as well.
besides the client side object model it is worth noting that there are also rest services which can be used.