Application Development and Automation 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: 
Read only

implement DAO pattern

mmgc_riel
Participant
0 Likes
1,228

In my application I have some database tables with a persistency class. Some other objects are implemented by calling the service bus, some others are implemented by function modules.

I want that the developer doesn't need to know where the object is coming from.

Therefore I want to implement the DAO pattern (Data Access Object).

I'm new on abap objects, so can somebody give me a working example or blog, or guidelines how to code this pattern?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
718

I don't have an coded example here, but isn't it sufficient for this pattern to build an interface with some get- and set-methods? This interface can be implemented by several classes with different data retrieval logic. Then a static factory-method could do the job to decide during runtime which actual class is instantiated, returning the interface.

2 REPLIES 2
Read only

Former Member
0 Likes
719

I don't have an coded example here, but isn't it sufficient for this pattern to build an interface with some get- and set-methods? This interface can be implemented by several classes with different data retrieval logic. Then a static factory-method could do the job to decide during runtime which actual class is instantiated, returning the interface.

Read only

mmgc_riel
Participant
0 Likes
718

I created a few class like you described and it works.

Now i'm going to implement the factory class.

Thanks