Code Monkey home page Code Monkey logo

demoapp's Introduction

  • Description: Demo application to show long form for a given acronym. We are using http://www.nactem.ac.uk/software/acromine/rest.html API, no api-key required.

  • Design and architecture: App is desinged with single Activity approach in mind and navigation component, currently it has only one fragment, but it is easily scalable.

    Screen-Shot-2020-12-13-at-10-53-07-AM
    upload images

  • App uses following tech:

    Wetworking - Retrofit

    Networking - Coroutines

    Jetpack - Navigation

    DI - Hilt

    DataBinding

    JUnit - Testing

  • How app is designed:

    Retrofit object in injected to Repository class which is in charge of making a network call. Repository and response object are injected to ViewModel so it can setup LiveData variables based on response results for UI to observe. UI then decides which widgets to show. ViewModel is also injected into SearchFragment. Databinding is used for RecyclerView, but could not be used with search bar listeners due to complications from ViewModel injection.

    Arch

  • Notes and thoughts:

  • Testing:

    1- Used Charles Proxy for mac to simulate slow commenction, no problems observed.

    2- Tested across configuration changes, and sending app to background and bringing back to foreground to make sure it preserves the app state.

Screen-Shot-2020-12-13-at-10-53-14-AM

Please see: https://youtu.be/Rcs0OzhEWig

App does not run a query if internet is unavailable:

Screen-Shot-2020-12-13-at-5-14-23-PM

  • App ANR'ed only once during many dry runs, looking at the stack i believe this is due to pressure from starting emulator on my mac while having other processes running.

  • Wrote four unit tests, including:

    1- Make sure reponse analyzer class is able to detect unauthorized response.

    2- Make sure reponse analyzer class is able to detect empty body response.

    3- Make sure reponse analyzer class is able to detect null response.

    4- Make sure reponse analyzer class is able to detect OK response.

    Screen-Shot-2020-12-13-at-9-39-10-AM

  • Other thoughts and notes:

    App has a clean build with one warning on generated hilt files, probably outside of author's control.

    Screen-Shot-2020-12-13-at-10-00-03-AM

  • Possible improvements:

    1- Use Room to cache results so we do not make a web call every time.

    2- Use expose annotation to only filter for what we actually need.

    3- Add timeout to Retrofit request.

    4- Use Generic Api Response from Google samples and wrap Retrofit response.

    5- Add Exception handling to Coroutine job.

demoapp's People

Contributors

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