{"id":22315295,"url":"https://github.com/erran/java-style-guide","last_synced_at":"2025-08-03T00:07:32.151Z","repository":{"id":26319150,"uuid":"29767419","full_name":"erran/java-style-guide","owner":"erran","description":"A Java coding style guide","archived":false,"fork":false,"pushed_at":"2015-05-02T15:59:16.000Z","size":192,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-20T08:47:44.871Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erran.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}},"created_at":"2015-01-24T06:03:27.000Z","updated_at":"2015-01-24T06:03:27.000Z","dependencies_parsed_at":"2022-08-21T06:00:34.449Z","dependency_job_id":null,"html_url":"https://github.com/erran/java-style-guide","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/erran%2Fjava-style-guide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erran%2Fjava-style-guide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erran%2Fjava-style-guide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erran%2Fjava-style-guide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erran","download_url":"https://codeload.github.com/erran/java-style-guide/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245579677,"owners_count":20638679,"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":[],"created_at":"2024-12-03T22:12:58.042Z","updated_at":"2025-03-26T03:11:30.028Z","avatar_url":"https://github.com/erran.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Java Style Guide\nMy personal Java coding style guide. These are standards I've learned from\ndifferent sources and want to convert into a format similar to the Ruby\nstyle guide's.\n\n## Table of Contents\n* [Source Code Layout](#source-code-layout)\n* [Classes](#classes)\n\n## Source Code Layout\n* Use three **spaces** (soft tabs) per indentation level.\n* Adopt a consistent brace-line style. There are two popular styles in the\nJava community both of which are considered good - trailing braces (Option A) and leading braces (Option B).\n  * **(Option A)** Braces on the same line as the previous expression.\n    ```java\n    // bad - can be unclear when using throws/extends/implements\n    // on class/method definitions\n    if (isOdd()) {\n    }\n\n    // good - works naturally with throws/extends/implements\n    if (isEven())\n    {\n    }\n    ```\n  * **(Option B)** Braces on the subsequent line.\n    ```java\n    // bad - adds extra insignificant lines\n    if (isOdd())\n    {\n    }\n\n    // good - reduces the LOC (lines of code)\n    if (isEven()) {\n    }\n    ```\n\n# Classes\n* Use a consistent structure in your class definitions.\n\n ```java\n public class Car\n {\n    // public constructors\n    public Car(String make, String model)\n    {\n       m_make = make;\n       m_model = model;\n    }\n\n    // public methods\n    public String toString()\n    {\n       return getMakeString() + \" model: \" + m_model;\n    }\n\n    // protected/private methods\n    private String getMakeString()\n    {\n       return \"make: \" + m_make;\n    }\n\n    // protected/private members\n    private String m_make;\n    private String m_model;\n\n    // protected/private static members\n    private static Logger ms_logger; \n }\n ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferran%2Fjava-style-guide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferran%2Fjava-style-guide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferran%2Fjava-style-guide/lists"}