Kirby writes -
What I *don't* think any standard Java API is designed to accommodate is simple parameter switching, i.e. to catch (int a, int b) verus (int b, int a). Nor even (int a, float b) versus (float b, int a)
I don't pretend to know what is customary - but while int a, int b v. int b,int a won't fly I don't see why (int a, float b), (float b int a) wouldn't, and if it flies and helps - why not use it. But I agree with you in the sense that if I were in fact working in Java I would be less concerned about insulating a user from an API that might make argument order significant. The poor gal has to deal with a compile cycle, casting about of types, etc. and etc. in any case. They are programming, in the most formalistic sense of the word, whether they want to be or not. But in Python/VPython/PyGeo one is working in immediate mode. And when it comes to the point when a user is building geometric constructions by script, I would ideally like them to be thinking more as a geometer, then as a programmer. If 'them' is basically just me, it is no less true. Since there is no *geometric* reason for plane, line to be preferable over line, plane in finding an intersection, I would like there not to be an artificially imposed way it needs to be done. Basically just trying to get out of the way. Art
At 11:24 PM 8/19/2002 -0400, Arthur wrote:
Kirby writes -
What I *don't* think any standard Java API is designed to accommodate is simple parameter switching, i.e. to catch (int a, int b) verus (int b, int a). Nor even (int a, float b) versus (float b, int a)
I don't pretend to know what is customary - but while int a, int b v. int b,int a won't fly I don't see why (int a, float b), (float b int a) wouldn't, and if it flies and helps - why not use it.
I think it makes the code far too prolix, to invent a method for every possible permutation of the same arguments. I guess the way we generally remove non-programmers from the nitty gritty of an API is to build a GUI. Pick all your parameters using widgets and hit "submit", and let the code sort it out. Another option is to prompt at the command line. IDLE has clue tips for functions when you hit the open paren, and other shells may go further, with popups ala Microsoft's "intellisense", showing what all the possible parameters might be. Given functions accept doc strings, you could have a standard way of providing help with the API for all users trying to use PyGeo in shell mode. Kirby
[Arthur]
Since there is no *geometric* reason for plane, line to be preferable over line, plane in finding an intersection, I would like there not to be an artificially imposed way it needs to be done. Basically just trying to get out of the way.
I may be off target here, but I keep thinking that maybe overloading an operator is a cleaner solution for what you are describing. For example, can an intersection be represented by some mathematical operation on the two objects? intersection = someLine % somePlane Then each object would just have to define the special methods __mod__(self, other) and __rmod__(self, other). If the order of the operands is insignificant then the following line would yield an equivalent result as the example above: intersection = somePlane % someLine Thoughts? -- Patrick K. O'Brien Orbtech ----------------------------------------------- "Your source for Python programming expertise." ----------------------------------------------- Web: http://www.orbtech.com/web/pobrien/ Blog: http://www.orbtech.com/blog/pobrien/ Wiki: http://www.orbtech.com/wiki/PatrickOBrien -----------------------------------------------
participants (3)
-
Arthur -
Kirby Urner -
Patrick K. O'Brien