Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
hardyp180
Active Contributor

http://www.asugnews.com/article/sap-custom-abap-code-how-to-ensure-quality-when-outsourcing#printer-... css

ABAP Code Quality Survey by CAST

The other day the American SAP Users group wanted my opinion on a new survey that came out by a group called CAST which had analysed about 70 large custom ABAP applications from organisations in the USA and Europe, and come to the conclusion that the code was a load of old baloney, ludicrous, rubbish, hopeless, fit only for the dustbin.

The clear implication was that the ABAP programmers who had written these applications could not touch their own nose, let alone write a program containing even one ounce of quality.

Nonetheless the programs worked – they solved the business problem they were created to solve.

How can this be?

Naturally it is possible to have a working program that is a “big ball of mud” – prone to break for no apparent reason, get hacked and is so complicated it is impossible for any programmer other than the creator (and often even the creator) to understand what is going on, and how to fix things /make changes.

I found the survey very interesting on the whole, some of the diagrams were utterly meaningless e.g. “changeability by industry sector” but the general meaning came through clear enough.

My first reaction is – they are right. I don’t think anybody is going to disagree, there is a lot of dodgy ABAP programming going on out there. It could be argued that the small sample of programs they used were not statistically significant but I would say that if they had analysed a thousand times more than they actually did the result would have been identical.

First off – I just want to express my despair by their use of the term “customization”. Traditionally in ERP circles the term “customizing” was used to refer to making assorted settings in the ERP system (e.g. the IMG in SAP) i.e. no code at all involved and custom programming refers to programs written by SAP customers as opposed to SAP itself. Nowadays everyone in the media using the same term to refer to both so you don’t know whether you are coming or going.

Next I notice that 70 of the 71 gigantic custom developed applications analysed were not developed in-house by the organisations being surveyed but rather outsourced. Once again that term means different things to different people but I am making the presumption that here this means that the organisations involved thought they would get their custom applications developed “on the cheap” by hiring some sort of outside organisation, be it in a low cost country or not, that would develop the application for them at the lowest price. As a result the code quality suffered terribly, that comes through from the survey very clearly. I wonder if the results would have been different if more in-house developed programs had been in the mix?

I have heard this time and again at conferences and focus groups, from managers who report the horror stories suffered by their organisation who decided to outsource development. This seems like a case of no-one every learning from history.

Since the bar at the company I work at is very high indeed, and the people I talk to on the internet (SCN) are at the top of their game it is easy to fall into the trap of thinking most ABAP programmers outside of SAP are good, but I am only dealing with a really small subset.

As an example, I am now going to look at the SCN website and see what the latest question posted on the ABAP forum is. Naturally as I write this I do not know what it is, but I do know that when I read it, it is going to make me cry.

Here I go.

I’m back. It was a question asking how to see who changed a field in a purchase order in SAP. And yes, I want to cry. That is such a basic question, and virtually all the questions are at that level – a month ago someone actually asked “is there an IF statement in the ABAP language”.

It seems to me there are thousands of people out there – going by the questions on the forum – who don’t seem to know the vey basics of programming, and yet sometimes preface their question with “I have just been appointed ABAP team leader on a major project for an international company”. Given that sort of thing going on, is it any wonder that the CAST survey uncovers a quality problem?

The CAST survey also points out that many programmers are business people who learned ABAP and thus do not know the sort of things you would learn during a computer science degree for example. This is a very true observation. I fall into that basket myself. The difference with me is that after a while (admittedly ten years) I started reading all the “classic” computer books I could (e.g. Clean Code by Robert Martin, Head First Design Patterns by Freeman & Freeman etc…) and it did make me a better programmer – that is what started me off blogging and ended up with me writing a book.

Here is a link to the actual survey itself. You have to sign your life away to look at it i.e. give your email details so you get bombarded with advertising.

http://www.castsoftware.com/advertising-campaigns/sap-crash-benchmark-report-2015---advertising---v3

On page 18 a list is given of all the quality tests that were used to gauge if the code in an application is any good or not.

I understand the vast majority of the tests that CAST applied – though some puzzle me and so I am going to ask all you people out there in SCN world for your opinions on the following quality tests suggested by CAST.

“Avoid Unreferenced Methods / Unreferenced Functions / Unreferenced Classes” – I have no idea what that means, I looked it up on the internet and it just talked about this in a Java context, implying it was a good and normal thing to do (whatever this may be). What is this, how does this relate to an ABAP context and why is it bad?

“Avoid SELECT INTO CORRESPONDING FIELDS OF” – oh dear – I use this all the time unless I am reading a massive amount of data and want every single field in the source table.

99% of the time your work area is a lot smaller than the number of columns in the database table you are reading, and there are going to be gaps between them i.e. you might want the primary key and then field 8, then field 12, then field 15.

So I thought the idea was to list of columns you wanted in the SELECT statement and do a CORRESPONDING FIELDS OF into the target area.  What’s wrong with that, why is that coming up as a quality violation?

Anyway, most of the quality tests seem very sensible tests to me, and tests that a LOT of the custom programs I have seen written would fail. E.g. the wanton cutting and pasting of code, acres of commented out code, EXITS in INCLUDES and the like.

Mind you, some of the crimes described can be found in standard SAP code itself. I would be fascinated to see what the result would be if CAST applied the exact same analysis on some large standard SAP applications written in ABAP e.g. sales order entry.

I also think SAP may outsource some development, based on the quality of code I see sometimes in OSS notes, specifically the notes that enabled the correct handling of goods receipts for purchase orders with multiple account assignment. The SAP delivered code in that case was riddled with schoolboy errors, and each note needed another note to correct it, a chain of dozens of notes, the final one saying “we give up; you will need to install an enhancement pack to fix this”.

Lastly, in outsourced companies, and in-house development, and maybe even at SAP sometimes there seems to be a very lax attitude towards code quality. If I go into an existing program to make a change and find a whole bunch of unrelated errors (unrelated to the change I am supposed to be making) I fix them. This is Robert Martins “Boy Scout Rule” – always leave the code cleaner than when you found it. In some organisations though, this is a sacking offence – i.e. making a change you were not supposed to, even if it fixes a bug or increases the quality of the code (the same sort of quality being measured in the CAST survey). Faced with that sort of attitude, are the survey results any wonder?

I apologise for waffling on, and not being as succinct as you might like, but in summary:-

·         It seems that yes there is a lot of dodgy, very poor quality ABAP code out there. I have seen it myself.

·         There is no excuse for this at all, there is so much help available on the internet

·         The survey seems to indicate that outsourced development seems to be of particularly bad quality, but since that was virtually all they surveyed that may mean nothing

As I said, I would be interested in any feedback regarding the quality tests I mentioned above, that I was unsure about.

Cheersy Cheers

Paul

14 Comments