What is an App?
App can be developed on both SharePoint Online and in On-Premise offerings. App use the following three types of deployment models.
Auto-Hosted (No longer possible to create) – In this cloud model, though the app is developed for SharePoint but the app code resides outside of the SharePoint on Microsoft Windows Azure in the background, which can also have access to Microsoft SQL Azure database for managing data. The app is automatically deployed to Windows Azure and SharePoint creates a cloud-hosted app on your behalf. Auto-hosted model is supported on SharePoint Online only unlike the other deployment models.
Provider-Hosted – The Provider-hosted deployment model is almost same as Auto-hosted model, the only difference is that the app code resides in an external domain or server i.e. your own hosting environment which may not be necessarily be windows-based. The app code can be written in any programming language and technology like PHP, .NET or Java. In this scenario, SharePoint acts only as launching pad for the external app.
Refer the following link for more information on apps. Apps for SharePoint Overview – http://msdn.microsoft.com/en-us/library/office/fp179930.aspx
What is a Web Part?
Web Part is a reusable component or a server side control that can be added inside a SharePoint page. Web Part code runs directly within the SharePoint server. There are several out-of-box Web Parts available in SharePoint and one can also build their own custom Web Parts. Web Parts are editable, configurable and can even be connected to each other. Also, Web Parts can be utilized within an app.
Both App Parts and Web Parts are listed in the Web Part gallery from where they can be added in a page. From an end user’s perspective, App Part is like a Web Part – both of them provides a way to add a piece of functionality to a page. However, there are primary differences between them in how they are developed and deployed. In App Part, the app code runs outside of the SharePoint while Web Part code runs within SharePoint. So, poorly built apps does not impact SharePoint environment as in case with poorly built Web Parts.
- Using visual web part, you can add use SSOM (Server Side Object Model) but you can not add SSOM code in apps. You can see the difference between SSOM vs. CSOM here.