DEV Community

Cover image for Contribute to the Kotlin Libraries Playground for #hacktoberfest

Contribute to the Kotlin Libraries Playground for #hacktoberfest

Hacktoberfest just started, and I have just the right kind of project to show you if you want to contribute some Kotlin!

Hacktoberfest is a month-long celebration of open-source technology organized by DigitalOcean. If you’re new to development, a student, longtime contributor, event host, you can help drive open-source and offer significant contributions to an ever-growing community.

If you haven't done so already, register for hacktoberfest here.

Last year, I suggested in my article contributing to open-source is like dancing Tango to pick something meaningful but simple, and focus on the social side of programming: it's all about creating a connection!

This year, I am launching a brand new project that is designed to make it easy for you to contribute something meaningful!

GitHub logo LouisCAD / kotlin-libraries-playground

A playground to gain a wider and deeper knowledge of the libraries in the Kotlin ecosystem. Also the official sample for gradle refreshVersions.

Kotlin Libraries Playground

A playground to gain a wider and deeper knowledge of the libraries in the Kotlin ecosystem

Also the official sample for gradle refreshVersions

Usage

Run all the samples

$ ./gradlew :kotlin-jvm:run

Run all the tests

$ ./gradlew :kotlin-testing:test

Test tests called FailingXXX are expected to fail

kotlin-libraries-playground_–_versions_properties__kotlin-libraries-playground__and_GitHub_Desktop

❀️ Contributors welcome! #hacktoberfest

We want to collect sample usage of Kotlin libraries, and the more the better!

You are very welcome to contribute your own library sample.

==> CONTRIBUTING.md

πŸ€”How do you keep up with all the new stuff?

There are great resources to learn Kotlin.

But once you master the language, you are not done just yet.

You now face another challenging task: become familiar with its ecosystem of libraries.

With time, you want to both acquire:

  • a wider knowledge of what good libraries are available in the ecosystem in general
  • a deeper knowledge of some specific libraries…

πŸ“š The Kotlin Library Playground

There are great resources to learn Kotlin.

But once you master the language, you are not done just yet.

You now face another challenging task: become familiar with its ecosystem of libraries.

There are several inefficient ways to do that:

  • reading tutorial after tutorial and being stuck in a loop where you "learn" about things you don't practice
  • starting a new project from scratch for every libraries you come around - overwhelming
  • trying out the library in your main project at work - a project with a compilation time of 5 minutes, who uses an older version of the library than the tutorial assumes ; not sure your colleagues will be happy that you introduce a dependency you don't master yet.

The Kotlin Library Playground is a crowdsourcing of sample usages from popular Java & Kotlin libraries.

It aims to give you wider knowledge of what good libraries are available.

  • Interested in networking? We have samples for OkHttp, Retrofit and Ktor-Client.
  • Interested in testing? We have samples for junit-jupiter, kotest, spek, strikt, mockito, mockk, ...
  • Interested in database? We have you covered with Sql Delight, Kodein DB and Exposed.
  • Interested in trolling about what is The Best(tm) DI framework? We have samples for Dagger, Koin and Kodein
  • … you get the idea.

It is a non-goal to pick sides and say what library is best for a given topic.

Instead what we give you is a starting point if you want to go deeper in your knowledge of some specific libraries particularly important for you: you already have a Gradle project setup with the dependencies, just follow the documentation and hack you way into more knowledge!

❀️ Contributors welcome!

Head over to the "issues" tab and select a library for which you feel like contributing a usage sample

Issues_Β·_LouisCAD_kotlin-libraries-playground

Your goal is to contribute for your library of choice a self-contained, simple yet meaningful sample.

Here is for example a sample for Moshi, a modern Json library for Kotlin and Java

kotlin-libraries-playground_–_Moshi_kt

What do those 1-2-3-4 mean?

Thanks for asking, it is described in details in the CONTRIBUTING guide

πŸ€” What does a contribution look like in practice?

To give you an idea, here is an excellent contribution from Douglas Camata for Kodein, a Dependency Injection library:

Add an example of the KodeinDI library #13

The example is an application that can add and get users to a datastore represented by a UserRepository.

The idea is to show that in tests of this application we could inject a mocked UserRepository, while in any other case we could inject an "real" store (in-memory store, in this case).

I added comments in the code to make it more clear to readers as there are plenty of things there: classes, dataclasses, interfaces, etc.

This fixes #11

βœ… TL:DR

  1. Register for hacktoberfest
  2. Read the README
  3. Claim an issue as yours
  4. Read the contributing guide
  5. Code, code, code and submit your PR
  6. Only three more PR to go, and you get the nice tee-shirt!

Top comments (2)

Collapse
 
fultonbrowne profile image
Fulton Browne

It looks like you don't have a ktor server demo - I could help with that

Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard • Edited

Hello Fulton

That would be great but that would also be more work than the other samples.

Ideally I would like to have a new project "kotlin-server" that will contain an implementation of the same simple server spec in ktor but also later spring boot, http4k, javalin or whatever people want to contribute.

For a real project, one would use a multimodule Gradle build for that, but for pedagogy simplicity is key so if that's possible to put all implementations in a single module, that's better!

I created an issue if you are interested

github.com/LouisCAD/kotlin-librari...