Technical Articles
A Full Stack Developer life -> Before CAP vs After CAP
Introduction
I’m sure you’ve heard or read about the new application programming model for SAP Cloud Platform & Core Data & Services (CDS).There’s been a lot of interest around the new Application Programming Model for SAP Cloud Platform
What actually is the SAP Cloud Application Programming Model?
Briefly, the Application Programming Model for SAP Cloud Platform is a framework of tools, languages and libraries, some from SAP, some open source. With these tools, languages and libraries you can efficiently and rapidly build enterprise services and applications in a full-stack development approach.
CDS are part of SAP’s new programming mode & the backbone of the SAP Cloud Application Programming Model. It provides the means to declarative capture service definitions and data models, queries, and expressions in plain (JavaScript) object notations. CDS views push the logic to the database, plus to the client-side as well.
By using declarative approaches like CDS, plus a combination of enterprise-grade tools and services, and a golden path of best practices, allowing you to focus on your domain problems to solve instead of wasting time and efforts in technical disciplines and hard-to-maintain boilerplate code, relieving you from tedious technical tasks. Therefore CAP greatly increase developer productivity and speed up the development process. This means we significantly reduce time to market. Moreover, this ensures many essential non-functional features, like multi-tenancy, extensibility, supportability and maintainability.
In my experience CAP is an extensions on SCP Platform as a Service (PaaS) cloud computing services offered by SAP Cloud Platform
CAP Cut coding time & development effort drastically :CAP development tools can cut the time it takes to code
Add development capabilities without adding new staff :CAP as a Platform as a Service components can give your development team new capabilities without you needing to add staff having the required skills.For example any IT person can quickly write CDS entities then CAP Framework spins this entities automatically serve persistence layer to interact with cloud or local database & serve out of box Create ,Read ,Update, Delete , Query operation . There are many more features of CAP .The following picture visualizes the main features of the CAP framework.
1. Increased Efficiency: SAP CAP provides a unified platform for managing all your business processes, allowing for faster and more efficient operations.
2. Improved Data Quality: SAP CAP helps ensure data accuracy and integrity by providing a single source of truth for all your business data.
3. Reduced Costs: SAP CAP reduces the cost of ownership by eliminating the need for multiple systems and providing a single platform for managing all your business processes.
4. Increased Agility: SAP CAP enables faster decision-making by providing real-time insights into your business operations.
5. Improved Security: SAP CAP provides enhanced security features to protect your data and ensure compliance with industry regulations.
In this blog post I would like emphasis on development effort to create a business service i.e functioning CRUD+Q OData service using Apache Olingo frame work vs CAP
Example: An application developer was given the task of creating car services on SAP Cloud Platform that integrates with SCP Hana database.
Using Olingo we needed to write a lot of boilerplate code
Source Code using Apache Olingo + Java : https://github.com/Showkath/my-car-service
Source code using SAP CAP : https://github.com/Showkath/carservice
With less lines of declarative code you can spin up a fully formed CRUD+Q OData service, and adding custom handlers is also only a few lines of code.
CAP basically an extension of the Olingo framework which eliminated the boilerplate code required for setting up a OData application & implement OData services.The CAP Java stack has a Persistence Service that provides out-of-the-box capabilities to store and retrieve entities from a database. Therefore no custom coding is required for this. The entities defined in your CarService will be automatically served via OData.
CAP applications use Core Data Services (CDS) to describe: declarative capture service definitions and data models
Only two steps are required to implement services
- Define data structures by using entity definitions
- Define how this data structures are consumed by using service definitions
You can create the UI for your business application using SAP Cloud Application Programming Model, SAP Web IDE Full-Stack and the Annotation Modeler to add UI annotations.
The Next generation Java stack is able to tightly integrate with Spring Boot, which provides a lot of features out of the box. This means, Spring Boot will be your runtime container.
CAP Reference Hands-On Tutorials
Check out the following official blog posts which provides more information on CAP
CDS Concepts ,Syntax & Features
SAP Cloud Application Programming Model
Use the SAP Cloud Application Programming Model to Create a Full-Stack App
Create Associations and Annotations in the SAP Cloud Application Programming Model
if i am connecting to SAP backend how does the user context gets transferred from SCP ( so i can send data based on it), is there a way to do this ? Could you please show this with a blog
Hi Murugesh Karunamurthy
Can you add some more details how are you connecting to SAP back end & which back end .
Are you connecting to SAP HANA Database via CAP , if u need user context in annotations using add security annotations for example https://cap.cloud.sap/docs/guides/authorization
If you need security context , you can write extensions https://cap.cloud.sap/docs/java/advanced
Regards,
Showkath.