nus-cs2103-AY2324S2 / forum

16 stars 0 forks source link

Advice on when to use OODMs? #1011

Closed cheahTJ closed 6 months ago

cheahTJ commented 6 months ago

I dont really see what the functionality of OODMs. What does it mean by CCDs represents the class structure of the problem domain and not their behavior?

drustanyjt commented 6 months ago

@cheahTJ I believe it can be a useful way to start architecting a solution to a real world problem.

Like in the example given: image

If you start out by directly trying to create a Class Diagram (more methods, navigability, maybe even programming language specific features?) you might have to make a lot of edits every time you realise there's a problem, because there's more information to maintain. Since the OODM has less information, it means it's easier to change and maintain when you're still in some initial planning phase.

My guess would be that in a SWE team, if you're given a new project to solve some problem, you might try to see how different parts of the problem are linked conceptually, and so start out with a OODM/CCD. Once you're fairly certain that you've got a good idea of the problem, you could easily adapt your CCD into a Class Diagram (if appropriate/necessary) with a bit more detail. Or maybe you're not even using an OOP language, so you'll need to adapt your CCD into something appropriate for your team's tech stack.

CCDs represents the class structure of the problem domain and not their behavior

I think this is just used in the same sense that Class Diagrams don't show exactly how Classes behave wrt each other: image

cheahTJ commented 6 months ago

Thank you!!

damithc commented 6 months ago

CCDs (or any domain model) is useful when analyzing the problem to be solved, even before we start thinking about how to design a solution.

dont really see what the functionality of OODMs. What does it mean by CCDs represents the class structure of the problem domain and not their behavior?

OOP is based on the view that the real world is a network of interacting objects. So, the real world has objects, and hence, classes (classes are simply 'types of objects'). So, understanding a real world problem in an OOP way involves understanding objects and classes of the real world. That's where CCDs can be used.

For example, to build a software version of the snakes-and-ladders game, we first try to understand the real world snakes-and-ladders in terms of objects and classes. For this, we can use object diagrams, and CCDs, such as the CCD cited in @drustanyjt's reply. This example is explained in more detailed in the following video.

image