Giter Site home page Giter Site logo

redbadger's Introduction

RedBadger

  • This solution showcases a TDD approach to implementing business logic, as seen in the commit history.
  • Especial attention has been put to handle edge cases:
    • Incomplete input: Robot ignored
    • Invalid input: Error logged (using Timber) and displayed
    • Empty lines in input
  • I/O is performed using InputStream and OutputStream, so that I/O operations can be executed on diverse types (files, plain Strings, etc) and decided on the call site client.
  • I/O uses Reader#useLines() as opposed to Reader#readLines() to allow for very large inputs.
    • readLines reads all lines eagerly as a List<String>
    • useLines reads lines lazily as a Sequence<String>
    • This allows us, for example, to write into a file while reading the input file, without having to read the whole input file at once into memory.
  • Because the core logic uses plain Kotlin, this test can be executed either as:
    • An Android app with UI (by launching the app module)
    • A standalone class (by launching Main.kt)
  • DI using Dagger-Android

Android app

Uses architecture components to interact between UI and business logic:

Data binding <-> ViewModel <-> Flow (coroutines) <-> Business logic

Standalone Main class

Reads and writes to files

app/src/main/res/raw/robots_input.txt -> app/build/robots_output.txt)

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.