Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Add section on inappropriate intimacy between classes

Open
#35 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
48/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
documentation

Research direction

Start by locating the course documentation section covering class design or plotting, since the issue does not name a file or entry point. Add the provided explanation and MIKE IO examples there, preserving the guidance on public APIs and data manipulation; done means the new section is published in the appropriate course material.

Written by the indexing model from the issue text.

Description

Classes should interact through public APIs, not by reaching into each other's private attributes.

Example from MIKE IO plotting refactor:

Before (inappropriate intimacy):

# Plotter reaches into geometry internals for subsetting
values = values[self.da.geometry.top_elements]
geometry = self.da.geometry.geometry2d

# Plotter uses private attribute to check for time axis
if self.da._has_time_axis:
    return self.da.values[0]

After (using public API):

# Use sel/isel for subsetting
da = da.sel(layers="top")
geometry = da.geometry

# Use public dims property
da = self.da.isel(time=0) if "time" in self.da.dims else self.da

Key principles:

  • Never access private attributes (prefixed with _) of another class
  • Use public methods like sel, isel, and public properties like dims
  • If you need to access private state, that's a signal the class is missing a public API
  • Plotters should plot, not subset — keep data manipulation in the data layer
Dominant language
Jupyter Notebook
Stars
8
Forks
1
Avg merge
4m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DHI/python-package-development

All issues in DHI/python-package-development

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.