i have controller creates sidebar. in middle of sidebar small section of patient data needs refreshed via ajax time time. so, created element , function specific area. use requestaction patient data element when i'm rendering entire sidebar. but, when i'm doing ajax request, call patient data function directly , return it's view. ajax loads div data view.
my dissatisfaction have same exact view code in 2 places. once in view , once in element. ideally, i'm sure should using element both. guess create function ajax request call, requestaction element data. but, seems unnecessary layer.
in xaraya, have avoided using patient data view within sidebar view.
how should handling efficiently re-use same code?
you right be bothered duplicate code. move element. call element locations need it. configure work in both circumstances. basically, replace view instance call element well. right that.
it appears hangup "unnecessary layer." however, if keeps code clean (by removing duplicate code) unnecessary layer? no. make reusable in multiple locations, therefore necessary.
sounds should trust instincts. ;)
happy coding!
Comments
Post a Comment