Skip to content

Instantly share code, notes, and snippets.

View Mercandj's full-sized avatar
😀
Working on Android Apps

Jonathan Mercandalli Mercandj

😀
Working on Android Apps
View GitHub Profile
public abstract class Response {
private final int httpCode;
public int getHttpCode() {
return this.httpCode;
}
private Response(int httpCode) {
this.httpCode = httpCode;
}
@Mercandj
Mercandj / Response.kt
Last active April 29, 2024 16:41
medium_article_kotlin_sealed_class_bad
sealed interface Response {
val httpCode: Int
}
data class Success(
override val httpCode: Int,
val data: String
) : Response
data class Fail(
public interface Response {
int getHttpCode();
}
public final class Success implements Response {
private final int httpCode;
@NotNull private final String data;
public int getHttpCode() {
return this.httpCode;
sealed class Response(open val httpCode: Int)
data class Success(
override val httpCode: Int,
val data: String
) : Response(httpCode = httpCode)
data class Fail(
override val httpCode: Int
) : Response(httpCode = httpCode)
sealed class Response
data class Success(
val data: String
) : Response()
data object Failed : Response()
@Mercandj
Mercandj / Response.kt
Last active April 29, 2024 14:42
medium_article_kotlin_sealed_class_enum.kt
enum class Response {
SUCCESS,
FAIL
}
@Mercandj
Mercandj / bad.kt
Created April 29, 2024 14:37
medium_article_kotlin_sealed_class_1
sealed class Response {
abstract val httpCode: Int
}
data class Success(
override val httpCode: Int,
val data: String
) : Response()
@Mercandj
Mercandj / setup_mac_os.md
Last active November 16, 2023 16:19
"Minimal" setup to work on MacOS as an Android Developer

Mac OS Setup

Here my "minimal" setup to work on a Mac as an Android Developer

@Mercandj
Mercandj / developer_principles.md
Last active August 22, 2023 14:47
I'm your CTO! As a developer, here the rules I expect you to follow:

Developer: Principles

Description

Like Robert C. Martin (clean architecture) would say on this video,

Imagine I'm your CTO, as your CTO I expect you to follow this principles:

Untitled-collage-10-min-9 (1)

Android developer: Principles

Description

Please, first, checkout Developer: Principles. These Android developer principles are the "implementation details" of developer principles on the Android world.

The following advices are very opinionated. Before saying "bullshit", please read the why below in the Details section. One of the main ability of developer is to understand the why. (This advice apply to myself of course. Every tool I'm criticising exist because of a why that I consider less important than the alternative. But for sure, you can disagree).

The goal of this document is more to start a reflection than make you think twice of your code.