# Is Julia's way of OOP superior to C++/Python? Why Julia doesn't use class-based OOP?

**URL:** <https://discourse.julialang.org/t/is-julias-way-of-oop-superior-to-c-python-why-julia-doesnt-use-class-based-oop/52058>\
**Category:** Internals & Design\
**Created:** [December 18, 2020, 4:32pm UTC](https://discourse.julialang.org/t/is-julias-way-of-oop-superior-to-c-python-why-julia-doesnt-use-class-based-oop/52058 "2020-12-18T16:32:10Z")\
**Posts on this page:** 1\
**Showing post:** 144

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 31, 2020, 4:07pm UTC](https://discourse.julialang.org/t/is-julias-way-of-oop-superior-to-c-python-why-julia-doesnt-use-class-based-oop/52058/144 "2020-12-31T16:07:30Z")

</div>

> [@ChrisRackauckas](#):
>
> For example `StatsBase.sample` is used all over the place, but the authors of Distributions.jl probably don’t know how Turing.jl has changed `StatsBase.sample` . It all works together though.

While I agree with your comments about the general principle, I don’t think this is a particularly good example — the uses of `sample` in Turing and StatsBase don’t have anything to do with each other, so it is just recycling the symbol for something completely different, not an example of generic programming. Technically fine, but not good style. See [this topic](https://discourse.julialang.org/t/what-is-the-difference-between-rand-and-sample/52297/).

Generally, defining & exporting a function `f` in a `...Base` package is useful if it is part of a generic interface other packages may extend, or just use without restricting to a particular type in mind. Nice examples include

> **[GitHub - JuliaPlots/RecipesBase.jl: Base package for defining transformation...](https://github.com/JuliaPlots/RecipesBase.jl)**
>
> Base package for defining transformation recipes on user types for Plots.jl - GitHub - JuliaPlots/RecipesBase.jl: Base package for defining transformation recipes on user types for Plots.jl

> **[GitHub - joshday/OnlineStatsBase.jl: Base types for OnlineStats.](https://github.com/joshday/OnlineStatsBase.jl)**
>
> Base types for OnlineStats. Contribute to joshday/OnlineStatsBase.jl development by creating an account on GitHub.

---

_[View the full topic](https://discourse.julialang.org/t/is-julias-way-of-oop-superior-to-c-python-why-julia-doesnt-use-class-based-oop/52058)._
