{"id":20862819,"url":"https://github.com/quickheaven/design-patterns","last_synced_at":"2025-06-13T11:08:44.697Z","repository":{"id":103705528,"uuid":"318818658","full_name":"quickheaven/design-patterns","owner":"quickheaven","description":"Design patterns review project","archived":false,"fork":false,"pushed_at":"2025-01-05T04:05:07.000Z","size":91,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-19T07:45:01.310Z","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/quickheaven.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":"2020-12-05T15:13:20.000Z","updated_at":"2025-01-05T04:05:11.000Z","dependencies_parsed_at":"2024-01-22T06:29:00.054Z","dependency_job_id":"826bb0d4-dbe6-4f36-94f8-2f6dc5563993","html_url":"https://github.com/quickheaven/design-patterns","commit_stats":null,"previous_names":["quickheaven/design-patterns"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quickheaven%2Fdesign-patterns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quickheaven%2Fdesign-patterns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quickheaven%2Fdesign-patterns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quickheaven%2Fdesign-patterns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quickheaven","download_url":"https://codeload.github.com/quickheaven/design-patterns/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243236280,"owners_count":20258820,"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-11-18T05:25:58.467Z","updated_at":"2025-03-12T14:41:54.803Z","avatar_url":"https://github.com/quickheaven.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"#  Design Patterns using Java and Python\nDesign patterns review project.\n\n\n# Java to Python OOP: Bridge the Gap for Java Developers\n## 1. Introduction to Object-Oriented Programing Concepts\n\nClass - a blueprint needed to create an object. Contains attributes and behaviors.\\\nObject - created from a class (instance of the class)\n* Attributes - characteristics that describe an object\n* Methods - operations that can be performed on the object.\n\nObject variable - The variable used when creating an object (instance variable) \\\nOverloading - only available on Java not Python \\\nEncapsulation - The ability to hide the data stored in an object. \\\nAbstraction - Information hiding - details are hidden \\\n\\\nInheritance \\\nBase class/superclass - A class from which another class inherits its attributes and behaviors \\\nDerived class/subclass - derived from a base class \\\nIs-a relationship \\\nComposition - has-a relationship \\\nOverriding methods - The ability of a subclass to re-implement a method inherit from a super class \\\nPolymorphism - Means \"many forms\". This feature allows the implementation to have the same method but behave differently depending which class is instantiated. Also referred as dynamic binding. \\\nInterfaces - only contains declaration of methods and properties. (Not supported on Python) \\\nAbstract classes - a base class where at least one method is not implemented. \\\nMethod defines the behavior of an object that belongs to the class. \\\nThree types of methods: Constructors, Accessors, Modifiers. \n\nClass Design Principles\n1. Design so that objects can interact with other objects.\n2. Keep reuse in mind.\n3. Keep the scope as minimal as possible.\n4. Keep maintainability in mind.\n\nPublic\nIn Python all instance variables are public.\n\nPrivate\nIn Python - encapsulation preference is indicated.\n'__' - indicates the variable is private\nDirectly accessing this variables will result to error.\n\nObjects Aid in Abstraction\nAn object is an instance of a class\nIn Python, the _init_() is used as the constructor of the class\n\nInheritance Design Principles\n1. Design classes, methods/functions so that they can be inherited (extended).\n2. Design interaction between parent and child using UML diagrams (association)\n3. Design for simplicity - one functionality per class.\n\n## 2. Class Design\n\n\nDifference: Python and Java\nEverything is an object \\\nThere is a reserved word \"__init__\" to initialize class (dunder method)  \\\nEncapsulation is not strictly implemented (Object can directly access the instnace variables) \\\nThere is no private reserved word. \\\nThere is __ symbol that implements encapsulation but is not widely used. \\\nEvery method in a class has a self-parameter as the first parameter \\\nThere is no concept of overloaded methods of constructs. The compiler used the latest version of the method. \\\n\n\n\n## 3. Inheritance\n\nDifferences Implementing Inheritance: Python and Java\nPython does not use extends as reserved word\nclass Sphere(Circle)\n\nPython does not have super() method\nClassName.methodName()\nsuper().methodName()\n\nAbstract classes are implemented using decorator methods in Python; in Java they are implemented using abstract reserved word.\n\nPython does not have interfaces; Java implements interface.\nPython has multiple interfaces; Java supports only singular inheritance.\n\nMethod Resolution Order (MRO) multiple inheritance.\n\nImplementation of Abstract classes:\nfrom abc import ABC, abstractmethod\n@abstractmethod\n\n# Java Design Patterns\n## Behavioral\n## Creational\n## Structural\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquickheaven%2Fdesign-patterns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquickheaven%2Fdesign-patterns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquickheaven%2Fdesign-patterns/lists"}