Featured post
C++ : Avoid lot of boolean variable for multiple verification conditions in trading app -
i junior dev in trading app... have order refresh verification unit. has verify order confirmation exchange. send bunch of different request in bulk ( new, modify, cancel ) exchange... verification has happen max n times each t intervals orders. if verification successful order before n retry fine.. otherwise need indicate verification unsuccessfull. hv done basic coding done in urgent below
for( n times ) { for_each ( sent_request_order ) // sent { 1) refreshed order db or shared mem i.e refreshed 2) find current sent order in refreshed if( not_found ) not refreshed exchange, continue next order if( found ) case new : //check new status, mark verification done case modify : //check modified status.. //if not mark pending, go next order, //revisit same after t time case cancel : //check cancelled status.. //if not mark pending, go next order, //revisit same after t time } if( all_verified ) exit verification. wait ( t sec ) }
order_verification_pending, order_verification_done, order_visited, order_not_visited, all_verified, all_not_verified ... lot of boolean flags used indication..
is there better approach doing this.... splitting responsibilities across classes......????
i know not general question.... still flags making me tidious handle...
your algorithm looks workable. implement it.
do not try optimize code before got working. once have working version running, nevermind how ugly, then @ ways & means optimize. chances find way handle flags gives trouble.
- Get link
- X
- Other Apps
Comments
Post a Comment