From: Joe E. <jo...@em...> - 2005-03-11 20:32:30
|
Bill Zwicky wrote: > I got a better idea: Since we're using an object-oriented language, > why not use objects? > > synthdrivers.Generic.Checksum > synthdrivers.Boss.DRChecksum > synthdrivers.Casio.CZ1000.Driver implements Checksum > > This way if a new checksum is developed, noone needs to go edit the > existing code base, nor twiddle the double-indirection constants, nor > edit documentation in multiple places (source, Wiki). Well.... a few reasons why that could be bad are: 1 - There's probably a lot of redundancy/commonality in checksum algorithms, and that redundancy doesn't follow any lines of inheirtance of the classes. In other words, it would probably be pretty rare that a synthdriver would get the apropriate checksum method from its superclass (if at all). Without benefitting from inheritance, each synthdriver still has to define their checksum method, which means that you'd get a lot of stuff like this: public Checksum generateChecksum(Patch p) { return synthdrivers.Casio.CZ1000.Driver.generateChecksum(p); } 2 - Not only is the above code unsightly, it also causes synthdrivers to stick their fingers into other synthdrivers' business. This is bad for two reasons. First, (and this might just be personal preference) I've found that it's poor design to have low-level parts of the software try to have any sort of awareness of other parts. A synthdriver should have absolutely no clue (and, ideally, no way of finding out) if it's the only driver loaded, or one of 100. Usually, this ideal is merely good for helping to promote good OO design, which isn't a life-or-death situation. However, the *second* reason makes it a little more crucial. The second reason is that I'm still holding out hopes that, someday, JSL will allow the user to dynamically browse/retrieve/update their drivers over the net. If this ever becomes reality, then we can't be certain *which* synthdrivers are currently installed on the user's machine and which aren't. Unless we want to come up with some kooky requirement system (ie, "Korg ER-1" requries "CasioCZ1000"), then this could be a deal-killer for any future net-based driver download system. 3 - This solution would make it harder on the XML driver. I'd personally like to see <Checksum type="YAMAHA_PRE_1996" /> instead of <Checksum class="synthdrivers.Yamaha.EX5.BankDriver" /> - Joe |