|The ULTAMATE App for overloading.|
|cbx||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...|
|cbx||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 [:p]
Download Attachment: [url="http://vbgamer.strategon.com/msgboard/uploaded/cbx/2003115223416_Spitle.zip"][img]icon_paperclip.gif[/img]Spitle.zip[/url]|
quote:What exactly would these be?
|cbx||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: [url="http://vbgamer.strategon.com/msgboard/uploaded/cbx/200311722326_Spitle.zip"][img]icon_paperclip.gif[/img]Spitle.zip[/url]|
|Eric Coleman||I made a slight modification by adding a "copy to clipboard" button for the generated code window.
Download Attachment: [url="http://vbgamer.strategon.com/msgboard/uploaded/Eric Coleman/2003117113752_Spitle.zip"][img]icon_paperclip.gif[/img]Spitle.zip[/url]|
|cbx||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. [:p] 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. [:p] 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.|
|cbx||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!|
|Eric Coleman||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. [:D] 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||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.|