G
Guest
Hello,
This isn't specific to C#, but that is what I am using to develop my app. I
am trying to figure out how to organize my code and I'm not sure what the
best way of doing it is. For the sake of simplicity let's say I have three
classes - car, engine, and body. The car class has an instance of engine and
body.
Each class has a "build" method. The car build method calls engine.build and
body.build. I have an interface that has a visual representation of the car.
When a property is modified in the engine I call engine.build. However, I
have to pass it a reference to the car object.
I don't want to build the entire car everytime a property is modified.
Should I move the build methods into the car class? So I would have
BuildEngine and BuildBody? Or what is the best way to approach this?
Thanks for any help, I really appreciate it.
Thanks,
Nick
This isn't specific to C#, but that is what I am using to develop my app. I
am trying to figure out how to organize my code and I'm not sure what the
best way of doing it is. For the sake of simplicity let's say I have three
classes - car, engine, and body. The car class has an instance of engine and
body.
Each class has a "build" method. The car build method calls engine.build and
body.build. I have an interface that has a visual representation of the car.
When a property is modified in the engine I call engine.build. However, I
have to pass it a reference to the car object.
I don't want to build the entire car everytime a property is modified.
Should I move the build methods into the car class? So I would have
BuildEngine and BuildBody? Or what is the best way to approach this?
Thanks for any help, I really appreciate it.
Thanks,
Nick