What are the SOLID principles?
A set of five design guidelines for maintainable software: Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion.
What is the Single Responsibility Principle?
A class should have only one reason to change — it should handle one job or concern.
What is the Open/Closed Principle?
Classes should be open for extension but closed for modification — you extend behavior via inheritance or composition.
What is the Liskov Substitution Principle?
Objects of a subclass should be usable wherever the base class is expected, without breaking functionality.
What is the Interface Segregation Principle?
Many small, specific interfaces are better than one large, general one.
What is the Dependency Inversion Principle?
Depend on abstractions (interfaces), not concrete implementations.
Why is separation of concerns important in MVVM?
It reduces coupling between layers, making the app easier to test, extend, and maintain.
What is the role of a service class in MVVM?
To handle operations like data access, file I/O, or API calls — keeping ViewModels clean and focused.
What is the Dispatcher used for in WPF threading?
It ensures UI updates run on the main UI thread safely from background threads.
How do you update the UI from a background thread?
Use Application.Current.Dispatcher.Invoke() or Dispatcher.BeginInvoke().
Why use async/await in WPF apps?
To keep the UI responsive during long operations (e.g., database or API calls).
What is the difference between synchronous and asynchronous code?
Synchronous code blocks execution; asynchronous code continues running while awaiting completion.
What is unit testing in MVVM?
Testing ViewModels and Models independently to verify logic without launching the UI.
What is mocking in testing?
Creating fake implementations of dependencies (e.g., data services) to isolate tests.
Why is Dependency Injection helpful for testing?
It allows replacing real services with mocks or stubs during unit tests.
How should you organize folders in an MVVM project?
Typically: Models, Views, ViewModels, Services, and Resources.
What is the benefit of Commanding over code-behind event handlers?
Commands maintain MVVM separation, are reusable, and allow automatic UI enable/disable logic.