Microsoft have introduced the SharePoint Add-In model (https://msdn.microsoft.com/en-us/library/office/fp179930.aspx). In the Add-In model there are two main types of custom application you can build.
First, there are "SharePoint hosted add-ins". These are self contained bundles of SharePoint functionality. They can contain SharePoint resources such as content types, page layouts, master pages, CSS, JavaScript files, pages and web parts. Custom application functionality is done through HTML 5, basically you write JavaScript that runs on your pages or web parts. Your JavaScript can talk to SharePoint through the JavaScript Object Model (or JSOM for short), or through the REST web services.
Second, if you really need server side code, you can use "Provider hosted add-ins". With these you deploy your custom server side functionality somewhere else. This could be an Azure web site or an application on an on-premise web server. It runs independently of SharePoint, and can talk to it through either the Client Side Object Model (CSOM) or again the REST web services. This custom functionality is then presented through SharePoint as either app pages or web parts. This is how you would use C# for example, but it's important to note it could work with any server side technologies such as Java, PHP, Node etc.