I am currently making a mobile application using firebase, but I have no experience of object-oriented development, so I'm wondering how to design a class.
My app has User data and I want to store it locally on the firebase side.
For now, I create a User class and write all of firebase and local reading and writing in it.
I don't know much about it, but I've heard that in object orientation, classes are divided into roles. In the case of my application, the User class only has User data, and I think that the processing that handles DB should create another class.
However, I don't know exactly what kind of class it should be.
How do you design a class in such cases?
If i have a good book to learn about designing a class like this, please let me know.
Thank you in advance.
The language uses C #.
Answer # 1
First, create an abstract class to save and load data.
This class has two methods as abstract methods: save method and load method.
Create a class that derives from it and saves/loads to/from Firebase and a class that saves/reads from/to files.
Both of these classes are derived from the first class you created, so you can save and load them using the same procedure.
User classes are independent of these.
If another storage location is added or Firebase is switched to another database, it will be derived from the first class as well.
- c # - about the implementation of shotguns
- c # - [windows apps] about the file format when distributing the program
- ruby - about the contents of the object-oriented design practice guide ~ reasons for using attr_reader
- c++ - about class templates t and t&
- java - about arguments of anonymous class lambda expressions
- c # - when i add the array of my class twice, both values are the same
- java - about the event class
- c # - about player prefs for unity
- Detailed explanation of model class design and display examples in Django
- php - about class access after instantiation
- php - i am worried about the db design policy that holds about 4000 data for each user
- c # - about changing the column order of datasettable in visual studio
- about c # wpf keydown event
- c # - how to use linq for a class that has list or inner class and perform conditional search and value addition (add)
- python - about writing object-oriented code
- about c # coding standards (line breaks)
- about the behavior when putting a class in an array with python
- about compiling class files in java dynamic web projects
- c # - about the solution and cause of the "parameter count mismatch" bug
- c # - i don't know the correct event design
- c # - unity) i want to use removevalue
- c # - firebase realtimedb) how to reference the rule
- c # - i want to execute a process in another class when i can log in | firebase x unity
- c # - i want to wait for the value to be obtained asynchronously in the void method
- c # - when uploading an image using firebasestoragenet, it becomes 0 bytes in firebase and the image is not displayed