Database Guy Asks: Object-Oriented Design Theory?

前端 未结 14 573
深忆病人
深忆病人 2021-02-04 20:34

I\'ve worked with designing databases for a loooong time, and these days I\'m working in C# too. OO makes sense to me, but I don\'t feel that I have a good grounding in the dee

14条回答
  •  隐瞒了意图╮
    2021-02-04 21:06

    Model your objects by keeping real world objects in mind.

    We are currently developing automation software for machines. One of those machines has two load ports for feeding it raw material, while all others have only one. In all modules so far, we had the information of the ports (current settings, lot number currently assigned to it etc) as members in the class representing the machine.

    We decided to create a new class that holds the information of the ports, and add two LoadPort members to this MachineXY class. If we had thought about it before, we would have done the same for all those single port machines...

提交回复
热议问题