Product Information
SAP HANA Community Webinar: Cloud native development and Cloud Application Programming Model with SAP HANA
Yesterday, I had the opportunity to share my screen (and hopefully some knowledge) while building two very simple Multi Target Applications using SAP Web IDE and SAP HANA.
One was a sample app from scratch and the other was built by/using the Cloud Application Programming model.
This was a nice opportunity to review some basic concepts on cloud-native development and touch on new ones, such as the CAP model itself applied on SAP HANA.
I also bragged about my on-premise SAP HANA instance with the latest generally available version SAP Web IDE for HANA, which includes the wizard for the Cloud Application Programming model.
TL;DR: Here is the link to the recording with the topics in the rest of this post: https://event.on24.com/wcc/r/1877744/009A8DA37BBAB7BD59E4D1834182F421 If you want to see me add an extra comma or forget to replace a variable in a template while doing live coding, go straight into that video. TL;DW: You can probably skip the first 18 minutes if you already know why delegating your workloads to those who do that for a living is smart, why cloud native development can be a good idea and what micro-services and API first means. |
Why cloud-native and micro-services
The intro starts with my favorite part of the definition of cloud-native computing: to enable software developers to build great products faster.
I started with an example of a monolithic app that needs some changes in the module applying promotions before Black Friday.
This module is also having trouble processing all of the requests that come in during high demand and could really use a clone or two (I feel you, module).
We move on to how partitioning that application into independent, interconnected executable units is a way of tackling the bottleneckness of the “promotions module for Black Friday”.
In this example, it would allow us to make copies of that specific process and place them behind a load balancer or allocate more resources to just that piece of logics, as opposed to allocating more resources to the entire application.
There are other hints at further benefits of a micro-services approach and principles for software-as-a-service development but there is no point in mentioning them here, as they are already widely documented.
In the wild: https://martinfowler.com/articles/microservices.html by Martin Fowler and referenced by all of us: https://12factor.net/
From SAP TechEd 2018 Microservices in an Agile Environment or from 2017 yet completely relevant, Developing Cloud-Native Apps on SAP Cloud Platform by Matthias Steiner .
Cloud but on premise
And specifically, on my laptop.
The entire presentation is about cloud-native development and the benefits of the cloud.
What better way of exemplifying this than from my very own instance of HANA running in a virtual machine on my laptop?
Picture of the laptop and I building a HANA tutorial on a plane with no WiFi
This was also conveying a message: I can build an app on my laptop, or an on-premise system and then move it onto the cloud.
Short version: SAP Cloud Platform uses Cloud Foundry as an application platform. XS Advanced is an on-premise version of Cloud Foundry. Both are HANA-friendly and have additional services Elaborate version: Here is an intro to XS Advanced: https://blogs.sap.com/2017/09/04/xs-advanced-for-not-so-dummies/ and the intro of intros https://blogs.sap.com/2015/12/08/sap-hana-sps-11-new-developer-features-xs-advanced/ by Thomas Jung. |
Cloud Application Programming Model and SAP HANA
I would have needed a full separate webinar on the Application Programming Model for SAP Cloud Platform and would not have made the topic justice.
Designed to provide a golden path for developers and make our lives easier while building MTAs, the Cloud Application Programming model is a set of libraries, accelerating tools and languages to build applications and services.
Figure from SAP Help
DJ Adams already has a comprehensive getting started post and a lot more references on the model, so I’ll drop that here.
And to up my rockstar name-dropping game, here is a 7-minute explanation on both XS Advanced and the Cloud Application Programming model by DJ and Thomas Jung
One of the characteristics of the cloud application programming model is that it is meant to be database agnostic so, as contradictory as it may sound, my focus here will be on SAP HANA.
If you jump straight to minute 38 in the webinar, you will see that after running the wizard for SAP Cloud Platform Business Application, I replace the pre-loaded sample CDS with my own entity:
That entity is reusing (and associating to) a model in the SAP library, called Countries and will eventually create some hdbcds artifacts for persistence in SAP HANA.
Because the model is database agnostic, if I wanted to define a text index in that same CDS artifact, it will throw an error.
Why? Because not every database has the ability to create fulltext indices. In this case I chose to complement the definition of the database with that text index created and declared separately
This is complementing an automagically generated design-time artifact with another design-time artifact in a different syntax.
It could make sense in certain scenarios, but if you really need native capabilities, it makes more sense to create your own artifacts using DDL, having control (and lose coupling) of the native capabilities and data types you want to model.
In the first piece of the webinar, I’m showing an XSJS service while explaining that services were based out of ODataV2 and that this call was made possible by a Node.js library that we are actually importing into our module. XSJS and XSODATA are simple and handy to declare, and so are the new CDS to expose services:
These are OData V4 and can be either Java or Node.js based:
And there are plenty of annotations to accelerate the definition of services and Fiori interfaces. There are some very nice examples of both the simplicity and potential to expose services and influence the user interface covered in:
- This tutorial group: Use the Application Programming Model to Create a Full-Stack App
- Blog post and GitHub repo: https://blogs.sap.com/2018/06/27/itelo-a-sample-business-application-for-the-new-application-programming-model-for-sap-cloud-platform/
Now it’s up to you
Free resources + weekend = learning opportunity!
- HANA Native development AND the CAP model got their Open SAP update, starting January 23: https://open.sap.com/courses/hana7
- Trial for the SAP Cloud Platform: https://developers.sap.com/tutorials/hcp-create-trial-account.html
- SAP HANA, express edition: Rumour has it the next release including the CAP model is coming in January 2019, so stay tuned!
Thanks for this blog!