This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SubsystemA { | |
fun operationA() { | |
// implementation | |
} | |
} | |
class SubsystemB { | |
fun operationB() { | |
// implementation | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Coffee { | |
fun cost(): Double | |
fun ingredients(): String | |
} | |
class Espresso : Coffee { | |
override fun cost() = 2.0 | |
override fun ingredients() = "Espresso" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Component { | |
fun operation() | |
} | |
class ConcreteComponent : Component { | |
override fun operation() { | |
// implementation | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data": [ | |
{ | |
"type": "SCAFFOLD", | |
"top_bar": [ | |
{ | |
"type": "APP_BAR", | |
"children": [ | |
{ | |
"type": "EDIT_TEXT", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ViewComponent { | |
fun draw() | |
} | |
class TextView : ViewComponent { | |
override fun draw() { | |
// Draw text view on screen | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Component { | |
fun operation() | |
} | |
class Leaf : Component { | |
override fun operation() { | |
// implementation | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface NetworkAPI { | |
fun sendData(data: String) | |
} | |
class HTTPAPI : NetworkAPI { | |
override fun sendData(data: String) { | |
// send data over HTTP | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Implementor { | |
fun operationImplementation() | |
} | |
class ConcreteImplementorA : Implementor { | |
override fun operationImplementation() { | |
// implementation | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Implementor { | |
fun operationImplementation() | |
} | |
class ConcreteImplementorA : Implementor { | |
override fun operationImplementation() { | |
// implementation | |
} | |
} |
NewerOlder