Tips on code design for writing new packages

When starting a new package, I’m always overwhelmed by the multiple possibilities of how to desig my code. I was wondering what are some good references out there on how “design your code” for package development in Julia. I know there is no single answer, but I perhaps there are some “good practices” followed by some simple (but no so simple) package example.

My question is motivated mainly by the fact that I’m starting to develop a plotting package, and I already refactored my code twice in 3 days. For example, I want my package to enable users to use some default styles, but then, to easily change these defaults with their own styles. Thus, how should these defaults be stored and how should they be served? At the moment, I’ve created mutable structs using Parameters.jl, but it’s still not clear to me if this is the best approach.

Any references/tips on code design or on developing a plotting package itself are very welcomed :slight_smile:

P.s: I’ve tried reading the code for other packages (e.g. Plots.jl, Makie.jl, etc), but it’s not very helpful, since most documentation is related to how to use the packages and not how the packages are written.

2 Likes

I would say Tim Holy’s packages are paragons of clean and legible organization. Try Revise.jl or ProgressMeter.jl.

1 Like

Thanks, I’ll read on.