Giter VIP home page Giter VIP logo

imagefeed's Introduction

imagefeed

An Android image fetcher for Imgur. Made in less than 48 hours.

Download the latest APK here

Architecture

The architectural approach used in for this application is close to Uncle Bob's clean architecture, as described here: https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html

alt tag

In the heart of the app is the 'domain' module, which represents business logic seperated by use cases, AKA interactors. In the above image it is located in the orange Use Case layer. This module is free from platform dependent code or dependencies to other of this application's modules.

On the outer layers are the 'presentation' and 'data' modules, which both utilize platform dependent code and know of the 'domain' layer. The 'presentation' module represents the View and Presenter part of the MVP pattern. The data module utilizes a repository pattern. The executed network calls are synchronous, as this module is only reponsible for retreiving data.

The 'app' module hosts activities and base functionality, such as navigation.

Variations

There are two points in which the chosen architecture is different from the above mentioned clean architecture.

  1. Interactors define their needs using interfaces, however are not defined by interfaces themselves. This represents the assumption that business logic in an app is unlikely to be exchanged. On the flipside, this makes the Presenters harder to test.
  2. Data models are not mapped to models suitable for each layer. Instead, Interfaces are utilized (see com.jborchardt.imagefeed.data.model.ImgurImage).

Breaking the architecture

At two points, the above mentioned architecture is broken: Whenever the Glide library is used to load images. The image loading flow is triggered in the 'presentation' module without calling an Interactor or Repository. The desicion to include this library anyway was made out of time constraints and because it represents a proven concept and a well used and tested piece of code, which seemed sufficient for this usecase.

App structure

The app consists of an imagefeed, and an image details view. Both screens are able to handle portrait and landscape orientation without the need to recreate views.

Image feed

alt tag

The image feed shows all the image posts of Imgur's most viral feed. When the user scrolls close to the end of the feed, the next page of images is requested (paging). Loading is indicated by a horizontal progressbar in the actionbar.

Image Details

alt tag

The image details show the selected image in fullscreen and provides upvotes, downvotes, comments and views, as well as the image's titles as metadata.

Open points

Given the short timeframe in which this app was created, room for improvement exists. The following comes to mind:

  • Dependency injection: Could be handled by a framework, like dagger. Right now Each View constructs its own dependency, which in the eyes of the author it shouldn't. This is considered the biggest weakness of the application.
  • Transitions: The translation from image feed to details invites for a shared item transition.
  • Design in general: The author of this application consideres himself to be a programmer rather than a designer.
  • Tests: Right now tests for interactors and repositories exist. UI tests don't.

imagefeed's People

Contributors

jborchardt avatar

Stargazers

Johannes avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.