{"id":13857969,"url":"https://github.com/jennybc/code-smells-and-feels","last_synced_at":"2025-08-20T20:33:37.363Z","repository":{"id":70157375,"uuid":"140384806","full_name":"jennybc/code-smells-and-feels","owner":"jennybc","description":"Talk on code smells and feels and how to change that via refactoring","archived":false,"fork":false,"pushed_at":"2020-01-24T21:04:56.000Z","size":2658,"stargazers_count":230,"open_issues_count":1,"forks_count":20,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-12-10T04:05:59.998Z","etag":null,"topics":["r","refactoring","talk"],"latest_commit_sha":null,"homepage":"https://rstd.io/code-smells","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jennybc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-10T06:04:13.000Z","updated_at":"2024-08-30T14:41:36.000Z","dependencies_parsed_at":"2023-08-26T08:35:46.848Z","dependency_job_id":null,"html_url":"https://github.com/jennybc/code-smells-and-feels","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jennybc%2Fcode-smells-and-feels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jennybc%2Fcode-smells-and-feels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jennybc%2Fcode-smells-and-feels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jennybc%2Fcode-smells-and-feels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jennybc","download_url":"https://codeload.github.com/jennybc/code-smells-and-feels/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230454432,"owners_count":18228392,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["r","refactoring","talk"],"created_at":"2024-08-05T03:01:52.656Z","updated_at":"2024-12-19T15:10:47.750Z","avatar_url":"https://github.com/jennybc.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"# Code Smells and Feels\n\nTalk initially prepared for [useR!2018](https://user2018.r-project.org) Brisbane. Also delivered elsewhere, such as the [First Mexican Statistical Association School in Data Science](https://amestad.mx/escuela/1/)  \nby Jenny Bryan  \n[jennybryan.org](https://jennybryan.org)  \nTwitter: [@jennyBryan](https://twitter.com/jennyBryan/)  \nGitHub: [@jennybc](https://github.com/jennybc)  \n\n\u003e \"Code smell\" is an evocative term for that vague feeling of unease we get when reading certain bits of code. It's not necessarily wrong, but neither is it obviously correct. We may be reluctant to work on such code, because past experience suggests it's going to be fiddly and bug-prone. In contrast, there's another type of code that just feels good to read and work on. What's the difference? If we can be more precise about code smells and feels, we can be intentional about writing code that is easier and more pleasant to work on. I've been fortunate to spend the last couple years embedded in a group of developers working on the tidyverse and r-lib packages. Based on this experience, I'll talk about specific code smells and deodorizing strategies for R.\n\n## Link to this repo\n\n[rstd.io/code-smells](https://rstd.io/code-smells) is a shortlink to HERE\n\n## Slides\n\n\u003ca href=\"https://speakerdeck.com/jennybc/code-smells-and-feels\"\u003e\u003cimg src=\"2018-07_user-brisbane-400.jpeg\"\u003e\u003c/a\u003e\n\nSlides [on SpeakerDeck](https://speakerdeck.com/jennybc/code-smells-and-feels)\n\nSlides [as PDF file](2018-07_user-brisbane-bryan.pdf) here in this repo\n\n## Video\n\nVideo is available on YouTube:  \n\u003chttps://www.youtube.com/watch?v=7oyiPBjLAWY\u003e\n\n## Credits and resources\n\nAnnotated and hyperlink-y list of resources mentioned in the slides, in roughly the same order.\n\n---\n\nDo useRs have less formal training in CS/programming than others writing code?\n\n2018 Stack Overflow Annual Developer Survey: \u003chttps://insights.stackoverflow.com/survey\u003e\n\nAdapted from original code by [Julia Silge](https://juliasilge.com), data scientist at  Stack Overflow.\n\nCode here in this repo: [stackoverflow-survey](stackoverflow-survey)\n\n---\n\nTalks about programming style, workflow, and policies\n\nSome that inspired me:\n\nGood Programming Practice, UseR! 2004 Keynote, Martin Mächler  \nhttp://www.ci.tuwien.ac.at/Conferences/useR-2004/  \n\nWhat I find important when R Programming and Recent Cool Features in R  \n2018 eRum Keynote by Martin Mächler and R Core Team  \nhttp://stat.ethz.ch/~maechler/U/R/eRum_2018_ProgR-ALTREP.html  \n\nMy own efforts in this genre:\n\n[Zen And The aRt Of Workflow Maintenance](https://speakerdeck.com/jennybc/zen-and-the-art-of-workflow-maintenance), IASC/NZSA 2017, Jenny Bryan\n\n[Workflow: You should have one](https://speakerdeck.com/jennybc/workflow-you-should-have-one), EARL London 2017, Jenny Bryan\n\n---\n\nCakes that look like hedgehogs ... sort of?\n\n * Beautiful hedgehog cake: [BBC goodfood recipe](https://www.bbcgoodfood.com/recipes/hedgehog-cake)\n  * Homely hedgehog cake: [Reddit thread](https://www.reddit.com/r/funny/comments/1am3x7/so_a_friend_of_my_girlfriend_made_a_cake_for_her/), \u003chttp://i.imgur.com/peilfAh.jpg\u003e \n  * Photos originally found at \u003chttps://www.boredpanda.com/funny-cake-fails-expectations-reality/\u003e\n  \n---\n\n[What Every Successful Person Knows, But Never Says](https://jamesclear.com/ira-glass-failure)  \nJames Clear blog post that discusses an Ira Glass interview. Indicative quote:\n\n\u003e All of us who do creative work, we get into it because we have good taste. But it's like there is this gap. For the first couple years that you're making stuff, what you're making isn't so good. It’s not that great. It’s trying to be good, it has ambition to be good, but it’s not that good.\n\u003e\n\u003e But your taste, the thing that got you into the game, is still killer. And your taste is good enough that you can tell that what you're making is kind of a disappointment to you.\n\n---\n\nThe teams that bring you\n\n  * tidyverse packages: [org members](https://github.com/orgs/tidyverse/people) and [outside collaborators](https://github.com/orgs/tidyverse/outside-collaborators)\n  * r-lib packages: [org members](https://github.com/orgs/r-lib/people) and [outside collaborators](https://github.com/orgs/r-lib/outside-collaborators)\n  \n---\n\nRefactoring  \nImproving the Design of Existing Code  \nby Martin Fowler  \n(with Kent Beck, John Brant, William Opdyke, and Don Roberts)  \nhttps://martinfowler.com/books/refactoring.html\n\nDumpster photo by NeONBRAND  \nhttps://unsplash.com/photos/8Yk4T-tDSYY\n\n---\n\nCode Smells – a Short List  \nblog post by Arne Mertz  \nhttps://arne-mertz.de/2017/08/code-smells-short-list/\n\n---\n\nbizarro: all code snippets are given here in [R/](R)\n\nBeach + glass orb photo by Perchek Industrie  \nhttps://unsplash.com/photos/y-rmmZZfD1I\n\n---\n\nGood enough practices in scientific computing  \nWilson G, Bryan J, Cranston K, Kitzes J, Nederbragt L, et al. (2017) Good enough practices in scientific computing. PLOS Computational Biology 13(6): e1005510. \u003chttps://doi.org/10.1371/journal.pcbi.1005510\u003e\n\n\u003e Do not comment and uncomment sections of code to control a program's behavior.\n\n---\n\n`if() else()` described in breathless AI style:  \nyou mean a one layer neural network with identity activation and no hidden layers\n\n[Tweet](https://twitter.com/F_Vaggi/status/1011127587639197696) by [Federico Vaggi](https://twitter.com/F_Vaggi)\n\n---\n\nReturn early and clearly  \nBlog post by Arne Mertz  \nhttps://arne-mertz.de/2016/12/early-return/  \n\"Handling preconditions\" section is the basis of my early return before/after example `get_some_data()`.\n\nMore posts and conversations about early returns and avoiding if entirely:\n\n  * [Avoid Else, Return Early](http://blog.timoxley.com/post/47041269194/avoid-else-return-early), blog post by Tim Oxley\n  * [Anti-If: The missing patterns](https://code.joejag.com/2016/anti-if-the-missing-patterns.html), blog post by Joe Wright\n  * Recent discussion on Hacker News: \u003chttps://news.ycombinator.com/item?id=17408836\u003e\n\nYoda photo by Kory Westerhold on flickr  \nhttps://www.flickr.com/photos/korymatthew/14211839966\n\n---\n\nBaby with diaper photo by rawpixel  \nhttps://unsplash.com/photos/6RjllGKO88U\n\n---\n\nIn addition to the **Refactoring** book referenced above, these are other good reads for improving your code:\n\nThe Art of Readable Code  \nSimple and Practical Techniques for Writing Better Code  \nDustin Boswell, Trevor Foucher  \nhttp://shop.oreilly.com/product/9780596802301.do\n\nThe Pragmatic Programmer  \nFrom Journeyman to Master  \nby Andrew Hunt and David Thomas  \nhttps://pragprog.com/book/tpp/the-pragmatic-programmer\n\n---\n\nUpgrade your cargo cult for the win  \nhttps://meaningness.com/metablog/upgrade-your-cargo-cult\n\nToddler on run bike photo by Jordan Sanchez  \nhttps://unsplash.com/photos/Vbzx-yy5FoA\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjennybc%2Fcode-smells-and-feels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjennybc%2Fcode-smells-and-feels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjennybc%2Fcode-smells-and-feels/lists"}