This document discusses Android application architecture and recommended patterns and libraries. It recommends using architectural patterns like MVP and Clean Architecture to help organize an app's code and make it easier to test, maintain and extend. It provides examples of implementing MVP in an Android to-do app, including separating the view, presenter and model layers. It also discusses architectural tools and libraries that can be used with MVP like Dagger for dependency injection and RxJava for reactive programming.
This document describes Christian Panadero's "My Way to Clean Android" architecture. It advocates for separating an Android app into independent and testable layers including UI, domain/entities, repository, and data sources. It discusses concepts like dependency injection, abstractions, use cases/interactors, and MVP pattern. It provides examples of implementing clean architecture principles in Android through features like repositories that abstract data sources, dependency rules between layers, and handling threading through decorators.
My way to clean android - Android day salamanca editionChristian Panadero
Christian Panadero presented an approach called "My way to clean Android" which focuses on clean architecture principles like separation of concerns, testability, and decoupling. The key aspects discussed include using commands, interactors, abstractions, repositories, and data sources to separate layers. Dependencies follow a one-way rule from upper to lower layers. Examples demonstrate how to model projects with clean architecture, including MVP for the UI, repositories to abstract data sources, and strategies like caching. Advice includes working with abstractions, good naming, and starting in the correct layer. The clean code approach and references from experts like Uncle Bob and others are cited. Source code is provided on GitHub for further review.
Christian Panadero presented an overview of his "My Way to Clean Android v2" approach. The approach advocates for decoupling the app from frameworks, UI, BDD, and any implementation details. It utilizes concepts like the command pattern, decorator pattern, interactors, abstractions, repositories, and data sources. The approach models the app with layers including presentation, domain/entities, repository, and data sources. It aims to make implementation details swappable and follow dependency rules.
My way to clean android (EN) - Android day salamanca editionChristian Panadero
This document summarizes Christian Panadero's presentation on "My way to clean Android". It discusses clean architecture principles for Android applications, including separating components by abstraction level and dependency rules. It outlines the project structure with separate modules for presentation, domain, and data layers. It also provides examples of interactions between these layers using common design patterns like MVP, repositories, and dependency injection. The goal is to make implementations swappable and the codebase independent of frameworks and external factors for maximum testability and flexibility.
The document provides an overview of how to create Gradle plugins by:
1) Putting plugin code in the buildSrc folder to compile it into the build classpath.
2) Creating a plugin class that implements the Plugin interface and applies extensions and tasks.
3) Exposing extensions and tasks to the build script by applying the plugin.
4) Calling methods on the extensions and configuring tasks from the build script.
The document discusses automated testing of Android applications using Espresso. It covers why automated testing is important, where to use Espresso vs other frameworks like Robolectric depending on the app layer being tested, basic Espresso testing code examples, and 5 tips for writing effective Espresso tests including using page objects, minimizing dependencies, making instances configurable, wrapping Espresso APIs, and avoiding sleeps for asynchronous waits.
Dagger 2 is a dependency injection framework that allows for decoupling of classes through injection of dependencies. It uses modules to provide dependencies, with @Inject used to request dependencies and @Component linking modules and injections. Classes request dependencies through constructor injection or field injection with @Inject. Dagger manages the lifecycle and scoping of dependencies through its component and subcomponent functionality.
Testing Android apps based on Dagger and RxJavaFabio Collini
In this talk, you will learn:
how to take advantage of Mockito and other libraries to write good JVM and Espresso tests
how to use DaggerMock (an open source library available on github https://github.com/fabioCollini/DaggerMock) to avoid boilerplate code in tests
how to test asynchronous RxJava code using a JVM test
Writing reliable tests is not easy for many reasons, especially when asynchronous code is involved. Some libraries can be used to create a testable architecture (for example Dagger and RxJava) and to simplify testing (Mockito, AssertJ and DaggerMock). In this talk we’ll see how to write JVM and Espresso tests with particular attention on how to replace real objects with mocks and how to test asynchronous RxJava code.
This document describes Christian Panadero's "My Way to Clean Android" architecture. It advocates for separating an Android app into independent and testable layers including UI, domain/entities, repository, and data sources. It discusses concepts like dependency injection, abstractions, use cases/interactors, and MVP pattern. It provides examples of implementing clean architecture principles in Android through features like repositories that abstract data sources, dependency rules between layers, and handling threading through decorators.
My way to clean android - Android day salamanca editionChristian Panadero
Christian Panadero presented an approach called "My way to clean Android" which focuses on clean architecture principles like separation of concerns, testability, and decoupling. The key aspects discussed include using commands, interactors, abstractions, repositories, and data sources to separate layers. Dependencies follow a one-way rule from upper to lower layers. Examples demonstrate how to model projects with clean architecture, including MVP for the UI, repositories to abstract data sources, and strategies like caching. Advice includes working with abstractions, good naming, and starting in the correct layer. The clean code approach and references from experts like Uncle Bob and others are cited. Source code is provided on GitHub for further review.
Christian Panadero presented an overview of his "My Way to Clean Android v2" approach. The approach advocates for decoupling the app from frameworks, UI, BDD, and any implementation details. It utilizes concepts like the command pattern, decorator pattern, interactors, abstractions, repositories, and data sources. The approach models the app with layers including presentation, domain/entities, repository, and data sources. It aims to make implementation details swappable and follow dependency rules.
My way to clean android (EN) - Android day salamanca editionChristian Panadero
This document summarizes Christian Panadero's presentation on "My way to clean Android". It discusses clean architecture principles for Android applications, including separating components by abstraction level and dependency rules. It outlines the project structure with separate modules for presentation, domain, and data layers. It also provides examples of interactions between these layers using common design patterns like MVP, repositories, and dependency injection. The goal is to make implementations swappable and the codebase independent of frameworks and external factors for maximum testability and flexibility.
The document provides an overview of how to create Gradle plugins by:
1) Putting plugin code in the buildSrc folder to compile it into the build classpath.
2) Creating a plugin class that implements the Plugin interface and applies extensions and tasks.
3) Exposing extensions and tasks to the build script by applying the plugin.
4) Calling methods on the extensions and configuring tasks from the build script.
The document discusses automated testing of Android applications using Espresso. It covers why automated testing is important, where to use Espresso vs other frameworks like Robolectric depending on the app layer being tested, basic Espresso testing code examples, and 5 tips for writing effective Espresso tests including using page objects, minimizing dependencies, making instances configurable, wrapping Espresso APIs, and avoiding sleeps for asynchronous waits.
Dagger 2 is a dependency injection framework that allows for decoupling of classes through injection of dependencies. It uses modules to provide dependencies, with @Inject used to request dependencies and @Component linking modules and injections. Classes request dependencies through constructor injection or field injection with @Inject. Dagger manages the lifecycle and scoping of dependencies through its component and subcomponent functionality.
Testing Android apps based on Dagger and RxJavaFabio Collini
In this talk, you will learn:
how to take advantage of Mockito and other libraries to write good JVM and Espresso tests
how to use DaggerMock (an open source library available on github https://github.com/fabioCollini/DaggerMock) to avoid boilerplate code in tests
how to test asynchronous RxJava code using a JVM test
Writing reliable tests is not easy for many reasons, especially when asynchronous code is involved. Some libraries can be used to create a testable architecture (for example Dagger and RxJava) and to simplify testing (Mockito, AssertJ and DaggerMock). In this talk we’ll see how to write JVM and Espresso tests with particular attention on how to replace real objects with mocks and how to test asynchronous RxJava code.
A simple talk about appliyng patterns in Javascript.
It focuses in both jQuery and Angular.
It explains some basics MVC, cohesion and coupling.
It also have many examples of the patterns applied.
Full examples and documentation can be found here: http://david-rodenas.com/tutorial-jspatterns-v1/
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo Ali Parmaksiz
This document summarizes a presentation about developing a MVP application using GWT, Spring Roo, and deploying it to CloudFoundry. The presentation covers MVP pattern in GWT, using activities and places for navigation, using Spring Roo for rapid development, and deploying the application to CloudFoundry. It provides code examples for implementing MVP using views, presenters, activities and places. It also outlines the steps to deploy an application to CloudFoundry including installing the vmc CLI and pushing the application.
The document describes how to configure Spring MVC to resolve method arguments from the HTTP session. It defines a SessionAttributeArgumentResolver class that implements HandlerMethodArgumentResolver to retrieve attributes from the session based on a key. It also shows how to register the resolver with the WebMvcConfigurer to make it available to controller methods. Finally, it provides an example of how to configure method security in Spring using annotations or Java configuration.
This document provides an introduction to Retrofit 2 and RxJava 2. It discusses how Retrofit allows turning a REST API into a Java interface and how RxJava implements reactive programming with observable sequences. It demonstrates making synchronous and asynchronous HTTP requests with Retrofit and handling the "callback hell" problem with RxJava. Operators like map, flatMap, zip and concatMap are shown to transform and combine observables. The document emphasizes that RxJava contains over 400 methods and discusses additional RxJava concepts like error handling and threading.
Testing Android apps based on Dagger and RxJava Droidcon UKFabio Collini
Writing reliable tests is not easy for many reasons, especially when asynchronous code is involved. Some libraries can be used to create a testable architecture (for example Dagger and RxJava) and to simplify testing (Mockito, AssertJ and DaggerMock). In this talk you'll learn how to write JVM and Espresso tests with particular attention on how to replace real objects with mocks and how to test asynchronous RxJava code. In this talk, you will also explore:
how to take advantage of Mockito and other libraries to write good JVM and Espresso tests in both Java and Kotlin
how to use DaggerMock (an open source library available on github to avoid boilerplate code in tests
how to test asynchronous RxJava code using a JVM test
This document provides an introduction to Retrofit and RxJava. It discusses:
1. How Retrofit turns REST APIs into Java interfaces and handles JSON conversion.
2. What RxJava is and how it allows for composing asynchronous and event-based programs using observable sequences.
3. Examples of making HTTP requests with Retrofit, including defining services, making synchronous and asynchronous requests, and using callbacks and RxJava.
4. Key RxJava concepts like Observables, operators like map, flatMap, and zip, and threading.
In 2008 Android app code had a lot of boilerplate, and was very error prone.
More code.. more bugs!
Now it doesn't have to be... but that is an option that each developer needs to take!
This document provides an overview of modern Android development techniques including application architecture patterns like MVC, MVP and MVVM. It discusses topics like dependency injection with Dagger 2, reactive programming with RxJava, HTTP libraries like Retrofit and OkHttp, annotations, testing, using Kotlin and the future of Android development targeting the next billion users across more devices.
Dependency Injection for Android @ Ciklum speakers corner Kiev 29. May 2014First Tuesday Bergen
We are happy to invite you to the Speakers’ Corner today, on Thursday May 29, from 18.30 till 19.30 at SkyPoint to meet Thomas Vervik, Head of Development Bipper Communications who will talk on “How to save money on QA - Dependency Injection and automated testing on Android”
Thomas is Head of Development for Bipper Communications, and has been managing the company's team in Kiev since February 2012. Originally a seasoned Java server backend/frontend developer, he has the last two years started mobile development, first with HTML 5 and later Android.
Mobile development has since its birth around 2008 gone from simple apps to more complex enterprise similar software. The increase in size and complexity yields the need for structuring the code differently in order to handle the new complexity. The tools used to handle this complexity has been applied to server side development for years, but mobile development has been lagging behind.
But not anymore. New frameworks built on proven paradigms are emerging, and in this Speakers Corner we will introduce Dependency Injection for Android, the motivation for its use, and one of the implementations - Dagger. Dependency Injection has several advantages, but in this presentation we will focus on how it enables to write proper automated tests.
We are happy to invite you to the Speakers’ Corner today, on Thursday May 29, from 18.30 till 19.30 at SkyPoint to meet Thomas Vervik, Head of Development Bipper Communications who will talk on “How to save money on QA - Dependency Injection and automated testing on Android”
Thomas is Head of Development for Bipper Communications, and has been managing the company's team in Kiev since February 2012. Originally a seasoned Java server backend/frontend developer, he has the last two years started mobile development, first with HTML 5 and later Android.
Mobile development has since its birth around 2008 gone from simple apps to more complex enterprise similar software. The increase in size and complexity yields the need for structuring the code differently in order to handle the new complexity. The tools used to handle this complexity has been applied to server side development for years, but mobile development has been lagging behind.
But not anymore. New frameworks built on proven paradigms are emerging, and in this Speakers Corner we will introduce Dependency Injection for Android, the motivation for its use, and one of the implementations - Dagger. Dependency Injection has several advantages, but in this presentation we will focus on how it enables to write proper automated tests.
Test or Go Fishing - a guide on how to write better Swift for iOSPaul Ardeleanu
The document discusses test-driven development (TDD) and behavior-driven development (BDD). It explains that TDD relies on writing tests before code to verify requirements and that BDD combines TDD techniques with domain-driven design principles. An example of writing unit tests for a Task struct in Swift using the Xcode testing framework is provided, demonstrating the TDD process of writing a failing test, then code to pass the test, and refactoring.
This document provides an overview of RxAndroid and RxJava. It discusses key concepts like Observables that emit items, Subscribers that receive emitted items and complete/error notifications, and Operators like map that transform Observables. It shows how to create a simple Observable, subscribe to it, and use operators like map. It also demonstrates integrating Rx with Android by observing button clicks and updating UI, merging multiple Observables, and using scan to increment a counter and calculate a running sum from emitted values.
How difficult is to automatically test the HelloWorld.
We fix it and other many difficult scenarios with techniques like:
- lower "s" singleton
- law of demeter
- dependency injection
- and more examples
This document discusses using Spring features within Grails applications. It begins by providing an overview of main Spring functions such as the bean container and dependency injection. It then discusses how Grails services are Spring beans that can be configured and made transactional. The document also covers manually wiring dependencies, bean scopes, lifecycles, aliases, and internationalization. It concludes by discussing how to create Spring MVC controllers in Grails.
This is the support of a course to teach React programming for Java and C# programmers. It covers from its origins in Facebook til separation of presentational and container components. What is JSX, rules, state, props, refactoring, conditionals, repeats, forms, synchronizing values, composition, and so on.
Test or Go Fishing - A guide on how to write better Swift for iOSPaul Ardeleanu
The document discusses test-driven development (TDD) and behavior-driven development (BDD). It explains that TDD relies on writing tests before code to verify requirements and that BDD combines TDD techniques with domain-driven design principles to facilitate collaboration. An example of writing unit tests for a Task struct in Swift using the Xcode test framework is also provided.
RxJs - demystified provides an overview of reactive programming and RxJs. The key points covered are:
- Reactive programming focuses on propagating changes without explicitly specifying how propagation happens.
- Observables are at the heart of RxJs and emit values in a push-based manner. Operators allow transforming, filtering, and combining observables.
- Common operators include map, filter, reduce, buffer, and switchMap. Over 120 operators exist for tasks like error handling, multicasting, and conditional logic.
- Marble diagrams visually demonstrate how operators transform observable streams.
- Creating observables from events, promises, arrays and iterables allows wrapping different data sources in a uniform API
This document summarizes challenges that large apps face with multidex and reducing APK size. It discusses how multidex allows apps to have multiple dex files if the methods exceed 65,536 or the dex file size is over 5MB. It also provides tips for using multidex in Gradle builds and compressing sub-dex files to reduce the APK size. Additionally, it suggests deferring sub-dex installation to a worker thread, moving splash activities to the main dex, and using techniques like resource proguarding, icon fonts, and image compression to further reduce the APK size.
The document discusses issues that can occur with Android applications that have a large number of methods:
1. Having over 65,535 methods can cause build failures due to Dalvik's use of 16-bits to index methods.
2. Having a single dex file over 5MB in size can cause installation to fail for Android versions before 2.3 due to Dalvik's 5MB linearAlloc size limit.
3. The MultiDex library allows applications to split dex files into multiple files to overcome these issues by modifying the Gradle configuration and Application class to extend MultiDexApplication.
A simple talk about appliyng patterns in Javascript.
It focuses in both jQuery and Angular.
It explains some basics MVC, cohesion and coupling.
It also have many examples of the patterns applied.
Full examples and documentation can be found here: http://david-rodenas.com/tutorial-jspatterns-v1/
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo Ali Parmaksiz
This document summarizes a presentation about developing a MVP application using GWT, Spring Roo, and deploying it to CloudFoundry. The presentation covers MVP pattern in GWT, using activities and places for navigation, using Spring Roo for rapid development, and deploying the application to CloudFoundry. It provides code examples for implementing MVP using views, presenters, activities and places. It also outlines the steps to deploy an application to CloudFoundry including installing the vmc CLI and pushing the application.
The document describes how to configure Spring MVC to resolve method arguments from the HTTP session. It defines a SessionAttributeArgumentResolver class that implements HandlerMethodArgumentResolver to retrieve attributes from the session based on a key. It also shows how to register the resolver with the WebMvcConfigurer to make it available to controller methods. Finally, it provides an example of how to configure method security in Spring using annotations or Java configuration.
This document provides an introduction to Retrofit 2 and RxJava 2. It discusses how Retrofit allows turning a REST API into a Java interface and how RxJava implements reactive programming with observable sequences. It demonstrates making synchronous and asynchronous HTTP requests with Retrofit and handling the "callback hell" problem with RxJava. Operators like map, flatMap, zip and concatMap are shown to transform and combine observables. The document emphasizes that RxJava contains over 400 methods and discusses additional RxJava concepts like error handling and threading.
Testing Android apps based on Dagger and RxJava Droidcon UKFabio Collini
Writing reliable tests is not easy for many reasons, especially when asynchronous code is involved. Some libraries can be used to create a testable architecture (for example Dagger and RxJava) and to simplify testing (Mockito, AssertJ and DaggerMock). In this talk you'll learn how to write JVM and Espresso tests with particular attention on how to replace real objects with mocks and how to test asynchronous RxJava code. In this talk, you will also explore:
how to take advantage of Mockito and other libraries to write good JVM and Espresso tests in both Java and Kotlin
how to use DaggerMock (an open source library available on github to avoid boilerplate code in tests
how to test asynchronous RxJava code using a JVM test
This document provides an introduction to Retrofit and RxJava. It discusses:
1. How Retrofit turns REST APIs into Java interfaces and handles JSON conversion.
2. What RxJava is and how it allows for composing asynchronous and event-based programs using observable sequences.
3. Examples of making HTTP requests with Retrofit, including defining services, making synchronous and asynchronous requests, and using callbacks and RxJava.
4. Key RxJava concepts like Observables, operators like map, flatMap, and zip, and threading.
In 2008 Android app code had a lot of boilerplate, and was very error prone.
More code.. more bugs!
Now it doesn't have to be... but that is an option that each developer needs to take!
This document provides an overview of modern Android development techniques including application architecture patterns like MVC, MVP and MVVM. It discusses topics like dependency injection with Dagger 2, reactive programming with RxJava, HTTP libraries like Retrofit and OkHttp, annotations, testing, using Kotlin and the future of Android development targeting the next billion users across more devices.
Dependency Injection for Android @ Ciklum speakers corner Kiev 29. May 2014First Tuesday Bergen
We are happy to invite you to the Speakers’ Corner today, on Thursday May 29, from 18.30 till 19.30 at SkyPoint to meet Thomas Vervik, Head of Development Bipper Communications who will talk on “How to save money on QA - Dependency Injection and automated testing on Android”
Thomas is Head of Development for Bipper Communications, and has been managing the company's team in Kiev since February 2012. Originally a seasoned Java server backend/frontend developer, he has the last two years started mobile development, first with HTML 5 and later Android.
Mobile development has since its birth around 2008 gone from simple apps to more complex enterprise similar software. The increase in size and complexity yields the need for structuring the code differently in order to handle the new complexity. The tools used to handle this complexity has been applied to server side development for years, but mobile development has been lagging behind.
But not anymore. New frameworks built on proven paradigms are emerging, and in this Speakers Corner we will introduce Dependency Injection for Android, the motivation for its use, and one of the implementations - Dagger. Dependency Injection has several advantages, but in this presentation we will focus on how it enables to write proper automated tests.
We are happy to invite you to the Speakers’ Corner today, on Thursday May 29, from 18.30 till 19.30 at SkyPoint to meet Thomas Vervik, Head of Development Bipper Communications who will talk on “How to save money on QA - Dependency Injection and automated testing on Android”
Thomas is Head of Development for Bipper Communications, and has been managing the company's team in Kiev since February 2012. Originally a seasoned Java server backend/frontend developer, he has the last two years started mobile development, first with HTML 5 and later Android.
Mobile development has since its birth around 2008 gone from simple apps to more complex enterprise similar software. The increase in size and complexity yields the need for structuring the code differently in order to handle the new complexity. The tools used to handle this complexity has been applied to server side development for years, but mobile development has been lagging behind.
But not anymore. New frameworks built on proven paradigms are emerging, and in this Speakers Corner we will introduce Dependency Injection for Android, the motivation for its use, and one of the implementations - Dagger. Dependency Injection has several advantages, but in this presentation we will focus on how it enables to write proper automated tests.
Test or Go Fishing - a guide on how to write better Swift for iOSPaul Ardeleanu
The document discusses test-driven development (TDD) and behavior-driven development (BDD). It explains that TDD relies on writing tests before code to verify requirements and that BDD combines TDD techniques with domain-driven design principles. An example of writing unit tests for a Task struct in Swift using the Xcode testing framework is provided, demonstrating the TDD process of writing a failing test, then code to pass the test, and refactoring.
This document provides an overview of RxAndroid and RxJava. It discusses key concepts like Observables that emit items, Subscribers that receive emitted items and complete/error notifications, and Operators like map that transform Observables. It shows how to create a simple Observable, subscribe to it, and use operators like map. It also demonstrates integrating Rx with Android by observing button clicks and updating UI, merging multiple Observables, and using scan to increment a counter and calculate a running sum from emitted values.
How difficult is to automatically test the HelloWorld.
We fix it and other many difficult scenarios with techniques like:
- lower "s" singleton
- law of demeter
- dependency injection
- and more examples
This document discusses using Spring features within Grails applications. It begins by providing an overview of main Spring functions such as the bean container and dependency injection. It then discusses how Grails services are Spring beans that can be configured and made transactional. The document also covers manually wiring dependencies, bean scopes, lifecycles, aliases, and internationalization. It concludes by discussing how to create Spring MVC controllers in Grails.
This is the support of a course to teach React programming for Java and C# programmers. It covers from its origins in Facebook til separation of presentational and container components. What is JSX, rules, state, props, refactoring, conditionals, repeats, forms, synchronizing values, composition, and so on.
Test or Go Fishing - A guide on how to write better Swift for iOSPaul Ardeleanu
The document discusses test-driven development (TDD) and behavior-driven development (BDD). It explains that TDD relies on writing tests before code to verify requirements and that BDD combines TDD techniques with domain-driven design principles to facilitate collaboration. An example of writing unit tests for a Task struct in Swift using the Xcode test framework is also provided.
RxJs - demystified provides an overview of reactive programming and RxJs. The key points covered are:
- Reactive programming focuses on propagating changes without explicitly specifying how propagation happens.
- Observables are at the heart of RxJs and emit values in a push-based manner. Operators allow transforming, filtering, and combining observables.
- Common operators include map, filter, reduce, buffer, and switchMap. Over 120 operators exist for tasks like error handling, multicasting, and conditional logic.
- Marble diagrams visually demonstrate how operators transform observable streams.
- Creating observables from events, promises, arrays and iterables allows wrapping different data sources in a uniform API
This document summarizes challenges that large apps face with multidex and reducing APK size. It discusses how multidex allows apps to have multiple dex files if the methods exceed 65,536 or the dex file size is over 5MB. It also provides tips for using multidex in Gradle builds and compressing sub-dex files to reduce the APK size. Additionally, it suggests deferring sub-dex installation to a worker thread, moving splash activities to the main dex, and using techniques like resource proguarding, icon fonts, and image compression to further reduce the APK size.
The document discusses issues that can occur with Android applications that have a large number of methods:
1. Having over 65,535 methods can cause build failures due to Dalvik's use of 16-bits to index methods.
2. Having a single dex file over 5MB in size can cause installation to fail for Android versions before 2.3 due to Dalvik's 5MB linearAlloc size limit.
3. The MultiDex library allows applications to split dex files into multiple files to overcome these issues by modifying the Gradle configuration and Application class to extend MultiDexApplication.
The document introduces RxJava and how it can be used in Android applications, describing key concepts like Observables, Observers, Operators, and Subjects that allow asynchronous and event-based code to be written in a reactive style. It provides examples of how RxJava can be used to fetch toilet data from an API and handle the asynchronous response more declaratively compared to using callbacks. The document also discusses how subjects can act as both observables that emit events and observers that receive events, making them useful for building event buses between activities.
This document contains slides from a presentation on preparing for and solving algorithms questions in coding interviews. It discusses typical coding interview processes, common question types like design questions and algorithms, and strategies for approaching different types of problems. Key points covered include identifying bottlenecks, unnecessary work, and duplicated work when optimizing solutions, using data structures to improve time/space tradeoffs, breaking problems down with recursion, and walking through examples step-by-step.
How to build a scalable SNS via Polling & PushMu Chun Wang
This document discusses building scalable social networking services (SNS) using polling and push mechanisms. It describes various sync mechanisms like polling, long polling, websockets, and Engine.IO. It then discusses using polling for real-time updates versus using push notifications. The document outlines how push notifications would work on the server and client sides. It also covers RESTful API design principles and examples.
This document discusses architecture components for building modern Android applications. It covers common app architecture problems and principles like separation of concerns. It introduces key Architecture Components like Activities, Fragments, Services, ContentProviders, ViewModels and LiveData. It also discusses architectural patterns like MVC, MVP, MVVM and recommendations like clean architecture. The document emphasizes principles like modularity, separation of concerns, and testability. It provides an overview of alternatives like Room, Paging Library, and recommendations for legacy apps.
This document discusses architecture components for building modern Android applications. It covers common app architecture problems and principles like separation of concerns. It introduces key Architecture Components like Activities, Fragments, Services, ContentProviders, ViewModels and LiveData. It also discusses architectural patterns like MVC, MVP, MVVM and recommendations like clean architecture. The document emphasizes principles like modularity, separation of concerns, and testability. It provides an overview of alternatives like Room, Paging Library, and recommendations for legacy apps.
This document provides a step-by-step guide to build a To-Do app with Flutter. It discusses creating the app structure, data model, displaying and creating tasks, adding state management and navigation. It also covers integrating Firebase authentication to add a login screen. Key aspects covered include creating routes, callbacks to handle state changes, and using Firebase APIs to authenticate users. The guide is intended to help learn Flutter development and understand how to build a complete To-Do app with features like data storage and user authentication.
This document provides an overview of best practices for Android development. It discusses topics such as UI design, including layouts and styles; using the action bar for search and progress indicators; accessibility; network connections; asynchronous tasks and services; fragments and navigation patterns; geolocation and performance; dependency injection; and recommended tools and libraries. The document provides code snippets and links to the Android developer documentation for further information on these topics.
The world of open source libraries and tools is vast for Android developers. Writing apps using solely Android SDK is impractical. Libraries can help you in many ways. They can speed up your development, save you creating boilerplate code and dealing with platform fragmentation, simplify your code and make it more readable and maintainable. In the talk I’m showing how several truly useful libraries can help a developer.
Presented at MobCon Europe 2017.
The document discusses building user interfaces with React, a JavaScript library for building user interfaces created by Facebook. It provides an overview of React fundamentals and walks through building a to-do app as an example, demonstrating components like AddToDoBox, ToDoList, and ToDo to display and manage to-do items. The to-do app allows users to add, remove, and view to-do tasks using React components and managing local component state.
Esta charla comprende las lecciones aprendidas convirtiendo la app de Android de Teambox (una app repleta de deuda técnica y con un alto nivel de acoplamiento entre clases), en la versión actual de Redbooth, que intenta cumplir la arquitectura Hexagonal y los principios SOLID. Durante la exposición explicaremos como fuimos desenredando el código paso a paso; como aplicamos por partes los conceptos de la arquitectura hexagonal; como dejamos de lado componentes del framework de Android que dificultaban el mantenimiento de la app; y que errores cometimos, como los solucionamos y como se podrían haber evitado.
This document discusses microservices architectures and provides examples of tools used in microservices architectures like those implemented at Netflix. It describes common microservices patterns like service discovery (Eureka), configuration management (Archaius), load balancing (Ribbon), circuit breaking (Hystrix), monitoring (Turbine), edge services (Zuul), and logging (Blitz4j). It also discusses using these tools with Spring Cloud and provides code samples for configuring services using Netflix OSS and Spring Cloud.
This summarizes an Android developer toolbox document. The document provides recommendations for 5 categories of Android libraries: 1) Libraries, 2) Networking, 3) Databases, 4) Images, and 5) Utilities. Key libraries recommended include Retrofit, Glide, Realm, Dagger 2, and EventBus. The document provides brief descriptions and links for each library.
The document discusses a presentation given at Droidcon 2015 about the Titanium/Appcelerator application development platform. The presentation covered the benefits of Titanium, such as code reuse across platforms and leveraging existing web development skills. It demonstrated building a simple weather app in Titanium and discussed lessons learned around installation/IDEs, debugging, community support and when Titanium may be a good fit for a project.
The document provides an overview of the Android infrastructure and development environment. It discusses:
- The layers of an Android application including presentation, application logic, and domain layers.
- Key aspects of the Android runtime including the Dalvik VM, app lifecycle, resources and context handling.
- Libraries that help with common tasks like compatibility, fragments, networking and dependency injection including the Android Support Library, ActionBarSherlock, Retrofit, Dagger and RoboGuice.
- Alternatives for data storage like SQLite and ORM libraries like ORMLite and GreenDAO.
- Options for testing Android apps using the DVM, JVM, Robotium and Robolectric.
The document provides an overview of the Android infrastructure and key concepts:
(1) It describes the layers of an Android application including the presentation layer, application logic layer, and domain layer.
(2) It explains important Android concepts such as the Android runtime environment, Dalvik virtual machine, application lifecycle and activities, and use of contexts.
(3) It discusses alternatives for common tasks like dependency injection with RoboGuice and Dagger, handling resources and views with ButterKnife and AndroidAnnotations, and accessing data with SQLite and ORMLite.
(4) It also briefly covers testing approaches on the DVM and JVM using AndroidTestCase, Robotium, and Robolectric
Async task, threads, pools, and executors oh my!Stacy Devino
http://360andev.com/sessions/100-async-task-threads-pools-and-executors/
Frome 360 AnDev conference
There are many ways to use Threads and in the multithreaded world in which we live, it can be confusing when, where, and how to use these functions correctly. Still, that assumes you know what they all mean and how to manipulate them. Novices and Experts welcome as there are many schools of thought, but we will explore them all together.
Don’t worry, we have you covered.
Animated Version : but.ly/asyncThread
Office 365 Groups and Tasks API - Getting StartedDragan Panjkov
This document introduces Office 365 Groups and the Groups, Planner, and Tasks APIs. It provides an overview of Groups and their benefits. It also describes how to access Groups, Plans, and Tasks data through the Microsoft Graph API using common HTTP methods like GET, POST, PUT, and DELETE. Code examples are provided to get started with retrieving, creating, updating, and deleting this content through the API.
2008 - TechDays PT: WCF, JSON and AJAX for performance and manageabilityDaniel Fisher
The document profiles two software architects and CTOs at devocach, Daniel Fisher and Michael Willers. It lists their extensive experience in areas like development, architecture, consulting, and community events. It also outlines some of devocach's expertise, including service orientation, agile methods, web and data access, and security. The document emphasizes that devocach works on real projects, not just demonstrations.
EclipseCon2011 Cross-Platform Mobile Development with EclipseHeiko Behrens
This document discusses cross-platform mobile development using Eclipse. It highlights that mobile devices now have more computing power than NASA did in 1969. It also covers developing for the diversity of mobile platforms like Java, C#, and Objective-C. The document discusses object-oriented principles like statelessness and the app anatomy of views, cells, navigation, and entities/content providers. It also introduces a DSL for defining mobile apps and demos cross-platform mobile development.
This DrupalCon 2019 Amsterdam talk provides a look beyond the world of PHP and Javascript. It explores how other languages such as Ruby, Java, Rust and Perl handle things and highlights some interesting features of those languages. Not all the things that other languages can do can be done in PHP or Javascript but the concepts and ideas can still be used.
Android Classes In Mumbai
best android classes in mumbai with job assistance.
our features are:
expert guidance by it industry professionals
lowest fees of 5000
practical exposure to handle projects
well equiped lab
after course resume writing guidance
The document discusses using annotations in Java, providing examples of annotations for servlets, EJBs, web services, CDI, and using frameworks like JUnit, Spring, Javassist, and ASM. It presents code samples to define servlets, session beans, RESTful and SOAP web services, and component injection using annotations instead of XML configurations. The document also demonstrates how to programmatically read annotation values and metadata using reflection, Javassist, and ASM.
Through this presentation you will gain a good understanding of how the clean architecture pattern is implemented at Taxibeat. What issues the Android Taxibeat team has faced so far and what solutions we came up with. Of course, the benefits of clean architecture will also be discussed along with the way we managed to build two fast paced iterative apps that share functionality.
Similar to Android architecture blueprints overview (20)
Transforming Product Development using OnePlan To Boost Efficiency and Innova...OnePlan Solutions
Ready to overcome challenges and drive innovation in your organization? Join us in our upcoming webinar where we discuss how to combat resource limitations, scope creep, and the difficulties of aligning your projects with strategic goals. Discover how OnePlan can revolutionize your product development processes, helping your team to innovate faster, manage resources more effectively, and deliver exceptional results.
How Can Hiring A Mobile App Development Company Help Your Business Grow?ToXSL Technologies
ToXSL Technologies is an award-winning Mobile App Development Company in Dubai that helps businesses reshape their digital possibilities with custom app services. As a top app development company in Dubai, we offer highly engaging iOS & Android app solutions. https://rb.gy/necdnt
What to do when you have a perfect model for your software but you are constrained by an imperfect business model?
This talk explores the challenges of bringing modelling rigour to the business and strategy levels, and talking to your non-technical counterparts in the process.
Photoshop Tutorial for Beginners (2024 Edition)alowpalsadig
Photoshop Tutorial for Beginners (2024 Edition)
Explore the evolution of programming and software development and design in 2024. Discover emerging trends shaping the future of coding in our insightful analysis."
Here's an overview:Introduction: The Evolution of Programming and Software DevelopmentThe Rise of Artificial Intelligence and Machine Learning in CodingAdopting Low-Code and No-Code PlatformsQuantum Computing: Entering the Software Development MainstreamIntegration of DevOps with Machine Learning: MLOpsAdvancements in Cybersecurity PracticesThe Growth of Edge ComputingEmerging Programming Languages and FrameworksSoftware Development Ethics and AI RegulationSustainability in Software EngineeringThe Future Workforce: Remote and Distributed TeamsConclusion: Adapting to the Changing Software Development LandscapeIntroduction: The Evolution of Programming and Software Development
Photoshop Tutorial for Beginners (2024 Edition)Explore the evolution of programming and software development and design in 2024. Discover emerging trends shaping the future of coding in our insightful analysis."Here's an overview:Introduction: The Evolution of Programming and Software DevelopmentThe Rise of Artificial Intelligence and Machine Learning in CodingAdopting Low-Code and No-Code PlatformsQuantum Computing: Entering the Software Development MainstreamIntegration of DevOps with Machine Learning: MLOpsAdvancements in Cybersecurity PracticesThe Growth of Edge ComputingEmerging Programming Languages and FrameworksSoftware Development Ethics and AI RegulationSustainability in Software EngineeringThe Future Workforce: Remote and Distributed TeamsConclusion: Adapting to the Changing Software Development LandscapeIntroduction: The Evolution of Programming and Software Development
The importance of developing and designing programming in 2024
Programming design and development represents a vital step in keeping pace with technological advancements and meeting ever-changing market needs. This course is intended for anyone who wants to understand the fundamental importance of software development and design, whether you are a beginner or a professional seeking to update your knowledge.
Course objectives:
1. **Learn about the basics of software development:
- Understanding software development processes and tools.
- Identify the role of programmers and designers in software projects.
2. Understanding the software design process:
- Learn about the principles of good software design.
- Discussing common design patterns such as Object-Oriented Design.
3. The importance of user experience (UX) in modern software:
- Explore how user experience can improve software acceptance and usability.
- Tools and techniques to analyze and improve user experience.
4. Increase efficiency and productivity through modern development tools:
- Access to the latest programming tools and languages used in the industry.
- Study live examples of applications
Using Query Store in Azure PostgreSQL to Understand Query PerformanceGrant Fritchey
Microsoft has added an excellent new extension in PostgreSQL on their Azure Platform. This session, presented at Posette 2024, covers what Query Store is and the types of information you can get out of it.
WWDC 2024 Keynote Review: For CocoaCoders AustinPatrick Weigel
Overview of WWDC 2024 Keynote Address.
Covers: Apple Intelligence, iOS18, macOS Sequoia, iPadOS, watchOS, visionOS, and Apple TV+.
Understandable dialogue on Apple TV+
On-device app controlling AI.
Access to ChatGPT with a guest appearance by Chief Data Thief Sam Altman!
App Locking! iPhone Mirroring! And a Calculator!!
14 th Edition of International conference on computer visionShulagnaSarkar2
About the event
14th Edition of International conference on computer vision
Computer conferences organized by ScienceFather group. ScienceFather takes the privilege to invite speakers participants students delegates and exhibitors from across the globe to its International Conference on computer conferences to be held in the Various Beautiful cites of the world. computer conferences are a discussion of common Inventions-related issues and additionally trade information share proof thoughts and insight into advanced developments in the science inventions service system. New technology may create many materials and devices with a vast range of applications such as in Science medicine electronics biomaterials energy production and consumer products.
Nomination are Open!! Don't Miss it
Visit: computer.scifat.com
Award Nomination: https://x-i.me/ishnom
Conference Submission: https://x-i.me/anicon
For Enquiry: Computer@scifat.com
Enhanced Screen Flows UI/UX using SLDS with Tom KittPeter Caitens
Join us for an engaging session led by Flow Champion, Tom Kitt. This session will dive into a technique of enhancing the user interfaces and user experiences within Screen Flows using the Salesforce Lightning Design System (SLDS). This technique uses Native functionality, with No Apex Code, No Custom Components and No Managed Packages required.
Consistent toolbox talks are critical for maintaining workplace safety, as they provide regular opportunities to address specific hazards and reinforce safe practices.
These brief, focused sessions ensure that safety is a continual conversation rather than a one-time event, which helps keep safety protocols fresh in employees' minds. Studies have shown that shorter, more frequent training sessions are more effective for retention and behavior change compared to longer, infrequent sessions.
Engaging workers regularly, toolbox talks promote a culture of safety, empower employees to voice concerns, and ultimately reduce the likelihood of accidents and injuries on site.
The traditional method of conducting safety talks with paper documents and lengthy meetings is not only time-consuming but also less effective. Manual tracking of attendance and compliance is prone to errors and inconsistencies, leading to gaps in safety communication and potential non-compliance with OSHA regulations. Switching to a digital solution like Safelyio offers significant advantages.
Safelyio automates the delivery and documentation of safety talks, ensuring consistency and accessibility. The microlearning approach breaks down complex safety protocols into manageable, bite-sized pieces, making it easier for employees to absorb and retain information.
This method minimizes disruptions to work schedules, eliminates the hassle of paperwork, and ensures that all safety communications are tracked and recorded accurately. Ultimately, using a digital platform like Safelyio enhances engagement, compliance, and overall safety performance on site. https://safelyio.com/
8 Best Automated Android App Testing Tool and Framework in 2024.pdfkalichargn70th171
Regarding mobile operating systems, two major players dominate our thoughts: Android and iPhone. With Android leading the market, software development companies are focused on delivering apps compatible with this OS. Ensuring an app's functionality across various Android devices, OS versions, and hardware specifications is critical, making Android app testing essential.
The Comprehensive Guide to Validating Audio-Visual Performances.pdfkalichargn70th171
Ensuring the optimal performance of your audio-visual (AV) equipment is crucial for delivering exceptional experiences. AV performance validation is a critical process that verifies the quality and functionality of your AV setup. Whether you're a content creator, a business conducting webinars, or a homeowner creating a home theater, validating your AV performance is essential.
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...XfilesPro
Wondering how X-Sign gained popularity in a quick time span? This eSign functionality of XfilesPro DocuPrime has many advancements to offer for Salesforce users. Explore them now!
Mobile App Development Company In Noida | Drona InfotechDrona Infotech
React.js, a JavaScript library developed by Facebook, has gained immense popularity for building user interfaces, especially for single-page applications. Over the years, React has evolved and expanded its capabilities, becoming a preferred choice for mobile app development. This article will explore why React.js is an excellent choice for the Best Mobile App development company in Noida.
Visit Us For Information: https://www.linkedin.com/pulse/what-makes-reactjs-stand-out-mobile-app-development-rajesh-rai-pihvf/
Liberarsi dai framework con i Web Component.pptxMassimo Artizzu
In Italian
Presentazione sulle feature e l'utilizzo dei Web Component nell sviluppo di pagine e applicazioni web. Racconto delle ragioni storiche dell'avvento dei Web Component. Evidenziazione dei vantaggi e delle sfide poste, indicazione delle best practices, con particolare accento sulla possibilità di usare web component per facilitare la migrazione delle proprie applicazioni verso nuovi stack tecnologici.
2. 2016 Android Top 10 Libraries
Ref: http://chuansong.me/n/1493021151427
3. 2016 Android Top 10 Libraries
Ref: http://chuansong.me/n/1493021151427
4. 2016 Android Top 10 Libraries
Ref: http://chuansong.me/n/1493021151427
5. 為什麼需要這些東西?
“The Android framework offers a lot of flexibility
when it comes to defining how to organize and
architect an Android app. This freedom, whilst
very valuable, can also result in apps with large
classes, inconsistent naming and architectures
(or lack of) that can make testing, maintaining
and extending difficult.”
Ref: https://github.com/googlesamples/android-architecture
6. Android
Architecture
Blueprints
“A collection of samples to discuss and showcase different
architectural tools and patterns for Android app”
Ref: https://github.com/googlesamples/android-architecture
13. What is MVP
● View is a layer that displays data and reacts
to user actions
○ Activity
○ Fragment
○ View
● Model is a data access layer
○ Database API
○ Remote server API
● Presenter provides View with data from
Model
○ Presenter also handles background tasks
Ref: http://konmik.com/post/introduction_to_model_view_presenter_on_android/
23. Model implementation
public class TasksRepository implements TasksDataSource {
public void getTasks(@NonNull final LoadTasksCallback callback) {
if (mCachedTasks != null && !mCacheIsDirty) {
callback.onTasksLoaded(new ArrayList<>(mCachedTasks.values()));
return;
}
if (mCacheIsDirty) {
getTasksFromRemoteDataSource(callback);
} else {
mTasksLocalDataSource.getTasks(new LoadTasksCallback() {
@Override
public void onTasksLoaded(List<Task> tasks) {
refreshCache(tasks);
callback.onTasksLoaded(new ArrayList<>(mCachedTasks.values()));
}
@Override
public void onDataNotAvailable() {
getTasksFromRemoteDataSource(callback);
}
});
}
}
}
Respond immediately with cache if available and not dirty
If the cache is dirty we need to fetch new data from the
network.
Query the local storage if available. If not, query the
network.
25. What is Clean Architecture
Ref: https://en.wikipedia.org/wiki/Robert_Cecil_Martin
26. What is Clean Architecture
Dependency Rule: source code dependencies can only point inwards and nothing in an
inner circle can know anything at all about something in an outer circle.
Ref: http://fernandocejas.com/2014/09/03/architecting-android-the-clean-way/
27. What is Clean Architecture
● Entities
○ These are the business objects of the application.
● Use Cases
○ These use cases orchestrate the flow of data to and from the
entities. Are also called Interactors.
● Interface Adapters (Presenter)
○ This set of adapters convert data from the format most
convenient for the use cases and entities. Presenters and
Controllers belong here.
● Frameworks and Drivers (UI)
○ This is where all the details go: UI, tools, frameworks, etc.
Ref: http://fernandocejas.com/2014/09/03/architecting-android-the-clean-way/
28. What is Clean Architecture
● Independent of Frameworks
● Testable
○ Business rules (Use cases) can be tested without external
element
● Independent of UI
○ The UI can change easily, without changing the rest of the
system
● Independent of Database
○ Business rules (Use cases) are not bound to the database
● Independent of any external agency
○ Business rules (Use cases) don’t know anything at all about
the outside world
Ref: https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html
29. Presenter implementation
public class TaskDetailPresenter implements TaskDetailContract.Presenter {
private final TaskDetailContract.View mTaskDetailView;
private final UseCaseHandler mUseCaseHandler;
private final GetTask mGetTask;
private final CompleteTask mCompleteTask;
private final ActivateTask mActivateTask;
private final DeleteTask mDeleteTask;
public TaskDetailPresenter(@NonNull UseCaseHandler useCaseHandler,
@Nullable String taskId,
@NonNull TaskDetailContract.View taskDetailView,
@NonNull GetTask getTask,
@NonNull CompleteTask completeTask,
@NonNull ActivateTask activateTask,
@NonNull DeleteTask deleteTask) {
mUseCaseHandler = checkNotNull(useCaseHandler, "useCaseHandler cannot be null!");
mTaskDetailView = checkNotNull(taskDetailView, "taskDetailView cannot be null!");
mGetTask = checkNotNull(getTask, "getTask cannot be null!");
mCompleteTask = checkNotNull(completeTask, "completeTask cannot be null!");
mActivateTask = checkNotNull(activateTask, "activateTask cannot be null!");
mDeleteTask = checkNotNull(deleteTask, "deleteTask cannot be null!");
mTaskDetailView.setPresenter(this);
}
}
Use case
Background executor
30. Presenter implementation
public class TaskDetailPresenter implements TaskDetailContract.Presenter {
private void openTask() {
mTaskDetailView.setLoadingIndicator(true);
mUseCaseHandler.execute(mGetTask, new GetTask.RequestValues(mTaskId),
new UseCase.UseCaseCallback<GetTask.ResponseValue>() {
@Override
public void onSuccess(GetTask.ResponseValue response) {
Task task = response.getTask();
mTaskDetailView.setLoadingIndicator(false);
showTask(task);
}
@Override
public void onError() {
mTaskDetailView.showMissingTask();
}
});
}
}
View operation
View operation
View operation
View operation
Model operation
31. Use case implementation
public class GetTask extends UseCase<GetTask.RequestValues, GetTask.ResponseValue> {
private final TasksRepository mTasksRepository;
public GetTask(@NonNull TasksRepository tasksRepository) {
mTasksRepository = checkNotNull(tasksRepository, "tasksRepository cannot be null!");
}
@Override
protected void executeUseCase(final RequestValues values) {
mTasksRepository.getTask(values.getTaskId(), new TasksDataSource.GetTaskCallback() {
@Override
public void onTaskLoaded(Task task) {
if (task != null) {
ResponseValue responseValue = new ResponseValue(task);
getUseCaseCallback().onSuccess(responseValue);
} else {
getUseCaseCallback().onError();
}
}
@Override
public void onDataNotAvailable() {
getUseCaseCallback().onError();
}
});
}
}
33. What is RxJava
“RxJava is a Java VM implementation of Reactive Extensions: a
library for composing asynchronous and event-based programs
by using observable sequences.”
“It extends the observer pattern to support sequences of
data/events and adds operators that allow you to compose
sequences together declaratively while abstracting away
concerns about things like low-level threading, synchronization,
thread-safety and concurrent data structures.”
Ref: https://github.com/ReactiveX/RxJava
34. View implementation
public class TaskDetailFragment extends Fragment implements TaskDetailContract.View {
@Override
public void onResume() {
super.onResume();
mPresenter.subscribe();
}
@Override
public void onPause() {
super.onPause();
mPresenter.unsubscribe();
}
@Override
public void setPresenter(@NonNull TaskDetailContract.Presenter presenter) {
mPresenter = checkNotNull(presenter);
}
}
35. Presenter implementation
public class TaskDetailPresenter implements TaskDetailContract.Presenter {
@NonNull private final TasksRepository mTasksRepository;
@NonNull private final TaskDetailContract.View mTaskDetailView;
@NonNull private final BaseSchedulerProvider mSchedulerProvider;
@NonNull private CompositeSubscription mSubscriptions;
public TaskDetailPresenter(@Nullable String taskId,
@NonNull TasksRepository tasksRepository,
@NonNull TaskDetailContract.View taskDetailView,
@NonNull BaseSchedulerProvider schedulerProvider) {
mTasksRepository = checkNotNull(tasksRepository, "tasksRepository cannot be null!");
mTaskDetailView = checkNotNull(taskDetailView, "taskDetailView cannot be null!");
mSchedulerProvider = checkNotNull(schedulerProvider, "schedulerProvider cannot be null");
mSubscriptions = new CompositeSubscription();
mTaskDetailView.setPresenter(this);
}
@Override
public void subscribe() {
openTask();
}
@Override
public void unsubscribe() {
mSubscriptions.clear();
}
}
36. Presenter implementation
public class TaskDetailPresenter implements TaskDetailContract.Presenter {
private final TasksRepository mTasksRepository;
private final TaskDetailContract.View mTaskDetailView;
private final BaseSchedulerProvider mSchedulerProvider;
private CompositeSubscription mSubscriptions;
private void openTask() {
if (Strings.isNullOrEmpty(mTaskId)) {
mTaskDetailView.showMissingTask();
return;
}
mTaskDetailView.setLoadingIndicator(true);
mSubscriptions.add(mTasksRepository
.getTask(mTaskId)
.subscribeOn(mSchedulerProvider.computation())
.observeOn(mSchedulerProvider.ui())
.subscribe(
// onNext
this::showTask,
// onError
throwable -> {
},
// onCompleted
() -> mTaskDetailView.setLoadingIndicator(false)));
}
}
View operation
View operation
View operation
View operation
Model operation
37. Model implementation
public class TasksRepository implements TasksDataSource {
private final TasksDataSource mTasksRemoteDataSource;
private final TasksDataSource mTasksLocalDataSource;
@VisibleForTesting Map<String, Task> mCachedTasks;
@VisibleForTesting boolean mCacheIsDirty = false;
private TasksRepository(@NonNull TasksDataSource tasksRemoteDataSource,
@NonNull TasksDataSource tasksLocalDataSource) {
mTasksRemoteDataSource = checkNotNull(tasksRemoteDataSource);
mTasksLocalDataSource = checkNotNull(tasksLocalDataSource);
}
@Override
public Observable<List<Task>> getTasks() {
if (mCachedTasks != null && !mCacheIsDirty) {
return Observable.from(mCachedTasks.values()).toList();
} else if (mCachedTasks == null) {
mCachedTasks = new LinkedHashMap<>();
}
Observable<List<Task>> remoteTasks = getAndSaveRemoteTasks();
if (mCacheIsDirty) {
return remoteTasks;
} else {
Observable<List<Task>> localTasks = getAndCacheLocalTasks();
return Observable.concat(localTasks, remoteTasks)
.filter(tasks -> !tasks.isEmpty())
.first();
}
}
}
Observer pattern
Compose sequences
40. What is Dagger
“Dagger is a fully static, compile-time dependency injection
framework for both Java and Android. It is an adaptation of an
earlier version created by Square and now maintained by
Google.”
“Dagger is a replacement for FactoryFactory classes that
implements the dependency injection design pattern without the
burden of writing the boilerplate. It allows you to focus on the
interesting classes. Declare dependencies, specify how to satisfy
them, and ship your app.”
Ref: https://google.github.io/dagger/
41. View and Presenter’s creation & binding
public class TaskDetailActivity extends AppCompatActivity {
@Inject TaskDetailPresenter mTaskDetailPresenter;
@Override
protected void onCreate(Bundle savedInstanceState) {
TaskDetailFragment taskDetailFragment =
(TaskDetailFragment) getSupportFragmentManager()
.findFragmentById(R.id.contentFrame);
if (taskDetailFragment == null) {
taskDetailFragment = TaskDetailFragment.newInstance(taskId);
ActivityUtils.addFragmentToActivity(getSupportFragmentManager(),
taskDetailFragment, R.id.contentFrame);
}
DaggerTaskDetailComponent.builder()
.taskDetailPresenterModule(
new TaskDetailPresenterModule(taskDetailFragment,
taskId))
.tasksRepositoryComponent(((ToDoApplication) getApplication())
.getTasksRepositoryComponent()).build()
.inject(this);
}
}
Field injection
Inject presenter
Provide view