Coder Social home page Coder Social logo

rxbasicskata's Introduction

Practical challenges for RxJava learners

A set of simple code challenges to learn RxJava using JUnit tests as an acceptance criteria. Focused on some basic concepts and doesn't cover any Android topics yet.

Current implementation

Dependencies:

  • RxJava 2.0.5 
  • JUnit 4.12

Reactive types covered:

  • Observable: the heart of Rx, a class that emits a stream of data or events
  • Single : a version of an Observable that emits a single item or fails
  • Maybe: lazy emission pattern, can emit 1 or 0 items or an error signal

Operators covered:

  • map: transforms the items by applying a function to each item
  • flatMap: takes the emissions of one Observable and returns merged emissions in another Observable to take its place
  • filter: emits only those items from that pass a criteria (predicate test)
  • skip/take: suppress or takes the first n items 
  • all: determines whether all items meet some criteria
  • reduce: applies a function to each item sequentially, and emit the final value. For example, it can be used to sum up all emitted items
  • toMap: converts an Observable into another object or data structure
  • test: returns TestObserver with current Observable subscribed

Testing approach:

  • The set of test cases are defined in a separate java file
  • As a “receiver” of emitted test events we use TestObserver. It records events and allows to make assertions about them
  • All tests are failing when you just took them from the repo. This is expected behaviour. You should make tests pass by implementing the logic in CountriesServiceSolved class

Blog post

See my blog post at Medium for more details: https://medium.com/@sergii.

Contribution

Pull requests and new code challenges are really welcome.

rxbasicskata's People

Contributors

sergiiz avatar

Watchers

 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.