One of my favorite hobbies is to study the code written by those I consider as the best coders in the NWN community(in purely alphabetical order, Acaos, Axe, Funky, Lightfoot, ShadoOoW and Whizard, no surprise here, I guess). So, lately, I stumbled on a very long switch wich was broken down into smaller parts(imbricated switches), and I found the idea very instructive and clever. Which makes me wonder: In order to correctly use the concept and get some real benefits from it, how many case statements one should tolerate before deciding to break down the switch? I mean, is it worth to split a 40 case statements switch into 4(or perhaps 2), or would the benefits be real only with giant switches holding hundreds of case statements?
I'm asking this both because I'm writing a loot system wich could possibly benefit from the concept and because I'm always eager to learn and improve my coding skills, so, many thanks for sharing any insight.
Kato
Modifié par Kato_Yang, 06 juin 2012 - 04:48 .





Retour en haut






