architecture - Should I pass a list to this method or one by by one? -


i'm tdd'ing way through little application, , came across don't know how solve. application lets people select drivers think finish @ position. page built in asp.net.

my test:

[test] public void submitprediction() {     prediction prediction = new prediction();      dictionary<int, string> selecteddrivers = new dictionary<int, string>()     {         {1, "michael schumacher"},         {2, "jensen button"}     };      prediction.submitprediction(selecteddrivers); } 

for now, i'm passing submitprediction() selecteddrivers, but, can pass position (integer), , driverid (also int, replaced object called driver have associated driver):

prediction.submitprediction(1, "michael schumacher"); 

will be:

prediction.submitprediction(1, driver); 

what wondering better approach. might better encapsulate driver , position in 1 class, can't come decent name. prediction taken in meaning has bunch of selected drivers , positions. make dictionary list.

prediction.submitprediction(someencapsulatedclasshere); 

it depends on requirements. think, there no straight answer works everything, problem parameter type decision. should understand real problem trying solve, existing behind code problem. don't make beautiful design goal. strong adept of emergent design. form follows function. implementing scenario no bugs goal. design have less bugs, if feel don't have enough experience, try things out, test different solutions. better write code job , refactor later, once you've seen drawback of current solution. that's benefit of tdd, base tdd: red, green, refactor.

do want minimize data traffic between client , server, use object requires least memory, driver id. how assigning ids? in case list gets updated new id mean driver old list?


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -