cbx
Swordmaster
Canada
296 Posts |
Posted - Nov 05 2003 : 5:06:57 PM
|
OK already enough is enough!!!
I'm already up to 41 , yes 41! overloads for my sprite drawing class. AKA: My yet to be released DX9ToolsR4 directx 9 graphics helper library. And that's just one "Draw" method, there are countless other methods where I have used overloading.
Why so many overloads??? I don't want people to have to convert/adapt there data structures in order for them to call a particular function. I know I hate having to!
I am opening up this fourm topic so that we programmers can all put our brains together and create a app that will write out code for all of the overloading and xml comments for a specified method. And once and for all solve the problem of managing and writing out by hand overloded methods.
This is what the app has to do. 1: Accept a user specified method name with a number of user specified parameters. 2: Using the users input have the app generate a series of method declorations using every possible combination of the specified parameters. 3: make the app smart enough to filter out undesirable parameter combonations.
Ohh that feels good to vent some frustrations... |
Created by: X http://www.createdbyx.com/ |
|
cbx
Swordmaster
Canada
296 Posts |
Posted - Nov 05 2003 : 10:39:20 PM
|
Here is the initial release of spitle ...
All I need to do now is figure out how to create a function to generate all of the possible parameter combonations. After that it's easy sailing.
As for the name of the app "Spitle" it is representitive of what happens to a programmer when they get over load crazy like me
Download Attachment: Spitle.zip 9.44 KB
|
Created by: X http://www.createdbyx.com/ |
|
|
Eric Coleman
Gladiator
USA
811 Posts |
Posted - Nov 06 2003 : 5:06:22 PM
|
quote: 3: make the app smart enough to filter out undesirable parameter combonations.
What exactly would these be? |
|
|
cbx
Swordmaster
Canada
296 Posts |
Posted - Nov 07 2003 : 02:24:34 AM
|
Ok the app is basicly compleate aside from a spit polish to the GUI, but hey it works. I cheated so the user now has to select from a generated list of overloeded methods as to which ones they want to keep/use, rether than the app desiding what methods the user would want to use.
Any ideas on how to improve the app any better?
As for Erics question for undesirable parameter combonations. What I mean is that say you have a method called DrawLine. And it accepts 4 parameters X1, Y1, X2, Y2. Now you know that you always want to have the X1 and Y1 parameters paired together then the user should be able to specify this so the app can make intellegent desisions as to how to create the overloaded methods. But as I said earlier this issue is now mute because I have designed it so that the user selects which overloaded methods thay want to keep.
Download Attachment: Spitle.zip 34.28 KB |
Created by: X http://www.createdbyx.com/ |
|
|
Eric Coleman
Gladiator
USA
811 Posts |
Posted - Nov 07 2003 : 11:39:15 AM
|
I made a slight modification by adding a "copy to clipboard" button for the generated code window.
Download Attachment: Spitle.zip 84 KB |
|
|
cbx
Swordmaster
Canada
296 Posts |
Posted - Nov 07 2003 : 9:54:51 PM
|
I have been thinking about using .NET CodeDOM to export actual vb.net and or C#.net code. But I won't do this unless someone really begs me to. And I'm talkin some serious groveling here.
Now the only real hard part is determining how hard it would be to create a vs.net addin or macro so that users can modify existing overloaded methods and add there own etc.
So Eric? since you added some copy to clipboard code does that mean that you too have been suffering from a little overloading spitle as well. What do you think? Do you think people will really take a liking to spitle? Will spitle become the next must have programmers utility? Please indulge me. |
Created by: X http://www.createdbyx.com/ |
Edited by - cbx on Nov 07 2003 9:59:58 PM |
|
|
cbx
Swordmaster
Canada
296 Posts |
Posted - Nov 07 2003 : 11:10:59 PM
|
Actually the really really hard part would be to come up with a way to generate the proper code that the user wants each overloaded method to execute!
|
Created by: X http://www.createdbyx.com/ |
|
|
Eric Coleman
Gladiator
USA
811 Posts |
Posted - Nov 08 2003 : 09:37:21 AM
|
I just wanted to do something in .NET for experience. I was hoping to add a function to generate all of the different combinations, but you beat me to it before you clarified my question. As for function overloading, its a nice feature, but I'm not really sure why someone would want to really need so many overloaded functions that you need a program to create them all for you. Of course, your code will look nice by only having one "Draw" function all throughout the code, but when it comes to debugging something it could be difficult to find all of those function calls when you need to make a change.
For example, you name your functions like Draw_int, Draw_lng, Draw_dds7, Draw_dds9, etc., you can actually do a search and find those functions if you need to change something or to track down a bug.
In terms of an Object Oriented metaphor, consider a Primate object (or function, this is just an example.) You can have Primate.SwingFromTree or Primate.DriveCar because the Primate is overloaded with all different kinds of primates. Now consider the readability of that versus specific primate types Monkey.SwingFromTree or Human.DriveCar. The latter naming convention is easier to read and understand, and in my opinion easier to track down bugs.
I'll stop right here because I'm digressing into programming theory instead of whether or not I think your program would be useful. In short, I'm biased and I don't think I would have a need for such a program. |
|
|
cbx
Swordmaster
Canada
296 Posts |
Posted - Nov 08 2003 : 11:07:57 AM
|
Well not every one will want to have a method with 41+ overloads, but Spitle will definantly be a help full tool to anyone who wants to create an average 10 overloads for a function etc. It saves alot to typing and cut and past operations.
BTW I am finishing off spittle R2 which will have a save and load to xml feature as well as a copy to clipboard feature. I will probubly stop at R2 unless I find that I need to add extra features. |
Created by: X http://www.createdbyx.com/ |
Edited by - cbx on Nov 08 2003 11:12:00 AM |
|
|