How do i get flexible/easily interchangeable code?

Started by
10 comments, last by Alberth 7 years, 4 months ago

Thanks for all the answers so far , ofc the answers of "do it simple" are not quite reason for me to jump of joy, but I appreciate them nonetheless.

After taking a good look at the buffsystems let me explain my current thought and problems:

I am splitting modifiiers of variables into +x1,+x2%,*x3 and provide an double[3] modifiers for x instead of x itself to access from outside the method and I have a variable that points to an outermost wrapper(Object starter) so I can modify and overwrite the method. Now I seperate simple variable modifications and keep them in a list to reduce the amount of wrappers needed, each of these simple modifications will have an apply and remove method so I do not add up modifiiers every time I call the method.

The big problem for me is how to handle the removal, will each wrapper or simple modifier need a remove boolean to check each time its executed, do I trust for example a buildings demolish instruction and instead of a list I use a map to easier find the modifiers to be used. Do I keep a seperate list for timed modifiers so I can check each time if they expire?

When you have nothing to say,I advise you talk nonsense :D
Advertisement

The big problem for me is how to handle the removal
At some point you have to trust your environment. The problem of how much can be a tough one.

You may want to consider a sort of risk analysis.

1. How likely is it that the other code messes up? (by accident mostly, intentional bad behavior is pretty much not solvable)

2. How hard is it going to be, to find the above code if a problem arises?

This topic is closed to new replies.

Advertisement