🌉 bridged from @MortySmith@programming.dev by Tidepool
MortySmith
@mortysmith.programming.dev.ap.tdpl.io
I am a USA-based iOS dev with limited experience in backend. I lost all passion for front end and realized that I enjoy backend much more. How difficult is it going to be to transition in this market?
I have been laid off from my job for a couple of months now. (CS degree/ 4 years experience)
Please don’t just tell me to stick with iOS dev because I just cannot see myself doing it anymore. I literally only sticked with iOS dev because I thought that apps were going to be the future and that all companies needed apps, but it was the other way around, all companies need backend. Looking back a lot of my career decisions were driven by ignorance and Fomo
Should the business logic go in the model or in the view model?
The internet keeps telling me that they go in the model, but some developers tell me that it goes in the view model
Model (Data / Networking / Algorithms) objects represent special knowledge and expertise. They hold an application’s data and define the logic that manipulates that data. https://developer.apple.com/forums/thread/699003
Therefore, the model can be thought of as representing the app's domain model, which usually includes a data model along with business and validation logic. https://learn.microsoft.com/en-us/dotnet/architecture/maui/mvvm
Model: Contains the data or the business logic. Any changes in data are communicated to the ViewModel. https://medium.com/@dilipp817/understanding-mvvm-architecture-a-beginners-guide-to-model-view-viewmodel-8fb05c285710
The Model's purpose is to represent (or model) your business domain. Therefore, business logic by definition goes in the Model, not the ViewModel.https://developer.apple.com/forums/thread/699003 https://stackoverflow.com/questions/37671866/should-i-implement-business-logic-on-a-model-or-a-viewmodel
Even though the vast majority of business logic is present in the data layer, the UI layer can also contain business logic. This can be the case when combining data from multiple repositories to create the screen UI state, or when a particular type of data doesn't require a data layer.\ ViewModel is the right place to handle business logic in the UI layer. The ViewModel is also in charge of handling events and delegating them to other layers of the hierarchy when business logic needs to be applied to modify application data. https://developer.android.com/topic/libraries/architecture/viewmodel