{"id":22615656,"url":"https://github.com/marcellodesales/advanced-dry-solid-java-17","last_synced_at":"2025-03-29T00:42:39.895Z","repository":{"id":142072422,"uuid":"606138147","full_name":"marcellodesales/advanced-dry-solid-java-17","owner":"marcellodesales","description":"Project containing learnings of Advanced Java 17 features and SOLID/DRY principles!","archived":false,"fork":false,"pushed_at":"2023-02-24T19:36:37.000Z","size":85,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-03T10:46:23.367Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/marcellodesales.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":"2023-02-24T17:27:09.000Z","updated_at":"2023-02-24T19:36:09.000Z","dependencies_parsed_at":"2023-07-09T05:32:01.954Z","dependency_job_id":null,"html_url":"https://github.com/marcellodesales/advanced-dry-solid-java-17","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/marcellodesales%2Fadvanced-dry-solid-java-17","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcellodesales%2Fadvanced-dry-solid-java-17/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcellodesales%2Fadvanced-dry-solid-java-17/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcellodesales%2Fadvanced-dry-solid-java-17/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcellodesales","download_url":"https://codeload.github.com/marcellodesales/advanced-dry-solid-java-17/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246122247,"owners_count":20726822,"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-08T19:08:42.964Z","updated_at":"2025-03-29T00:42:39.882Z","avatar_url":"https://github.com/marcellodesales.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Advanced DRY and SOLID Java 17\n\nAdvanced topics in Java 17\n\n* Records: Immutable data objects\n* Sealed Classes and Interfaces: Control class hierarchies\n* Advanced Classes and interfaces: Nested and iner types, Algebric Data types, etc\n* Generics: Generic and parameterized types\n* Lambda Expressions and method references: anonymous methods and functional interfaces\n* Annotations: Metadata for classes to be processed\n* Optional: Safe alternative to null\n* Try-with-Resources: resources and exception handlers\n\n## Generics\n\n* Generic types: type parameters, prameterized types, type arguments, generic methods\n* Bounded type parameters, Generics and inheritance, Raw types, Wildcards with uper/lower bounds, type erasure.\n* Generics and arrays\n* Parameterized values\n\n## Annotations\n\n* Metadata to javacode\n* Use cases: \n  * Provide additional information to compiler\n  * @override, @Deprecated, @SupressWarning, @SafeVarargs, @FunctionalInterface\n* Processor at compile time, generate code\n  * Lombok: generate boilerplate code: projectlombok.org\n  * Immutables: immutable value classes: immutables.github.io\n  * MapStruct: transform data structures: mapstruct.org, POJO + DTO https://github.com/mapstruct/mapstruct-examples\n* Runtime processing of data\n  * Spring Framework: spring.io\n  * Jackson FasterXML: json/xml\n  * JavaEE/JakartaEE\n  * JUnit, Checkerframework.org\n\n# Solid Principes\n\n\u003e **CODE EXAMPLES**: https://github.com/marcellodesales/pluralsight-refactoring-solid-java17\n\n* Single Responsibility Principle\n* Open-close Principle\n* Liskov Substitution Principle\n* Interface Segregation Principle\n* Dependency Inversion Principle\n\nEasier to understand code and reason\n\n## When not to use\n\n* Code Fragility: when the software breaks in many places.\n* Code Rigidity: tendency for software to be difficult to change even in simple ways, with cascading of changes\n  * Loosely-coupled systems should have lower rigidity\n* High technical debt: the cost of prioritizing fast delivery over code quality for long periods of time\n  * Fast Delivery: Easiest Fix/change, Fast, Poorly written code\n  * Code Quality: Takes more time, adds more complexity, maintainable code and easier to repair/evolve\n  * It will be accumulated over time\n\n## Single Responsibility Principle (SRP)\n\n\u003e \"We want to design components that are self-containerd: independent and with a single, well-defined purpose\"\n\u003e - Andrew Hunt \u0026 David Thomas, The pragmatic Programmer\n\n* Every function class or module should have one and only one responsibility\n  * Business logic, Persistence, User Interface, Logging/Telemetry, Orchestration, Users,\n  * Input/Output, Networking, Error handling\n* Classes are less coupled\n* If statements, switch statements are candidates\n* Code is more difficult to change\n  * God classes\n  * Methods with too many calls to different concerns\n  * Report generation could be repeatable but they would change\n* Use events-based alternative for complex orchestration\n* Identify Reasons to change -\u003e Refactor \n  * Move other responsibilities\n  * Create new classes moving responsibilities\n  * Each component (method, class, or package) should have only one reason to change!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcellodesales%2Fadvanced-dry-solid-java-17","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcellodesales%2Fadvanced-dry-solid-java-17","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcellodesales%2Fadvanced-dry-solid-java-17/lists"}