Should I share the UI for objects that share common fields?

I have a parent class that contains all the fields that are common to all device types. From this, I have several derived classes, each with its own unique fields. Let's say I have a device type "Switch" and "Transformer". Both derived classes only have 2-3 of their own unique fields. When creating user interface design (window forms) in this case.

Should I create two separate forms for each device type, or should I create a custom control with all fields that are common to all devices?

Thanks.

+2


a source to share


2 answers


Create a custom control. You can inherit from this custom control to add fields to it, but because child controls will share properties and behaviors, they must inherit from a common parent.



OOD should help prevent duplicate code.

+3


a source


I would say that in your business logic layer, you can freely use OOP principles (inheritance in this case) in your presentation layer as well.



+1


a source







All Articles