Created
January 26, 2023 07:55
-
-
Save arriqaaq/994166dd0d36d5d208d93e5bc877cd9f to your computer and use it in GitHub Desktop.
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
type Database struct { | |
// fields and methods | |
} | |
var db *Database | |
func GetDatabase() *Database { | |
if db == nil { | |
db = &Database{} | |
} | |
return db | |
} | |
func ProcessData() { | |
// Tightly coupled code | |
GetDatabase().SaveData("data") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment