{"id":15515345,"url":"https://github.com/szepeviktor/very-clean-code","last_synced_at":"2025-04-23T03:19:08.434Z","repository":{"id":68727204,"uuid":"574060132","full_name":"szepeviktor/very-clean-code","owner":"szepeviktor","description":"How to code without future problems ⚪","archived":false,"fork":false,"pushed_at":"2025-01-08T14:15:56.000Z","size":17,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T21:32:15.862Z","etag":null,"topics":["clean-code","cleancode","code-style","coding-standards","php"],"latest_commit_sha":null,"homepage":"https://github.com/stars/szepeviktor/lists/theory","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/szepeviktor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-12-04T09:55:18.000Z","updated_at":"2025-01-08T14:16:00.000Z","dependencies_parsed_at":"2024-10-02T10:03:34.313Z","dependency_job_id":"b00b5560-8106-485d-8621-b1ab45ea1fb4","html_url":"https://github.com/szepeviktor/very-clean-code","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/szepeviktor%2Fvery-clean-code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szepeviktor%2Fvery-clean-code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szepeviktor%2Fvery-clean-code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szepeviktor%2Fvery-clean-code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/szepeviktor","download_url":"https://codeload.github.com/szepeviktor/very-clean-code/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250360668,"owners_count":21417754,"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":["clean-code","cleancode","code-style","coding-standards","php"],"created_at":"2024-10-02T10:01:47.854Z","updated_at":"2025-04-23T03:19:08.418Z","avatar_url":"https://github.com/szepeviktor.png","language":null,"funding_links":["https://github.com/sponsors/szepeviktor"],"categories":[],"sub_categories":[],"readme":"# Very clean code\n\n[![Tweet](https://img.shields.io/badge/Tweet-share-d5d5d5?style=social\u0026logo=twitter)](https://twitter.com/intent/tweet?text=Found%20useful%20policies%20of%20%40szepeviktor\u0026url=https%3A%2F%2Fgithub.com%2Fszepeviktor%2Fvery-clean-code)\n[![theories](https://img.shields.io/badge/more-theories-purple)](https://github.com/stars/szepeviktor/lists/theory)\n\nAdditions to https://github.com/piotrplenik/clean-code-php\n\n💡 Cognitive Load is what matters https://github.com/zakirullin/cognitive-load\n\n## 🟢 Happy and unhappy path\n\n```\nif (error) unhappy path;\n\nhappy path;\n```\n\n🖱️ https://szymonkrajewski.pl/why-should-you-return-early/\n\n## 🟢 Arrays versus objects\n\nAn array is a dumb container of unknown data. Arrays should be used to store lists: keyless elements of the same type.\nBTW strings are containers of unknown bytes.\n\n🖱️ https://github.com/CuyZ/Valinor\n\n## 🟢 Base value of an array\n\nThe base value of an array is not `null` but `[]`.\n\n## 🔴 String manipulation\n\nString manipulation including concatenation is the job of low level libraries as it is highly error prone.\n\n:bulb: Creating messages for UI and logs is not string manipulation.\n\n## 🟢 Write positive conditions\n\nExplicit is better than implicit.\n\n```\n❌ if (state !== null)\n✔️ if (state instanceof Resolver)\n```\n\n## 🔴 Mixing programming languages\n\nHave low-level libraries connect different languages.\n\n- Main language + SQL: ORM\n- Main language + HTML: template engine\n- Main language + JavaScript: JSON\n- Main language + CSS: use CSS classes and CSS variables\n\n## Principles\n\n- Abstraction: strive to make deeper layers do the work, write less project-specific code.\n- Be explicit! Implicit things need more brain work thus are error prone.\n- \u003e There are only two hard things in Computer Science: cache invalidation and naming things.\n\n    — Phil Karlton\n\n    Gain knowledge of _things_, so you can name them.\n\n## Support my thinking\n\nPlease consider supporting my work, as formulating the conclusions above takes at least several months.\n\n[![Sponsor](https://github.com/szepeviktor/.github/raw/master/.github/assets/github-like-sponsor-button.svg)](https://github.com/sponsors/szepeviktor)\n\nThank you!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszepeviktor%2Fvery-clean-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fszepeviktor%2Fvery-clean-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszepeviktor%2Fvery-clean-code/lists"}