Code Monkey home page Code Monkey logo

android-code-challenge's Introduction

Important! This version of the README is depreciated. I added support for Dagger Dependency Injection and redid the package structure with the goal of leaving the cleaner design. These changes are being made based on suggestions, tips and advice received in this Reddit question. I'll be updating this README as fast as possible to keep true to the code. Thank you!

You can download the APK here. To go to the original challenge, click here or here. It was developed to serve as an example of RxJava, MVP and Clean Architecture.

Important! The code was developed in an hour. But I took (much) more time writing the README.

Description

Create an Android application that displays information received over the network.

  1. Retrieve and print out the data received from the url above.
  2. Parse the data retrieved from the server into a list of Java objects
  3. Display your objects in an organized fashion (ListView, GridView, etc.)
  • Should display the name, city, state, and end date
  1. In addition the object’s name, have your view display the image located at each object’s icon url.

Implementation Details

To maintain the quality of good code, I decided to use an architecture based on the MVP pattern and inspired by the Clean / Hexagonal Architecture.

Basically I created three main packages: Core, Data and Ui.

Clean / Hexagonal Architecture

  • Core: Keep the domain rules (which in this case are none), models and aggregations models.
  • Data: Responsible for any data used in the application. Uses the Repository pattern.
  • Ui (View + Presenter): Responsible views. It is also responsible for the presentation (Presenter).

Obs: Where is the Interactors in Core Layer? I did not think it was necessary. I wanted to show my skills, but still want to keep as simple as possible.

Repository Pattern

Allow change data from the internet and database without breaking the abstraction defined by the interface. Thus the code that uses the repository does not need to care about the place that the data is coming.

Repository Pattern

Model View Presenter

With the separation between View and Presenter, we create a isolated place for Unit Test and single responsibility layers. The Presenter allow unit test without the discomfort of mock Android SDK.

Model View Presenter

UX / UI

I tried to follow the Material Design pattern in available time. Did you like it?

Guide List

Libraries

  1. RxJava + RxAndroid: This is the best way to work asynchronously and maintain the application scalable. I'm not a genius with Rx, but I really love it.
  2. Retrofit + OkHttp: For Network Request and Rx integration.
  3. Picasso: For image loading.
  4. ButterKnife: For view binding.
  5. PaperDb: For easy caching (database).
  6. Gson: Retrofit integration for deserialize.

Infraestruture Details

The server at the following url responds with JSON formatted data:

(GET) http://private-c60ade-guidebook1.apiary-mock.com/upcomingGuides

The response represents a list of “Guide” objects:

{
  "data": [
  {
    "startDate": "<date>",
    "endDate": "<date>",
    "name": "<name>",
    "url": "<url>",
    "venue": {"city": "<city>", "state": "<state>"},
    "icon": "<url to png image>"
    },
    … <more objects>
    ]
  }

Contributors

Although it was developed at a time to serve as a simple example, if you think you can improve it do not be shy to make your Fork / Pull Request. I will love analyzing improvements to this code.

android-code-challenge's People

Contributors

marcellogalhardo avatar viniciussoares avatar pedrofsn avatar zdenekobornik avatar

Watchers

Mahesh 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.