Jump to content
  • Advertisement
Sign in to follow this  
PDHB

[.net] Looking for a tool

This topic is 5473 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. I'm looking for a tool to make life easier. Suppose I have some class Core. I want to use Core as a field in another class Body, and I want Body to expose all the public methods of Core as it's own. class Core{ ... public double Height { get{return this.height;} set{this.height = value;} } } Class Body{ Core myCore; .... public double Height { get{return this.myCore.Height;} set{myCore.Height = value;} } } Suppose Core has 9 or 10 properties, and suppose I do this kind of thing a lot. Is there a tool out there that would make tis faster for me? A template such that the code to expose all the public properties of myCore would be automatically generated at design time, so I don't need to do it all by hand? By the way, how do I get the code scroll screen?

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
You could try this: http://www.dvxp.com/en/QuickCode.aspx

Install it. Then type "prop int Height", and press Alt-Q. That will expand with get/set.

I haven't used it more than 2 minutes, so I can't relly tell if it's a good tool or not.

Share this post


Link to post
Share on other sites
Looks like a great tool, but it's not quite what I'm looking for. I'd like something that would read all public properties, and perhaps methods of an object and automatically generate all necessary code to call these propereties and methods from the owning object as properties and methods of the same name.

Perhaps this is something I need to write myself, but I'd much rather be able to use a tool already out there. I'd google, but I don't know exqactly what I would google narrowly enough to be useful.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
start looking here

http://www.gotdotnet.com/team/ide/

http://blogs.msdn.com/powertoys/

Share this post


Link to post
Share on other sites
Quote:
Original post by PDHB
Hi. I'm looking for a tool to make life easier.

Suppose I have some class Core. I want to use Core as a field in another class Body, and I want Body to expose all the public methods of Core as it's own.

class Core{
...
public double Height
{
get{return this.height;}
set{this.height = value;}
}
}
Class Body{
Core myCore;
....
public double Height
{
get{return this.myCore.Height;}
set{myCore.Height = value;}
}
}

Suppose Core has 9 or 10 properties, and suppose I do this kind of thing a lot.

Is there a tool out there that would make tis faster for me? A template such that the code to expose all the public properties of myCore would be automatically generated at design time, so I don't need to do it all by hand?

By the way, how do I get the code scroll screen?


My question is this, why not use inheritance? Now, I realize that these are highly simplified examples, but if you are inheriting from something already, then you should indicate such.

Share this post


Link to post
Share on other sites
I don't want to inherit the object. One reason is that the owning object already inherits from another base class.

Share this post


Link to post
Share on other sites
Quote:
Original post by Washu
Quote:
Original post by PDHB
Hi. I'm looking for a tool to make life easier.

Suppose I have some class Core. I want to use Core as a field in another class Body, and I want Body to expose all the public methods of Core as it's own.

class Core{
...
public double Height
{
get{return this.height;}
set{this.height = value;}
}
}
Class Body{
Core myCore;
....
public double Height
{
get{return this.myCore.Height;}
set{myCore.Height = value;}
}
}

Suppose Core has 9 or 10 properties, and suppose I do this kind of thing a lot.

Is there a tool out there that would make tis faster for me? A template such that the code to expose all the public properties of myCore would be automatically generated at design time, so I don't need to do it all by hand?

By the way, how do I get the code scroll screen?


My question is this, why not use inheritance? Now, I realize that these are highly simplified examples, but if you are inheriting from something already, then you should indicate such.


That's a nice solution in some cases, but not in all cases, especially where the inheritance doesn't make sense in context. What he really needs is a refactoring tool.

Share this post


Link to post
Share on other sites
Quote:
Original post by CpMan
That's a nice solution in some cases, but not in all cases, especially where the inheritance doesn't make sense in context. What he really needs is a refactoring tool.


I admit, that is true. This appears to be more of a case of composition. But in that case, I would just provide a get method to the Core, ie:

public Core Core { get { return core_; } }

and let them access its properties through that. As it doesn't really make sense to expose the members of Core as direct members of the composing class.

Share this post


Link to post
Share on other sites
Ah, a refactoring tool. Do these typically have something like that?

One reason I didn't want to just expose core is that I didn't want to have to do this:

double height = myBody.Core.Height;

If one needs to do this across a few layers it can make readability a problem.

Another reason is information hiding. If the specification for Body requires a Height property, and I find it convenient to get this and other functionality from a class I already have, the user doesn't want to dig into the innards of Body to figure out how to get to Height.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!