ABAP Koans
Why practicing is better than theory?

(Source: https://amoebarepublic.files.wordpress.com/2008/04/programmer.gif)
By designing you learn to design. By making programs you learn to make programs. wiki.c2
Are you trying to master a new language or level up with the one you already familiar with?
Koans are a great way to hone your skills through small exercises.
The first Koans exercises are created by Jim Weirich for learning the Programming Language Ruby. Ruby Koans
The Koans walk you along the path to enlightenment in order to learn Ruby. The goal is to learn the Ruby language, syntax, structure, and some common functions and libraries. We also teach you culture. Testing is not just something we pay lip service to, but something we live. It is essential in your quest to learn and do great things in the language.
Koans aren´t limited to learning a Language. I´d like the concept of Carlos Ble´s to use the Koans for learning Unit-Testing in JavaScript jskoans.
I adapted this idea and wrote the first ABAP Koans to explore the ABAP Unit Testing Framework. It should be a small step to motivate YOU to start exploring Unit Tests in ABAP.
(System Requirement minimum 7.40)
Essentially ABAP Koans is an interactive tutorial.
You clone the GitHub repository https://github.com/damir-majer/ABAPKoans navigate to the existing global class and execute the Unit Tests over Menu >Execute>Unit Test or via the Keyboard Shortcut CTRL+SHIFT+F10 (works also in ABAP in Eclipse ;-).
You start with a failing Unit Test.
Solve them and continue to the next failing Test, until you solve every failing Unit Test.
No previous knowledge is required. The first Tests are very basic, but feel free to extend the current standing!
Hm, interesting idea… Unfortunately, I’m disqualified by not having 7.4. 🙁
For those who are also wondering what the heck is “koan“:
Jelena Perfiljeva
I have the same problem – no access to 7.4. Thank you for the definition!
Damir Majer
Thank you for an interesting blog and creating the unit test koans.
Michelle
Hi Former Member and Jelena Perfiljeva ,
I´ve just created a Version for Systems with ABAP Stack between 7.02 and 7.31. (I made the changes without a proper System, please give me some Feedback if it works on your Systems…)
Installation is pretty forward using abapgit:
That´s all!
Have fun to explore ABAP Unit.
Cheers,
Damir
That was so nice of you to do.
Thank you!
Michelle
*Shameless plug alert:* For those who want to try the original 750 version:
https://www.sap.com/developer/trials-downloads.html
have fun!
Julie
Hi Jelena Perfiljeva,
thanks for the addition! Hmh, I don´t have an access to a system lower than 7.4 but I will think to add a branch for those Requirements!
Cheers,
Damir
Love the graphic! Reminds me of the famous “Ten Bulls” woodcut from 12th-century Chinese Zen (or Chan) Buddhism, which I’m pretty sure could be adapted to the process of mastering the art of design!
Matt Fraser hehe, I love your graphic too 😉
Reminds me of the Book Zen Programmer…
Cheers,
Damir
That’s awesome! I didn’t know that book. The blurb reminds me of my own old blog post, Banishing Basis Burnout. And of course another one I wrote: Zen and the Art of Unlearning Expertise, though that one wasn’t about stress and burnout so much.
Thanks!
This is all about UNIT TESTING as well, so gets my vote.
The Australian development system where I work is on 7.50 (up from 7.02) as about fifteen minutes ago, so we are good to go. Germany (where I am) will be about three months behind, and I will push this here as well, purely from the UT perspective.
SAP as a company should note how few people (customer systems) actually are on a 7.40 system or above. It is far less than anyone imagines….
Hi,
agree – glad we are on 7.4.
11500 according to the TechEd slides
https://blogs.sap.com/2018/02/08/have-fun-with-abap-koans/?sap-outbound-id=39AFBC4EE3DD1B06A31DA1774681E67AE3F081CA&utm_source=SAPHybris&utm_medium=email&utm_campaign=80&utm_term=G-150334-1-%20%202.14.18%20SAP%20Community%20Voice___Have%20Fun%20with%20ABAP%20Koans.&utm_content=EN
sorry wrong link – and stuck in unable to update bug
https://events.sap.com/teched/en/session/33645
HI
I like the idea very much with point of view to teach trainees in ABAP
Hi ,
Can you please explain the benefit to the developer as I didn’t get exactly where i can get the benefit of during abap development.
thanks ,
shivam
Hello,
Thanks for another great initiative Damir Majer !
A great way of keeping up the pace after atending an ABAP Code Retreat!!
Keep up the nice work
KR
Sérgio Fraga
Hi, it’s REALLY nice idea!
Some time ago we published a book of exercises in ABAP, 101 Exercises in ABAP (http://abap101.com/ebook/), because we (me and Fabio Pagoti ) also believe that “practicing is better than theory”.
Nice job bringing that to ABAP!
Flavio
Jelena Perfiljeva and Former Member you could always install the nwabap trial. For example on a docker instance 😉
https://github.com/tobiashofmann/sap-nw-abap-docker
After having found thecodelesscode.com recently (via a comment on http://www.explainxkcd.com/wiki/index.php/1988 ), I remembered at least the title of this blog and went searching for it.
Cloning didn’t work (HTTP-Error 407), but I worked around it with import *.zip. (Another thing I can give praise to OpenSap WTC1: it made me install and use ABAPgit for the first time, lowering the bar of “unknown, thus uncomfortable” for all future cases where I come across it!).
So I did about 12 of those Koans.
What threw me off at first, is that it’s not about the production code at all; thw whole reason of those unit tests existing is them failing (or later: passing), nothing else….
I can see that such a setup is a possible way of learning/exploring a new topic (here: what methods does cl_abap_unit_assert have, and how are they used).
best
Joachim
I today did the rest of them, and now understand, that it’s actually not about unit testing. Instead the ABAPunit-framework is used to learn whatever the Koan is designed to teach (e.g. regular expressions)
Would be interesting to see more of those Koans!
And yes, it is fun! 🙂