RUVIDEO
Поделитесь видео 🙏

Android application development using Kotlin - 9 || MVC pattern implementation

📁 Обучение 👁️ 16 📅 01.12.2023

Next Video Url: https://www.youtube.com/watch?v=ehuwVMmlkCw&list=PLatdzn9LMmbx0q600PgpRotEV8IEYc7oI&index=11&t=82s

Playlist url: https://www.youtube.com/playlist?list=PLatdzn9LMmbx0q600PgpRotEV8IEYc7oI

In this video, we will be discussing about intent. There are two types of intents: implicit intent and explicit intent. We will learn the differences between these two and also how we can implement intent in our Android app

Instructor: Abhishek Koirala

You can contact the instructor on
Linkedin: https://www.linkedin.com/in/er-abhishek-koirala-3686b2a0/
Github: https://github.com/developeravsk
Youtube: https://www.youtube.com/channel/UCIxEgFbGBnrRn_VWAiny8jQ

In a world where the user interface logic tends to change more often than the business logic, the desktop and Web developers needed a way of separating user interface functionality. The MVC pattern was their solution.
Model — the data layer, responsible for managing the business logic and handling network or database API.
View — the UI layer — a visualisation of the data from the Model.
Controller — the logic layer, gets notified of the user’s behavior and updates the Model as needed.



So, this means that both the Controller and the View depend on the Model: the Controller to update the data, the View to get the data. But, most important for the desktop and Web devs at that time: the Model was separated and could be tested independently of the UI. Several variants of MVC appeared. The best-known ones are related to whether the Model is passive or is actively notifying that it has changed.



In around 2011, when Android started to become more and more popular, architecture questions naturally appeared. Since MVC was one of the most popular UI patterns at that time, developers tried to apply it to Android too.

If you search on StackOverflow for questions like “How to apply MVC in Android”, one of the most popular answers stated that in Android, an Activity is both the View and the Controller. Looking back, this sounds almost crazy! But, at that point, the main emphasis was on making the Model testable and usually the implementation choice for the View and the Controller was dependent on the platform.


Nowadays, the question of how to apply the MVC patterns has an answer that is easier to find. The Activities, Fragments and Views should be the Views in the MVC world. The Controllers should be separate classes that don’t extend or use any Android class, and same for the Models.

One problem arises when connecting the Controller to the View, since the Controller needs to tell the View to update. In the passive Model MVC architecture, the Controller needs to hold a reference to the View. The easiest way of doing this, while focusing on testing, is to have a BaseView interface, that the Activity/Fragment/View would extend. So, the Controller would have a reference to the BaseView.


Advantages of MVC


The Model-View-Controller pattern highly supports the separation of concerns. This advantage not only increases the testability of the code but it also makes it easier to extend, allowing a fairly easy implementation of new features.

The Model classes don’t have any reference to Android classes and are therefore straightforward to unit test. The Controller doesn’t extend or implement any Android classes and should have a reference to an interface class of the View. In this way, unit testing of the Controller is also possible.

If the Views respect the single responsibility principle then their role is just to update the Controller for every user event and just display data from the Model, without implementing any business logic. In this case, UI tests should be enough to cover the functionalities of the View.


Android development can be a great way to turn your idea into reality or start a promising career as an app developer... and getting started is probably easier than you think.

These days Android Development is done with a tool called Android Studio. Android Studio is kind of like the Microsoft Word of writing Android apps; it helps organize our projects and gives us a user friendly way to create what we’re looking for.

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Android application development using Kotlin - 9 || MVC pattern implementation», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.