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: 
Former Member

Technical Design Time

So you are doing the technical design of a project.   OK - so the design and the coding have been done and you are supporting it.  (Me)   But pretend I helped design the "mess" I call dynamic programming.   Don't get me wrong, I love dynamic programming when used with some common sense.   But anyway...   Back to the story, YOU are doing a technical design for a project.

Requirement:

A screen is needed to display a table.   In the table there can be many records that relate back to one line.   You want to display the table in one line for editing, creating, and displaying.

Table

LineName of FieldDescription of FieldValue
1Crazy1Crazy field 1Yes
1Medication1Medication NeededTranquilizer
1Time_DangerousTime when dangerousWhile Programming
2Crazy1Crazy field 1No
3HappyWhen are happyNo computers
3Medication1Medication NeededNone

Display / Change / Create - After clicked on line 1

LineCrazy1Medication1Time_Dangerous
1YesTranquilizerWhile programming

Display/Change / Create - After clicked on line 2

LineCrazy Field 1
2No

OK Now lets make it a little harder - the fields for the lines are determined by different criteria.

LineJobNumber of yearsPeople interactionhours logged with people interactionColorAnimalName of Field
1Programmer3Crazy1
2ProgrammerNoCrazy1
3HorseCrazy1
4Independent wealthyHappy
5Yes10Medication1
6RedTime_dangerous

So it's an interesting requirement.    Let's pretend nothing in standard SAP will work for the requirement.   So what do you do?   What do you put in your technical spec?  How are you really going to program this beast?

Maybe the above isn't enough information.   So you get more and continue.

Dynamic programming is an option.   Probably a good one.   Use it with an ALV.   Ahhhhh... Now you see where I'm going with the dynamic programming.   But..   What about a Step-loop?   It's old, true.  And the display will look different - going down the page instead of across.  So which is the better choice?

Aha!  It's SAP ABAP we are talking about.   So the answer "It depends".   Yes!  Fist pump.  That is the answer.   I know it.

Questions to ask yourself

So step back - look at the mess and try to think about it.   Now step back again look at it again, and decide which will be the easiest to code.   Step back - yes look again, which is going to have the best performance.   Alright one more time - the last and most import to all of us that support your code - step back look again.   Which is going to be the easiest to support?  What skill levels are on staff?  What do they normally use?   What about the development team who will be developing the code?  What if it isn't you - can they do what you want?

So many questions and no good answer.

Decision Time:

So one more time - I'll move forward.

I decide to use dynamic programming and an ALV output.    I'm going to build a custom container to hold the code as I'm adding it via a screen exit.

Code Snipit

Here's some code:

I know not enough - but search on Dynamic programming.  You'll find a lot of examples.    This blog isn't meant to explain how to do it.  Also I know the requirements are not all detailed.  But hey we are developers, we know they aren't always well defined!   I like trying to read the back of the napkin for my functional requirements, it's always fun.

So now - answers to my questions.  Of course, my own answers.

Readability - Maintenance

Here's where it gets fun.   I'm a new program and have to maintain this.   Oh boy.   I wouldn't know where to start.   I'm an "older" programmer (Yes, I sure am) and I've never seen anything like this.  Either way the maintenance cost will go up.

Performance


Here it gets a little harder....   If I had used a step loop, I would have been querying and adding data screen by screen.   However, a step loop really didn't meet the requirement.   As a side note, if they used page up and down a lot - it really wouldn't have been a good performance save.   Do think about things like that if you are doing web programming, RF programming, etc.  Screen by screen or all at once?  And it would have depended on if I pulled all thedata up front before moving from screen to screen.

Easiest?

Not always the best way to go.   It depends on your background.  For me, no this wasn't the easiest.

Should Dynamic programming been a technical requirement?

Do it sounds like step loop should have won, and dynamic programming should not have been used.   Well I would say the answers are interesting.  The one that would concern me would be the performance.

So did dynamic programming make sense?  YES!   Look at some different blogs.   I get to ride my soapbox a bit.  It's always fun.   It should have been used for many different reasons.  It is more flexible.   Once you learn it, it will be easy to maintain.  For what I'm using it for, it meets the requirement much better.   Performance is better.   But one of the best reasons - it's fun!   No not really, the best reason.   The best reason is it's going to expand the technical skills of anyone who has to maintain it.   Will it take longer for them to do?  Of course.  Will they complain?  Maybe.   But they will move forward a bit.

And yes, this is still a bit behind the times.  No web, no HANA... What can I say?  We aren't there yet.

So what do YOU think Dynamic or some other form of programming?  Would you have done something different?   Maybe even a newer technique I didn't think of.    Feel free to get on your soapbox.  I'd love to hear what you think.

5 Comments