cancel
Showing results for 
Search instead for 
Did you mean: 

Context mapping vs Instance variables

former_member190457
Contributor
0 Kudos

Hi everybody,

I am facing the following issue:

when should we map data to context and when should we keep data in instance variables?

Reasons for using context which come to mind:

- UI binding

- sharing data between controllers

backend call execution is not listed as you can execute the call just calling modelClass.execute(), so strictly speaking you can do without context mapping.

Using instance variables can speed development up since you needn't access context and nodes before actual data manipulation.

I would like to hear feedback from fellows developers, thanks

Vincenzo

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

http://www.google.com/search?sourceid=navclient&ie=UTF-8&rlz=1T4SUNA_enIN288IN294&q=ContextmappingvsInstancevariables+inwebdynprojava

please go through this link

You will find lot of doc on context mapping and instance variable

Regards

Ruturaj

Former Member
0 Kudos

please respond.

former_member190457
Contributor
0 Kudos

Hi, thanks for replying.

As far as backend access is concerned, generally speaking, I can see no reason for binding other than than UI data display and data sharing among components and few other cases you mention.

Consider this scenario: you are manipulating some data without displaying it, for instance:

your interface method

Employee[] getEligibleEmployeesForBonus()

gets an employee list from RFC and returns those who are suitable for special year-end bonus.

In this case there's no need for context binding as you can execute the RFC from


MyModel model_class_instance = new MyModel();
model_class_instance.setParameter(myvariable);
model_class_instance.execute();

Feel free to correct me if I'm leaving something out.

Thanks, Vincenzo

Former Member
0 Kudos

hi!

in this scenario you need not do any context mapping as i hope you have create instance variable and getter and setter for that but what if you have one more component and you want to show the selected list in a different component.

thanks

vishal

former_member190457
Contributor
0 Kudos

In that case of course you need to use context mapping and that's actually one of the cases I mentioned.

Thanks, Vincenzo

Former Member
0 Kudos

hi!

context mapping is necessary when you want to share data across components , also we have some properties like singleton , calculated etc which are very usefull.and also suppose you have n number of components and in one component you have to show some particular data then you only bind that element and design your layout accordingly .it is also very easy to bind data coming from backend.

thanks

vishal