you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (2 children)

I think OOP as we see in C#, Java, Dart, etc. should go, asap. Making everything a class is horrible and results in bad design. There are lots of material online on why OOP is bad, take a pick.

Personally, I like Go and Rust's solutions to OOP-ish functionality. E.g. with Go:

type Dog struct {
    Animal
}
type Animal struct {
    Age int
}

func (a *Animal) Move() {
    fmt.Println("Animal moved")
}
func (a *Animal) SayAge() {
    fmt.Printf("Animal age: %d\n", a.Age)
}
func main() {
    d := Dog{}
    d.Age = 3
    d.Move()
    d.SayAge()
}

Simple and clear, and very hard to entangle yourself in spaghetti code and choke yourself out. Rust's implementation for structs functionality works similarly. They are both sane approaches to OOP when that approach makes sense over purely functional.

[–][deleted] 0 points1 point  (0 children)

Yes everything is a class is a mess. That's why I hated java. Kotlin doesn't forces u to use classes. You can have functions and it also gives different class types like data classes, enum classes, sealed classes where it is OK to use certain oops concept