I'm pretty new to OOAD. I'm trying to come up with a good design on my new project. I'll describe the problem and hope I get some ideas from some people.
Let's say you we have a class "Vehicle". This class will be used in many different industries (at least 10-15). The Vehicle class has all the "things" (horn, flasher, lights, wheels, etc.) that could be used in all industries. Depending on the industry, each "thing" will be either required, optional, or can not exist.
I did not want to create just the Vehicle class and put all logic for each diffenent industry into it. I thought that I could use inheritance and then build subclasses. The problem is, a lot of industries use the same member/things, but whether they are optional/required might be different. It seemed I'd be making a lot of subclasses which could be very similar. There really is no base set of "things" that all use - there all pretty different.
I was thinking of using interfaces to differentiate the type of Vehicle based on industry (has methods only for the required/optional things). I also thought of using a Static Utitlity Class for checking if all required data is present after the class/object is populated (error checking).
Is this a sound approach? I really didn't care too much for the interfaces either, there would be alot.
Any suggestions on a better design.
Larry
Let's say you we have a class "Vehicle". This class will be used in many different industries (at least 10-15). The Vehicle class has all the "things" (horn, flasher, lights, wheels, etc.) that could be used in all industries. Depending on the industry, each "thing" will be either required, optional, or can not exist.
I did not want to create just the Vehicle class and put all logic for each diffenent industry into it. I thought that I could use inheritance and then build subclasses. The problem is, a lot of industries use the same member/things, but whether they are optional/required might be different. It seemed I'd be making a lot of subclasses which could be very similar. There really is no base set of "things" that all use - there all pretty different.
I was thinking of using interfaces to differentiate the type of Vehicle based on industry (has methods only for the required/optional things). I also thought of using a Static Utitlity Class for checking if all required data is present after the class/object is populated (error checking).
Is this a sound approach? I really didn't care too much for the interfaces either, there would be alot.
Any suggestions on a better design.
Larry