0

In an android project, I don't see how the following architecture can be considered MVC.

The team said:

  • Android apps are fundamentally MVC
  • the Controller is the Android Activity.
  • the MVC View is the Android View.

This does not look like a correct MVC architecture to me,

so I disagreed because:

  • they handle input events in their android view and act on the model directly
  • then again some inputs are handled in the Activity...
  • which means the Activity and Android View are cluttered with the MVC Controller / View responsibilities
  • the Android View does not only draw / display the model but contains logic and is therefore not easily interchangeable
  • there are several reasons for each of the classes to change

Did I totally misunderstand the MVC Architecture? The only thing I see here is that they definitely have a Model. But that's everything I can agree upon.

off topic: I recently started as a working student and I'm at the beginning of my CS studies as well and need some reassurance because I'm an effin noob. Everything I learned seems to be ignored in this company. No daily builds or unit testing, no comments, no documentation. When I talk to the supervisor, they don't need any of this.

2 Answers 2

2

A well-built Android project is usually a good example of the MVC architecture.

they handle input events in their android view

...

the Android View does not only draw / display the model but contains logic

When conforming to the Android guidelines, this doesn't happen. You define code to handle the user input in an Activity (or a Fragment), not in the view itself. You'd need to subclass a View to implement this; unless the team uses a lot of self-designed controls, this simply doesn't happen.

What can happen is known (in iOS, but the same holds for Android) as the Massive View Controller syndrome. E.g. it's very common to see code for communication with an external (web) service in the Activity, while networking code should actually be put outside the MVC architecture.

0

Your question mixes theory and practise.

In theory an activity could be seen/implemented as the thin controller of a MVC where the Android specific intent is something similar to a URL of web apps.

In reality many (most?) Android apps are implemented where a lot of code is inside the activity and not separated into different MVC specific layers. This is not MVC.

My own Android apps (and probably many others, too) only separate the Model from the GUI but do not separate the view from the controller.

In my own debatable opinion, using MVC or MVVM is not helpful in Android context. In practical Android programming I do not see any advantage to split the GUI into view and controller or into view and viewmodel. This might be different if you want to do unit-testing of view/controller/viewmodel which I do not do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.