Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Should Clean ABAP Concept Introduced Early?

adityaaufar
Participant

Hi,

I happened to have the opportunity to give ABAP training to clients. According to the syllabus, in my opinion, it's not just the basics because we have to include CDS and AMDP as well.

Back in my days learning ABAP, we only focused just to make the ABAP code work and return the desired results or output. We rarely talk about how to maintain code easier. So I learn about Clean code relatively new as well. Also In where I live many customers still use the ECC version hence the ABAP syntax of 7.4 onwards is still rarely used.

The questions are

1. Is introducing the latest version ABAP really the best approach to the training? Or should I introduce both? Because the demand for ABAP for the old version is still high currently in my country. (Although surely it change in the future)

2. Is introducing a clean ABAP concept too early for them? Should I focus on how to just make the code work?

Thank you.

8 REPLIES 8

FredericGirod
Active Contributor

Hi

very complex and long question 🙂

I think clean code is easier to explain to already experimented developpers, but it is easier to initiate good practice to yound developpers (but maybe they will not understand why).

A friend start explaining Clean Code ABAP with the SOLID principle, and the question : What are so boring when you maintain a program ? (could be other language than ABAP).

Regarding the new syntax, to be honnest, I think some part are too complex to be used (example : FOR THEN ...). It is better to improve code, but if only 10% of developpers could read your code, you will have problem for the maintenance.

I think it is more important to loose time explaining Abap Object and Design Pattern.

adityaaufar
Participant

frdric.girod

Thanks for the input!

Yes, I'm thinking just to cherry pick from the clean ABAP concept and the new syntax with the one that is not too complicated. The FOR THEN In my opinion indeed too complicated.

matt
Active Contributor

Great post and a good question.

1. Is introducing the latest version ABAP really the best approach to the training? Or should I introduce both? Because the demand for ABAP for the old version is still high currently in my country. (Although surely it change in the future)

I would teach the older syntax, but include briefly the new syntax. I'd encourage people to use the new syntax where possible, where it simplifies the code. E.g. NEW, VALUE #, table expressions - but stay away from more complicated stuff.

2. Is introducing a clean ABAP concept too early for them? Should I focus on how to just make the code work?

No, teach clean code from the start. As you introduce each new concept, refer to the clean code standards - either from the book or the git repository.

Encourage people to do things "right" from the start - and continue further research and learning in how to be a good programmer, how to design good programs, how to write unit tests.

The best advice I can give is that in your examples/exercises maintain clean code principles (e.g. don't teach then Hungarian notation, do teach them meaningful names for variables - I called out a few presenters at TechEd for not keeping to the SAP style guide 🙂 ! Also for your examples, give them the < 7.4 version and the >= 7.4 version.

benedict-torres
Participant

Clean code should be a foundation for learning any language. It should be set in practice before the developer builds terrible habits which are, to be honest, very hard to correct.

However, learning basic syntax is still a prerequisite to their learning. For example, I have worked with new joiners who don't really understand the usage of READ TABLE. While no longer in line with Clean ABAP code, these statements would still exist in older environments.

It boils down to fit for purpose, while you can teach both old and new syntax with the same effort, it would not be practical time-wise. If I am teaching for the purpose of making good ABAP developers for maintenance of older systems, I would need to intentionally inject the old syntax. Then again, I would make sure that everything they would start with will have a foundation of new syntax aligned with clean code. I would only do these for the purpose of acclimatizing them to syntax that they would see in their day-to-day task. In fact, I have taught ABAP development for the purpose of learning how to debug an ABAP code and not to build codes. It wouldn't make sense if they would not understand old syntax.

If not for that reason, I would just be solely focusing on new syntax in my examples.

On the topic of clean code, I would try to introduce as early as I can as a concept but not fixated on any hard rules. Personally, I disagree with some of the things mentioned in the style guide.

Sandra_Rossi
Active Contributor

I second Matthew's excellent answer.

My 2 cents:

  1. "Clean code" from here recommends constructor expressions, but we could also write clean code with the older ABAP code provided that we use only ABAP Objects. Of course constructor expressions are highly useful, do as Matthew suggests.
  2. I recommend to show all examples in ABAP Objects and after they are experienced with methods, provide a tiny chapter to show the corresponding signatures for subroutines and function modules.

FredericGirod
Active Contributor
0 Kudos

matthew.billingham you still focused on Hungarian notation 🙂 (and I am still using it 😉 )

matt
Active Contributor

frdric.girod ah, yes - well some people just won't change. 😉

david_joseph
Explorer

Maybe set-up the Clean ABAP code inspector variant (via Code Pal and ABAPGIT). Showcase each priority findings and explain concepts by forward navigation to the clean ABAP git repository.

I had done this in a training previously and got good results. It's important to cover code inspection and code quality assessment in trainings to beginners as well.

As a trainer, i present topics such as this in a conversation with the students and gauge their interest and if they have bought in to the idea and are open to explore, we can showcase any topic. E.g. SAP GUI client Vs Eclipse IDE etc..