{"id":18638226,"url":"https://github.com/dehasi/sd-p2","last_synced_at":"2025-08-09T12:36:50.949Z","repository":{"id":222529478,"uuid":"757103304","full_name":"dehasi/sd-p2","owner":"dehasi","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-14T18:03:10.000Z","size":128,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-17T14:11:14.818Z","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/dehasi.png","metadata":{"files":{"readme":"README.adoc","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":"2024-02-13T20:15:03.000Z","updated_at":"2024-02-14T17:50:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"a19860a5-3ebe-4136-b834-592771975aa7","html_url":"https://github.com/dehasi/sd-p2","commit_stats":null,"previous_names":["dehasi/sd-p2"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dehasi/sd-p2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dehasi%2Fsd-p2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dehasi%2Fsd-p2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dehasi%2Fsd-p2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dehasi%2Fsd-p2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dehasi","download_url":"https://codeload.github.com/dehasi/sd-p2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dehasi%2Fsd-p2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266521077,"owners_count":23942386,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-11-07T05:39:56.646Z","updated_at":"2025-07-22T15:34:15.576Z","avatar_url":"https://github.com/dehasi.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Plan for Practice #2\n:toc:\n\n== Homework\n* [ ] Explain the task\n\n== Different OOP Implementations\n* [ ] \"private\" in Python\n* [ ] \"interfaces\" in C++\n* [ ] \"Diamond\" inheritance in C++\n\n== Interface Types\n* [ ] Marker\n* [ ] Functional\n* [ ] Trait, mixin\n\n== Break Barbara Liskov Principle\nLSP is about contracts and not about code.\n\n* [ ] Preconditions cannot be strengthened in the subtype\n* [ ] Postconditions cannot be weakened in the subtype\n* [ ] Invariants must be preserved in the subtype\n\n== Break Inheritance\n* [ ] InstrumentedSet\n* [ ] ForwardedSet\n\n== Open Closed Principle with Duck Simulator\n\nimage::meme.png[]\n\n=== Inheritance\n\n* [ ] Add new behavior -  `fly()`\n* [ ] Add a new type - `DecoyDuck`\n\n[plantuml]\n----\n@startuml\nabstract class Duck {\n    swim()\n    quack()\n    {abstract} display()\n}\n\nclass MallardDuck\nclass RedheadDuck\nclass RubberDuck\n\nDuck \u003c|-- MallardDuck\nDuck \u003c|-- RedheadDuck\nDuck \u003c|-- RubberDuck\n\nMallardDuck : display()\nRedheadDuck : display()\nRubberDuck : display()\nRubberDuck : quack() {squeak}\n\n\n@enduml\n----\n\n=== Interfaces\n[plantuml]\n----\n@startuml\nabstract class Duck {\n    swim()\n    {abstract} display()\n}\n\ninterface Quackable {\n    quack()\n}\n\n'interface Flyable {\n'    fly()\n'}\n\nclass MallardDuck {\n    display()\n'    fly()\n    quack()\n}\nclass RedheadDuck {\n    display()\n'    fly()\n    quack()\n}\nclass RubberDuck {\n    display()\n    quack()\n}\n\nDuck \u003c|-- MallardDuck\nDuck \u003c|-- RedheadDuck\nDuck \u003c|-- RubberDuck\n\n\nQuackable \u003c|.. MallardDuck\nQuackable \u003c|.. RedheadDuck\nQuackable \u003c|.. RubberDuck\n\n'Flyable \u003c|.. MallardDuck\n'Flyable \u003c|.. RedheadDuck\n'Flyable \u003c|.. RubberDuck\n\n\n@enduml\n----\n\n=== Composition\n\n[plantuml]\n----\n@startuml\nabstract class Duck {\n    QuackBehavior : quackBehavior\n    performQuack()\n    swim()\n    {abstract} display()\n}\n\ninterface QuackBehavior {\n    quack()\n}\n\nclass Quack {\n    quack()\n}\n\nclass Squeak {\n    quack() // rubber duck squeak\n}\n\nQuackBehavior \u003c|.. Quack\nQuackBehavior \u003c|.. Squeak\n\nclass MallardDuck\nclass RedheadDuck\nclass RubberDuck\n\nQuackBehavior *-- Duck\nDuck \u003c|-- MallardDuck\nDuck \u003c|-- RedheadDuck\nDuck \u003c|-- RubberDuck\n\nMallardDuck : display()\nRedheadDuck : display()\nRubberDuck : display()\n@enduml\n----\n\n\n==== Composition vs Aggregation\nAn explanation from Stackoverflow https://softwareengineering.stackexchange.com/a/61527/314568\n\n* `A` \"owns\" `B` =\u003e Composition: `B` has no meaning or purpose in the system without `A`\n* `A` \"uses\" `B` =\u003e Aggregation: `B` exists independently (conceptually) from `A`fa\n\n.Example 1:\n....\nA Company is an aggregation of People. A Company is a composition of Accounts. When a Company ceases to do business its Accounts cease to exist but its People continue to exist.\n....\n\n.Example 2: (very simplified)\n....\nA Text Editor owns a Buffer (composition). A Text Editor uses a File (aggregation). When the Text Editor is closed, the Buffer is destroyed but the File itself is not destroyed.\n....\n\n== Show Dependency Injection (DI)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdehasi%2Fsd-p2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdehasi%2Fsd-p2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdehasi%2Fsd-p2/lists"}