Code Monkey home page Code Monkey logo

cleanbuzz's Introduction

CleanBuzz

If you can't be bothered to read, scroll down to the TLDR at the bottom of the page.

Introduction

I'll let the app speak for itself first.

So it's just FizzBuzz! You enter a number and you get the FizzBuzz-ified version back.

I know what you're thinking, this is simple. You could probably write this in 30 minutes, it's a layout file and a single 100-ish line Java Activity.

Implementation details

Of course, this simple app is more than meets the eye. Quite clearly inspired by FizzBuzzEnterpriseEdition, this application is an extremely contrived example for using popular/trending/fancy Android development techniques and tools.

Instead of the aforementioned 100 lines of Java, this project is ~1000 lines of code spread across ~30 files and many packages. But it's all for good (?) reason.

Language

And all those lines aren't even Java's boilerplate, because the entire app is written in Kotlin to practice (and perhaps promote) the language.

Kotlin is a really nice language for the JVM created by JetBrains and you can learn all about it on the official website.

Architecture

The app is built with Clean architecture, more specifically along Marko Milos's interpretation of it. You can watch the very underrated presentation he gave about it at droidcon Zagreb 2016 on YouTube here.

Here's a high level overview of the architecture from their presentation - it's fairly close to most Clean architecture implementations, and it uses MVP for the presentation layer. Watch the presentation linked above for more details.

architecture

And here's the presentation layer's MVP structure, base classes with green, concrete classes with blue, external dependencies in white. In the project you'll find classes prefixed with Buzz instead of Example, as this diagram is meant to be more general.

MVP

Modules

The project contains 3 modules:

  • app (Presentation layer)
    • views, presenters
  • domain (Domain layer)
    • use cases, repository interface, (business logic would go here)
  • data (Data layer)
    • repository implementation, data sources

Libraries

  • RxJava: Reactive programming is getting more and more popular in every language and on every platform, and Android is no exception, so it would be a shame to miss out on it.
  • RxAndroid: Mandatory addon to the previous library, provides Android specific schedulers.
  • RxKotlin: Kotlin-friendly extensions for RxJava.
  • Anko: The definitive Android library for Kotlin, with many utilities, generally making life easier.
  • Dagger 2: The go-to dependency injection framework.
  • Retrofit: Network communication library by Square.
Network communication?!

Yes, although it's not what you might think, the app isn't phising for your personal information.

What it does do is use buzzcloud.xyz's REST API. This wonderful websites offers free FaaS (FizzBuzz as a service), and thus provides the application's business logic.

###Tests

Unit tests

The project has just a couple of them, since most classes are just simple passthroughs and the REST API does not need testing. The tests use JUnit, Mockito, and Mockito-Kotlin (which provides some more Kotlin-friendly syntax for Mockito, although the parts of it used could easily be reimplemented).

The following tests are included:

TODOs

  • Higher level tests

More screenshots

TL;DR

This is a simple FizzBuzz app that has/uses:

  • Kotlin and Anko
  • Clean architecture with MVP (in separate modules by layer)
  • JUnit tests
  • RxJava, Dagger, Retrofit, Mockito
  • a REST API for the business logic

cleanbuzz's People

Contributors

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