Posts

Showing posts from February, 2025

All about ViewModel and Its working.

Image
Hello friends hi. This post is regarding all about the ViewModel and It's working.  Well, ViewModel is the part of the MVVM ( Model-View-ViewModel ) architectural  pattern. The  ViewModel  class is a  business logic or screen level state holder . It exposes state to the UI and encapsulates related business logic. In more simple words, ViewModel is used to persist the state on configuration changes like Screen Rotation, Keypad show or hide etc. It's a lifecycle aware component which means it work with respect to the lifecycle of an Activity or Fragment. Because it associated with Views as shown in following... As we can see that the onCleared() method of the ViewModel is invoked just before the onDestroy() method of the Activity.  The tasks which are no longer need in the memory is usually written in the onCleared() method of the ViewModel. Example:- Cancellation of a Coroutine. Working of ViewModel: There are three terms  related to ViewModel to un...

Architectural patterns in Software Engineering

Image
Hello friends hi. This post is regarding all about Architectural Patterns in Software  Engineering. Architectural Patterns isn't about any specific domain like Android or Web, It is common to all software development environment. Architectural Pattern is very important for building a robust, maintainable and testable software because its main pillar is the Separation of Concern that separate the business layer with the UI layer and provide a handy testing environment. So an architectural pattern is a concept that solves and delineates some essential cohesive elements of a software architecture. Countless different architectures may implement the same pattern and share the related characteristics. Patterns are often defined as "strictly described and commonly available" In Android application development there are mainly three architectural patterns which are as... 1)- MVC (Model-View-Controller) 2)- MVP (Model-View-Presenter) 3)- MVVM (Model-View-ViewModel) So let discuss...