Skip to content

Instantly share code, notes, and snippets.

View alibahaaa's full-sized avatar
❤️‍🔥
Coding with love and passion

Ali Baha alibahaaa

❤️‍🔥
Coding with love and passion
View GitHub Profile
class MusicPlayerFacade {
private val player = MediaPlayer()
private val playlist = Playlist()
fun play(song: Song) {
playlist.clear()
playlist.addSong(song)
player.reset()
player.setDataSource(song.filePath)
player.prepare()
class SubsystemA {
fun operationA() {
// implementation
}
}
class SubsystemB {
fun operationB() {
// implementation
}
interface Coffee {
fun cost(): Double
fun ingredients(): String
}
class Espresso : Coffee {
override fun cost() = 2.0
override fun ingredients() = "Espresso"
}
interface Component {
fun operation()
}
class ConcreteComponent : Component {
override fun operation() {
// implementation
}
}
{
"data": [
{
"type": "SCAFFOLD",
"top_bar": [
{
"type": "APP_BAR",
"children": [
{
"type": "EDIT_TEXT",
interface ViewComponent {
fun draw()
}
class TextView : ViewComponent {
override fun draw() {
// Draw text view on screen
}
}
interface Component {
fun operation()
}
class Leaf : Component {
override fun operation() {
// implementation
}
}
interface NetworkAPI {
fun sendData(data: String)
}
class HTTPAPI : NetworkAPI {
override fun sendData(data: String) {
// send data over HTTP
}
}
interface Implementor {
fun operationImplementation()
}
class ConcreteImplementorA : Implementor {
override fun operationImplementation() {
// implementation
}
}
interface Implementor {
fun operationImplementation()
}
class ConcreteImplementorA : Implementor {
override fun operationImplementation() {
// implementation
}
}