Skip to content

Instantly share code, notes, and snippets.

@jgomo3
Created September 1, 2023 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgomo3/9107fe8eb86a5d3eabdf80e7cd4433f8 to your computer and use it in GitHub Desktop.
Save jgomo3/9107fe8eb86a5d3eabdf80e7cd4433f8 to your computer and use it in GitHub Desktop.
Decouple structure and implementation and delay the coupling to another time.
interface Length {
int getLength();
}
class CommentStruct {
protected String author;
protected String content;
}
public class Comment extends CommentStruct implements Length{
public int getLength() {
return content.length();
}
}
// https://youtu.be/5QFDQRkbllo?si=3IY7T8DMM6aXbOWO&t=118
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment