I'm an applied physics student and currently working on a simulation of the magnetic interactions of multiple protons within a protein.
Me having only little experience with programming and almost none with OOP, there is a lot of information for me to process. Especially in terms on how to design my model in a way that is flexible and can be expanded easily later on.
So far, I've been working on my class diagram. My approach was to create a physObject
class that implements different behaviour
-interfaces. So in my case, all Protons
will implement the MagneticBaheviour
interface.
I've tried keeping my design as loosely coupled as possible for it to reusable. So later on someone might add i.e. a GravitationalBehaviour
to simulate the gravitational behaviour of physical objects.
So this is my current sketch of my class diagram. However I'm unsatisfied with some connections, and I'm not sure how to visualize my complex system in an uml diagramm. I.e. for the calculation of the ActingBField
I'll need information on the distances to other physObjects
. Also each time i.e. the location of a physObject
changes, the ActingBField
has to be calculated on every existing physObject
again.
In addition, having an acting magnetic field on a physObject
that has MagneticBehaviour
would result in the call of BlochEquations
, therefore resulting in a change of Magnetization
, resulting in a new calculation of ActingBField
. You get the idea.
So my system includes a lot of recursive patterns and the objects need to be able to pass needed information automatically when the value of an specific object changes.
My first approach was to use an Observer pattern, making my physObject
an Observable
and each Behaviour
-interface being an Observer
.
However I also read posts to event-/ case-/ state-driven programming. This also sounds like it would fit my problem, but I dont know which one to apply for a simulation. I guess I could somehow define a call condition to some methods, I have no idea how to even visualize that design though.
Last but not least, all I've been doing so far is focus on the physical model of the simulation. However for this simulation to be usable, I figured I'll need to find a way to connect this model to some kind of user, that i.e. sets the time period of the simulation or selects which data to look at.
How would I visualize that using a uml diagram? What concepts do I need to consider or completely forgot about?
Im happy for any help in the right direction and I'm grateful for anyone that made it so far. Thanks for reading ^^
GravitationalBehaviour
to simulate the gravitational behaviour of physical objects."