From: Charles M. <cha...@ya...> - 2002-06-13 04:53:12
|
Yes... let's hear some thoughts Alex! :) and you are right Mikhail. createExplosion is actually more accurate for what the method is doing... I was just referring to the already existing name -- but I mistyped it... it was suppose to be ProduceExplosion. peformExplosion is a bad name (since it is creating an Explosion class). --- Mikhail Kruk <me...@cs...> wrote: > Well, I definitely hate the name "performExplosion". Produce or Create > sounds better. > Let's not hurry with this though. I need more time to think. > BTW, Alex, I'd love to hear your opinion on this. With all due > disrespect to your design abilities... you are the smarter one now :) > > > Good alternative. However, wouldn't this generate more classes and code writing than > overriding > > performExplosion. A Hashmap still requires the conversion from objects, but removes the > > dependancy to get all the args in the right order. I don't know. They all work as solutions. > I > > still fancy the performExplosion (for those that need it), but I'll implement whichever one > you > > want. > > > > > > --- Mikhail Kruk <me...@cs...> wrote: > > > You are probably right. It's a bit ugly. I see two ways to work around > > > this. Either go with your suggestion and path Properties object or > > > Hashtable object (of Properties are not in jdk1.1) or create a new bstract > > > class WeaponProperties. Abstract class won't have any methods. > > > Implementation will have methods like getRadius(), getBlah(), everything > > > inside will be read only and initialized by constructor. Then weapon class > > > itself will create an instance of that WeaponProperties class and pass it > > > to the setOptions() methods of Weapon (setArgument is gone then). > > > What do you think? > > > > > > > I got the liquid dirt to work with a few tweaks to the NapalmExplosion. (By the way... I > still > > > > don't know 1/2 of how things are working in the class. There are a lot of things in the > base > > > APIs > > > > that when I go to them via code they don't explain what they are or used for.... which > leads > > > to > > > > more digging and looking to try to understand. However, I understand enought to create > this > > > new > > > > class.) > > > > > > > > Anyway, I started going down the path of handling more than 1 argument... > > > > public void setArguments(Object args[]) > > > > The negative with this is that each class will pass in a varying amount of arguments, all > of > > > > different types. It makes it more difficult for the developer when they are coding to > > > understand > > > > what is being used. This also requires us to case a int to a Integer and then back to a > int. > > > If > > > > you don't mind these shortcomings, then I'll continue to move forward. At a minimum, each > > > > explosion class that implements this method should describe the input expected as the API. > > > > > > > > > > > > > > > > I think I have a better idea. I kind of like the fact that > > > > > > > produceExplosion is so generic and that weapon class doesn't have to > > > > > > > implement any methods. The solution I have in mind is to make argument an > > > > > > > Object isntead of int. For example MIRVExplosion needs really 2 arguments: > > > > > > > number of particles and radius. Then the object passed to is as arument > > > > > > > would be an array of two ints. This might introduce some weird relation > > > > > > > ship between Weapon and Explosion class, but it looks good to me. At least > > > > > > > at 3am. Let me know what you think about this idea. > > > > > > > > > > > > > > > > > > > > > > > __________________________________________________ > > > > Do You Yahoo!? > > > > Yahoo! - Official partner of 2002 FIFA World Cup > > > > http://fifaworldcup.yahoo.com > > > > > > > > _______________________________________________________________ > > > > > > > > Sponsored by: > > > > ThinkGeek at http://www.ThinkGeek.com/ > > > > _______________________________________________ > > > > Scorch-devel mailing list > > > > Sco...@li... > > > > https://lists.sourceforge.net/lists/listinfo/scorch-devel > > > > > > > > > > > > > _______________________________________________________________ > > > > > > Sponsored by: > > > ThinkGeek at http://www.ThinkGeek.com/ > > > _______________________________________________ > > > Scorch-devel mailing list > > > Sco...@li... > > > https://lists.sourceforge.net/lists/listinfo/scorch-devel > > > > > > __________________________________________________ > > Do You Yahoo!? > > Yahoo! - Official partner of 2002 FIFA World Cup > > http://fifaworldcup.yahoo.com > > > > _______________________________________________________________ > > > > Sponsored by: > > ThinkGeek at http://www.ThinkGeek.com/ > > _______________________________________________ > > Scorch-devel mailing list > > Sco...@li... > > https://lists.sourceforge.net/lists/listinfo/scorch-devel > > > > > _______________________________________________________________ > > Sponsored by: > ThinkGeek at http://www.ThinkGeek.com/ > _______________________________________________ > Scorch-devel mailing list > Sco...@li... > https://lists.sourceforge.net/lists/listinfo/scorch-devel __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com |