In this blog post, I want to share my thoughts that have been in my mind in the last half-year. Mainly why the community (and me) enjoys and embraces CAP (SAP Cloud Application Programming Model) the way it is and which reasons it has. Spoiler: I love CAP. You should also give it a try. You will find some arguments in this blog post.
I had the honor to run 10 SAP CodeJams in the last couple of months all over Europe. if you have no idea what a CodeJam is – there’s a dedicated section at the end of this blog post. Round about 20-40 folks attend a SAP CodeJam usually, where they get introduced to a new topic. All of those SAP CodeJams had the theme “SAP Cloud Application Programming Model”. I had a look at the result of a survey, we as Developer Advocates gave attendees after the event. Mainly to give us a feeling of how we can improve our format, to improve the content and be more empathetic. Empathetic, in a sense whether we expect too much from attendees or if the topic is too advanced or suchlike. And the result is extraordinary. Let me explain why:
99,5% of the attendees would recommend this particular CodeJam to others. (would love to see the other 0,5% commenting below this blog post 😉 ) At this point, I thought about why the result was that outstanding.
Is it because of the way we run CodeJams? – A little bit, could be. But that’s not the crucial ingredient.
Is it because the event is for free? – Not really, folks still have to free time and spent 5-7 hours to attend the event.
Is it because the SAP Cloud Application Programming Model adds value to developers? That’s where I would give a damn yes.
What is the SAP Cloud Application Programming Model?
cap.cloud.sap says: “The ‘SAP Cloud Application Programming Model’ is an open and opinionated, framework of languages, libraries, and tools for building enterprise-grade services and applications. It guides developers through proven best practices and a great wealth of out-of-the-box solutions to recurring tasks. CAP-based projects benefit from a primary focus on domain, instead of delving into overly technical disciplines, significantly accelerated development, and safeguarded investments in a world of rapidly changing cloud technologies.”
Basically, I would rephrase it as: It should simplify your life as a developer. Fullstop. Not only because it relieves you of many recurring and tedious tasks that you don’t like to take care of anyway. But also because it offers a uniform way of developing an application along a so-called golden path.
Abstraction for good reasons.
How many times have you analyzed source code from colleagues and spent an eternity getting familiar with project structures and general application setup? From my own experience, this not only costs time but also energy. With CAP, you have a centralized and declarative way of defining your data model and services – no matter which language your custom application logic is written in. How? With CDS – Core Data Services. Below is an example of a data model and a service definition written in CDS. (not to be mistaken with SAP HANA CDS or ABAP CDS, which have similarities but are not the same) On the left side, schema.cds file, with the entity definitions. On the right side, services.cds file, with definitions of how your services should look like.
How does that look to you? Do you have any idea on which database this is running? Do you have any idea, which language the custom application logic is written in? Simply no, because you don’t have to at this level. For instance, it’s not your actual job to define SQL statements. Your data model should compile to an SQL Statement for what it’s needed – i.e., to an SQL statement executable in an SQLite database for local development or to SQL statements executable in an SAP HANA database in a productive environment. Basically the CDS compiler takes your declarative statements and turns them into runtime artifacts needed for your target environment. Because of these two files, you already get full-fledged OData services (CRUD+Q) for your defined entities. For free, just with a couple of lines written in CDS.
Which leads me to the next chapter…
Max: “CAP, lower the hurdle, please!”
CAP: “Max, Roger that. Sucessfully executed!” – How often have you given a new tool, a new programming language, or a new methodology a try and have given up again? It happened to me quite often because it was either too complicated, I couldn’t distinguish any added value, or the effort was disproportionate. On the contrary: The recent SAP CAP CodeJams showed how quickly folks can create a project and be productive. There’s no need to set up a holistic project with x configurations. Start with a minimalistic set of artifacts and grow as you go. Full-fledged OData services in a local environment running on an SAP HANA in SAP Cloud Platform? Just a matter of seconds. Does that lower the hurdle to get started? 😉
Why is that even possible? Because CAP takes care of the technology-dependent configurations, actions, and files, which are necessary to run an application in such an environment. CAP tackles one of my phrases: “Don’t do technology for the sake of technology”.
One of the arguments I often hear nowadays: “thanks for the possibilities you give me now with all these innovations, but they don’t make my decisions easier. We need guidance.” With CAP, you have clear guidance on how to develop applications with providing out-of-the-box solutions for SAP preferred options like SAP HANA or SAP Fiori but still gives flexibility to breakout wherever you need to.
Serve REST endpoints instead of OData. Provide Vue.js frontends instead of SAP Fiori UIs. Use your preferred editor like vim instead of the SAP Web IDE or SAP Business Application Studio (curious how to pimp vim with CAP features? My colleague DJ Adams shows it in one of his #HandsOnSAPDev recordings). To name a few of the breakout picks.
Abstractions for good reasons. Again.
What if something changes on the Platform side in the upcoming years? We all know that things in IT change frequently, and everybody is trying to stick to a good balance when it comes to adopting new features/technologies. Just think back, what kind of trends were hyped in the last couple of years and are now more or less without any meaning? Don’t get me wrong. SAP is following the right path from my point of view with Cloud Foundry in SAP Cloud Platform, but what if something changes architecture wise in the future?
Safeguarding investment is the appropriate keyword here. Because of CAPs platform and protocol agnostic design and strategy, you are not anymore tightly coupled to a specific technology and leverage from your investment today also in the future. Thanks to the declarative approach, CAP could prospectively take care of needed changes to stay up to date but also safeguard your invested time and efforts.
On a side note: Mock Server needed?
How often did you have the problem to find a fitting OData service to experiment? It’s a matter of seconds to build a CAP application with some test data and, as said, get the entire set of OData operations (CRUD+Q) out of the box. Run it in SAP Cloud Platform or local without tremendous effort. You are in charge of your very own mock server now. It’s a matter of seconds to get it up and running. DJ Adams and Marius Obert have used this approach, for example, for their SAP TechEd Mission “ “ to mock an S/4 HANA system, so that everybody has its very own mock server running locally.
One of my main tasks as a Developer Advocate is: Listen to developers and think about what feedback they provide. And I’ve seen excellent traction in the community about the Adoption of CAP. There’s already a dedicated GitHub repository with a focus on providing example source codes.
I asked a couple of the community members explicitly:
How do you think about CAP?
Volker Buzek: “CAP (Node.js) has put me as close to a full-stack engineer as I never wanted to be :-). It is lightweight, sporting a modular reflection design, favoring convention over configuration – which takes down the entry hurdle significantly. And its’ declarative usage for service + persistence modeling feels like a breeze of fresh air in the complex SAP software universe.”
Benjamin Krencker: “I like CAP because I am able to build modern web apps with db, OData service and UI in a really short time! And I can also profit from enterprise features such as authentication and internationalization.”
Gregor Wolf: “Get ideas quickly into a fully CRUD enabled OData API that serves a Fiori Elements UI. But be aware that Fiori Elements you must use OData V2 as SAPUI5 is lacking quite a bit for V4. I hope that CAP will follow OpenUI5 and get open sourced to get a big userbase.”
You want to get started, but you don’t know where to start?
Here’s my list of suggestions:
– #HandsOnSAPDev with qmacro
You don’t know what a CodeJam is? Hold on:
community.sap.com: “SAP CodeJam is a developer community focused event, requested by you, where you can check out specific SAP technology, platforms and tools through simple, end-to-end scenarios. The events are supported by SAP and led by SAP experts who will be onsite to guide you through the exercises, answer your questions, and share relevant insights and tips. SAP CodeJam are hands-on events where you need to bring your own machine and plan to spend between 5-6 hours learning, networking and collaborating.”
All of that for free, except the fact that the requester has to provide a room + WIFI.
Experience Reports of recent CodeJams:
CAP CodeJam at minnosphere in Passau