Title: Section 3.3: Code Decoupling & Abstractions · Issue #12 · bham-carpentries/python-intermediate-development · GitHub
Open Graph Title: Section 3.3: Code Decoupling & Abstractions · Issue #12 · bham-carpentries/python-intermediate-development
X Title: Section 3.3: Code Decoupling & Abstractions · Issue #12 · bham-carpentries/python-intermediate-development
Description: I like the spirit of Section 3.3 but not so much the delivery. In the first exercise we separate out the data loading from the analyse function (good!), so we end up with two functions def load_inflammation_data(dir_path): ... def analys...
Open Graph Description: I like the spirit of Section 3.3 but not so much the delivery. In the first exercise we separate out the data loading from the analyse function (good!), so we end up with two functions def load_inf...
X Description: I like the spirit of Section 3.3 but not so much the delivery. In the first exercise we separate out the data loading from the analyse function (good!), so we end up with two functions def load_inf...
Opengraph URL: https://github.com/bham-carpentries/python-intermediate-development/issues/12
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Section 3.3: Code Decoupling \u0026 Abstractions","articleBody":"I like the spirit of [Section 3.3](https://carpentries-incubator.github.io/python-intermediate-development/instructor/33-code-decoupling-abstractions.html) but not so much the delivery.\n\nIn the first exercise we separate out the data loading from the analyse function (good!), so we end up with two functions\n```python\ndef load_inflammation_data(dir_path): ...\ndef analyse_data(data_dir): ...\n```\nI would think it would make some sense to completely decouple these two functions so that when they are used, a user would do something like\n```python\ndata = load_inflammation_data(\"/path/to/data\")\nresult = analyse_data(data)\n```\nbut instead the example leaves the `load_inflammation_data` call inside `analyse_data`. This isn't the worst thing in the world to do but I would think that separating them would be better?\n\nThen in the next example they suggest going more towards this approach, but by introducing a class `CSVDataSource`. This seems a little pointless to me, and in fact Pylint would complain about this class having too few methods ([R0903](https://pylint.pycqa.org/en/latest/user_guide/messages/refactor/too-few-public-methods.html))! And in the end they still pass that class to the function and rely on duck typing to load the data...\n","author":{"url":"https://github.com/tomneep","@type":"Person","name":"tomneep"},"datePublished":"2025-02-20T16:44:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/12/python-intermediate-development/issues/12"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d94ffac5-e4c9-f284-64ad-03736b2b761a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D21A:2E7826:15CBF2D:1E50510:6A4C06A2 |
| html-safe-nonce | 66a652b722beee520269368271c3e83ace38d0d0b39a49760917f6578e35fdc4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMjFBOjJFNzgyNjoxNUNCRjJEOjFFNTA1MTA6NkE0QzA2QTIiLCJ2aXNpdG9yX2lkIjoiNjM5NjA3MTg1NzQwMTYyODMyMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 589bc13ac4218184f82b1b5c68e7d76d81e75701444e4bc503575264857e700c |
| hovercard-subject-tag | issue:2866721893 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/bham-carpentries/python-intermediate-development/12/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f3e9e397e27999663d63d9031fdfe505731166eb75642151a7159d3e1112f446/bham-carpentries/python-intermediate-development/issues/12 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f3e9e397e27999663d63d9031fdfe505731166eb75642151a7159d3e1112f446/bham-carpentries/python-intermediate-development/issues/12 |
| og:image:alt | I like the spirit of Section 3.3 but not so much the delivery. In the first exercise we separate out the data loading from the analyse function (good!), so we end up with two functions def load_inf... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tomneep |
| hostname | github.com |
| expected-hostname | github.com |
| None | 940b0dbb4d0fe72558ee760b2ff0f25a504383fdfe404f3a7691ec853b8dc17f |
| turbo-cache-control | no-preview |
| go-import | github.com/bham-carpentries/python-intermediate-development git https://github.com/bham-carpentries/python-intermediate-development.git |
| octolytics-dimension-user_id | 41366779 |
| octolytics-dimension-user_login | bham-carpentries |
| octolytics-dimension-repository_id | 928344524 |
| octolytics-dimension-repository_nwo | bham-carpentries/python-intermediate-development |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | true |
| octolytics-dimension-repository_parent_id | 257930838 |
| octolytics-dimension-repository_parent_nwo | carpentries-incubator/python-intermediate-development |
| octolytics-dimension-repository_network_root_id | 257930838 |
| octolytics-dimension-repository_network_root_nwo | carpentries-incubator/python-intermediate-development |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b0267d17ea43e55446153a7e2c60bb6ac3cffd6b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width