cancel
Showing results for 
Search instead for 
Did you mean: 

Performance issue on writing code inside view

former_member218672
Active Contributor
0 Kudos

Hi Guys,

Is there any SAP documentation which says, writing code related to rfc execution, rfc data dinding, etc inside web dynpro view instead of component controller hampers portal performance ?

What I'm able to find is everywhere it's saying it's best practice to write all codes/methods inside component controller and one should write only ui related codes inside view.

Please let me know what SAP says about it.

Thanks,

Sen

Accepted Solutions (1)

Accepted Solutions (1)

amolgupta
Active Contributor
0 Kudos

Hi Prodyot,

Based on my experience and inputs received from fellow WDJ Consultants, it is considered a best practice to put your productive data intensive operations/methods in the Component Controller and minimal computations in the View Controllers.

When your Component Controller gets too loaded with code, you may consider writing code in the Custom controllers.

For example, i am working on an application right now. I have put majority of my code in relevant Custom Controllers.

I have one Custom controller each for -

-> calling BAPIs

-> CRUD (Create, Read, Update, Delete) operations

-> Popups handling

-> operations other than CRUD code

Good usage of Custom Controllers and Component Controller will definitely bring down complexity, enhance your own understanding of the code and keep the entire Component well organised.

When you do a POC (Proof of Concept ) or a Demo, you may do all your coding in the view controllers and it will work fine but when you write productive code that will go to production, you will have strong reasons to move the code to Component and Custom Controllers. Writing all your code in the view controller simply gets unmanageable after a point in time.

One more reason to write code in Component and Custom Controllers - REUSABILITY. Code written in View Controllers can not be called from other controllers but methods created in Component and Custom Controllers are designed to be reusable and be called from any controller.

Another tip - dont write your important code in the others section, it will remain local to that controller.

//@@begin others

  //@@end

I hope this discussion helps you, do let me know if you need any more clarification.

Thanks and Regards,

-Amol Gupta

amolgupta
Active Contributor
0 Kudos

Hi Prodyot,

You may consider the following hierarchy of usage as your coding objects expand in terms of functionality, lines of code, complexity and re-usability requirements.

1). View Controller

2). Component Controller

3). Custom Controller

4). More components

5). More DCs (Development Components)

6). More SCs (Software Components) etc

So your usage will expand from 1 to 6 when your software grows.

SAP WebDynpro Java Apps usually run on company intranets so even if there is a slight performance cost of writing all your code in a view controller, it will not be noticeable.

Regards,

-Amol Gupta

Answers (2)

Answers (2)

Former Member
0 Kudos

Prodyot, there is no performance issue when view makes rfc or other type of backend request. The main goal of such controllers organization is follow MVC desing pattern in UI programming.

junwu
Active Contributor
0 Kudos

no such thing