Seeking Advice on Simplifying a Class with Multiple Operations on Data Pairs
This memory.cs class is a mess, is there a way to structure my code so that accessing data structures dont look so messy? Thank you in advance.
https://gist.github.com/Asriela/d69bf1028644c1a3d5f5bef771727807
Gist
Memory class which is horrible
Memory class which is horrible. GitHub Gist: instantly share code, notes, and snippets.
9 Replies
the logic is fine, it's just that it's all piled up in one class
you could group it up in some way
maybe if some type of logic gets repeated, pull out that repeating part and reuse it
you have a bunch of copy-pasted code there
For starters, organize the structure so fields are with fields (unless it's a backing field), properties with properties and methods with methods
And half this content is not part of the actual Memory class so it should be in separate files imo
Yeah i was just thinking im going to seperate it into different classes
Like location manager , pricing manager ect
No I mean all those classes like
ObjectTypeWorldObjectPair
should for example go into ObjectTypeWorldObjectPair.cs
But why? Its so little code
So its ok to have tiny bits of code in their own files?
It comforms to The Single Responsibility Principle
DEV Community
SOLID: Single Responsibility Principle(SRP) in C#
Introduction When designing software, adhering to solid principles can make a huge...
You mention clutter. Things like this make the file much bigger than it has to be, and these classes have their own responsibility not directly tied to the Memory class
thank you